예제 #1
0
        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());
                }
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            ShellEnvironment shenv = new ShellEnvironment(args);

            shenv.Run();
        }
예제 #3
0
 public ShellContext(ShellEnvironment env)
 {
     Environment = env;
 }