public void Execute(ShellContext ctx) { string cmd = m_args[0]; m_args.RemoveAt(0); if (ctx.Environment.BuiltInCommandExists(cmd)) { ctx.Environment.ExecBuiltInCommand(cmd, m_args.ToArray()); } else { var path = ctx.Environment.FindApplicationInPath(cmd); if (string.IsNullOrEmpty(path)) { ShellEnvironment.WriteErrorLine($"{cmd} is not a built-in command and could not be found on the PATH or in the current directory."); } else { ctx.Environment.RunProgram(cmd, m_args.ToArray()); } } }
static void Main(string[] args) { ShellEnvironment shenv = new ShellEnvironment(args); shenv.Run(); }
public ShellContext(ShellEnvironment env) { Environment = env; }