func Tesses.CrossLang.Shell.Console(dd) { var dir = Env.CrossLangConfig / "ConsoleApps"; if(dd.Arguments.Length == 1) { Console.WriteLine("List of console applications:"); if(FS.Local.DirectoryExists(dir)) each(var item : FS.Local.EnumeratePaths(dir)) { Console.WriteLine(Tesses.CrossLang.GetNameAndDescription(item / item.GetFileName() + ".crvm")); } return 0; } else if(dd.Arguments.Length >= 2) { var consolename = dd.Arguments[1]; var consolepath = dir / consolename / consolename + ".crvm"; if(FS.Local.FileExists(consolepath)) { var env = VM.CreateEnvironment({}); env.RegisterEverything(); env.LockRegister(); env.LoadFileWithDependencies(FS.Local,consolepath); var myArgs = []; myArgs.Add(consolepath.ToString()); for(var i = 2; i < dd.Arguments.Count; i++) { myArgs.Add(dd.Arguments[i]); } return env.GetDictionary().main(myArgs); } else { Console.WriteLine($"Could not find console application with name {consolename}."); return 1; } } }