示例#1
0
        protected override void ParseRemainingArguments(IList <string> remainders)
        {
            var command = PopArgument(remainders);

            if (!String.IsNullOrEmpty(command))
            {
                if (!ActionsHelper.TryParseEnum(command, out var cmd))
                {
                    Exit($"Unrecognized command {command}.");
                }

                Action = cmd;
            }

            Args = remainders.ToArray();
        }
示例#2
0
        private (Actions action, string[] args) ParseCommandLine(string command)
        {
            var match = commandLineRegex_.Match(command);

            if (!match.Success)
            {
                return(Actions.Unrecognized, new string[] { });
            }

            var action    = match.Groups["action"].Value;
            var arguments = match.Groups["args"].Value;
            var args      = CommandLineHelper.SplitArgs(arguments);

            if (!ActionsHelper.TryParseEnum(action, out var cmd))
            {
                return(Actions.Unrecognized, new string[] { });
            }

            return(cmd, args);
        }