void InitializeCommandLineParser(ICommandLineElementParser<Command> x) { Parser<IEnumerable<ICommandLineElement>, IDefinitionElement> definitions = (from username in x.Definition("username") select username) .Or(from password in x.Definition("password") select password) .Or(from instance in x.Definition("instance") select instance); Parser<IEnumerable<ICommandLineElement>, ISwitchElement> switches = (from username in x.Switch("username") select username) .Or(from password in x.Switch("password") select password) .Or(from password in x.Switch("password") select password) .Or(from password in x.Switch("password") select password); x.Add(from arg in x.Argument("install") from instance in definitions.Optional("instance", null) from username in definitions.Optional("username", null) from password in definitions.Optional("password", null) select (Command)new InstallCommand(_configuration.WinServiceSettings, _commandLine, instance.Value, username.Value, password.Value)); x.Add(from arg in x.Argument("uninstall") from instance in definitions.Optional("instance", null) select (Command)new UninstallCommand(_configuration.WinServiceSettings, _commandLine, instance.Value)); x.Add(from arg in x.Argument("run") select (Command)new RunCommand(_configuration.Coordinator, _configuration.WinServiceSettings.ServiceName)); }
private static void InitializeCommandLineParser(ICommandLineElementParser <ICommand> x) { x.Add((from arg in x.Argument("exit") select(ICommand) new ExitCommand()) .Or(from arg in x.Argument("quit") select(ICommand) new ExitCommand()) .Or(from arg in x.Argument("help") select(ICommand) new HelpCommand()) ); }
private static void InitializeCommandLineParser(ICommandLineElementParser <ICommand> x) { x.Add((from arg in x.Argument("exit") select(ICommand) new ExitCommand()) .Or(from arg in x.Argument("quit") select(ICommand) new ExitCommand()) .Or(from arg in x.Argument("help") select(ICommand) new HelpCommand()) .Or(from arg in x.Argument("move") from sourceQueueName in x.Definition("from") from destinationQueueName in x.Definition("to") from count in (from d in x.Definition("count") select d).Optional("count", "1") select(ICommand) new MoveCommand(sourceQueueName.Value, destinationQueueName.Value, int.Parse(count.Value))) ); }
private static void InitializeCommandLineParser(ICommandLineElementParser<ICommand> x) { x.Add((from arg in x.Argument("exit") select (ICommand) new ExitCommand()) .Or(from arg in x.Argument("quit") select (ICommand) new ExitCommand()) .Or(from arg in x.Argument("help") select (ICommand) new HelpCommand()) .Or(from arg in x.Argument("move") from sourceQueueName in x.Definition("from") from destinationQueueName in x.Definition("to") from count in (from d in x.Definition("count") select d).Optional("count", "1") select (ICommand) new MoveCommand(sourceQueueName.Value, destinationQueueName.Value, int.Parse(count.Value))) ); }
void InitializeCommandLineParser(ICommandLineElementParser<ICommand> x) { x.Add((from arg in x.Argument("exit") select (ICommand) new ExitCommand()) .Or(from arg in x.Argument("quit") select (ICommand) new ExitCommand()) .Or(from arg in x.Argument("help") select (ICommand) new HelpCommand()) .Or(from arg in x.Argument("move") from fromUri in x.Definition("from") from toUri in x.Definition("to") from count in (from d in x.Definition("count") select d).Optional("count", "1") select (ICommand) new MoveCommand(fromUri.Value, toUri.Value, int.Parse(count.Value), _configuration)) ); }
void InitializeCommandLineParser(ICommandLineElementParser <ICommand> x) { x.Add((from arg in x.Argument("exit") select(ICommand) new ExitCommand()) .Or(from arg in x.Argument("quit") select(ICommand) new ExitCommand()) .Or(from arg in x.Argument("help") select(ICommand) new HelpCommand()) .Or(from arg in x.Argument("move") from fromUri in x.Definition("from") from toUri in x.Definition("to") from count in (from d in x.Definition("count") select d).Optional("count", "1") select(ICommand) new MoveCommand(fromUri.Value, toUri.Value, int.Parse(count.Value), _configuration)) ); }
internal static void AddTopshelfOptions(ICommandLineElementParser <Option> x) { int n; x.Add((from arg in x.Argument("command") from cmd in x.Argument() where int.TryParse(cmd.Id, out n) select(Option) new CommandOption(cmd.Id)) .Or(from arg in x.Argument("help") select(Option) new HelpOption()) .Or(from arg in x.Argument("run") select(Option) new RunOption()) .Or(from help in x.Switch("help") select(Option) new HelpOption()) .Or(from systemHelp in x.Switch("systemonly") select(Option) new SystemOnlyHelpOption()) .Or(from name in x.Definition("servicename") select(Option) new ServiceNameOption(name.Value)) .Or(from desc in x.Definition("description") select(Option) new ServiceDescriptionOption(desc.Value)) .Or(from disp in x.Definition("displayname") select(Option) new DisplayNameOption(disp.Value)) .Or(from instance in x.Definition("instance") select(Option) new InstanceOption(instance.Value)) .Or(from arg in x.Argument("stop") select(Option) new StopOption()) .Or(from arg in x.Argument("start") select(Option) new StartOption()) .Or(from arg in x.Argument("install") select(Option) new InstallOption()) .Or(from arg in x.Argument("uninstall") select(Option) new UninstallOption()) .Or(from arg in x.Switch("sudo") select(Option) new SudoOption()) .Or(from username in x.Definition("username") from password in x.Definition("password") select(Option) new ServiceAccountOption(username.Value, password.Value)) .Or(from autostart in x.Switch("autostart") select(Option) new AutostartOption()) .Or(from manual in x.Switch("manual") select(Option) new ManualStartOption()) .Or(from disabled in x.Switch("disabled") select(Option) new DisabledOption()) .Or(from delayed in x.Switch("delayed") select(Option) new DelayedOption()) .Or(from interactive in x.Switch("interactive") select(Option) new InteractiveOption()) .Or(from autostart in x.Switch("localsystem") select(Option) new LocalSystemOption()) .Or(from autostart in x.Switch("localservice") select(Option) new LocalServiceOption()) .Or(from autostart in x.Switch("networkservice") select(Option) new NetworkServiceOption()) ); }
internal static void AddUnknownOptions(ICommandLineElementParser <Option> x) { x.Add((from unknown in x.Definition() select(Option) new UnknownOption(unknown.ToString())) .Or(from unknown in x.Switch() select(Option) new UnknownOption(unknown.ToString())) .Or(from unknown in x.Argument() select(Option) new UnknownOption(unknown.ToString()))); }
internal static void AddUnknownOptions(ICommandLineElementParser<Option> x) { x.Add((from unknown in x.Definition() select (Option)new UnknownOption(unknown.ToString())) .Or(from unknown in x.Switch() select (Option)new UnknownOption(unknown.ToString())) .Or(from unknown in x.Argument() select (Option)new UnknownOption(unknown.ToString()))); }
internal static void AddTopshelfOptions(ICommandLineElementParser<Option> x) { int n; x.Add((from arg in x.Argument("install") select (Option)new InstallOption()) .Or(from arg in x.Argument("uninstall") select (Option)new UninstallOption()) .Or(from arg in x.Argument("start") select (Option)new StartOption()) .Or(from arg in x.Argument("command") from cmd in x.Argument() where int.TryParse(cmd.Id, out n) select (Option)new CommandOption(cmd.Id)) .Or(from arg in x.Argument("help") select (Option)new HelpOption()) .Or(from arg in x.Argument("stop") select (Option)new StopOption()) .Or(from arg in x.Switch("sudo") select (Option)new SudoOption()) .Or(from arg in x.Argument("run") select (Option)new RunOption()) .Or(from username in x.Definition("username") from password in x.Definition("password") select (Option)new ServiceAccountOption(username.Value, password.Value)) .Or(from autostart in x.Switch("autostart") select (Option)new AutostartOption()) .Or(from manual in x.Switch("manual") select (Option)new ManualStartOption()) .Or(from disabled in x.Switch("disabled") select (Option)new DisabledOption()) .Or(from delayed in x.Switch("delayed") select (Option)new DelayedOption()) .Or(from interactive in x.Switch("interactive") select (Option)new InteractiveOption()) .Or(from autostart in x.Switch("localsystem") select (Option)new LocalSystemOption()) .Or(from autostart in x.Switch("localservice") select (Option)new LocalServiceOption()) .Or(from autostart in x.Switch("networkservice") select (Option)new NetworkServiceOption()) .Or(from help in x.Switch("help") select (Option)new HelpOption()) .Or(from systemHelp in x.Switch("systemonly") select (Option)new SystemOnlyHelpOption()) .Or(from name in x.Definition("servicename") select (Option)new ServiceNameOption(name.Value)) .Or(from desc in x.Definition("description") select (Option)new ServiceDescriptionOption(desc.Value)) .Or(from disp in x.Definition("displayname") select (Option)new DisplayNameOption(disp.Value)) .Or(from instance in x.Definition("instance") select (Option)new InstanceOption(instance.Value))); }
protected static void InternalInitializeCommandLineParser(ICommandLineElementParser<Command> x) { x.Add((from arg in x.Argument("help") select (Command) new HelpCommand()) .Or(from arg in x.Switch("help") select (Command) new HelpCommand()) .Or(from arg1 in x.Argument("generate") from publicKeyFile in x.Definition("public") from privateKeyFile in x.Definition("private") from bits in x.Definition("bits").Optional("bits", "1024") select (Command) new GenerateNewKeyCommand(publicKeyFile.Value, privateKeyFile.Value, Convert.ToInt32(bits.Value))) .Or(from arg1 in x.Argument("sign") from key in x.Definition("key") from @in in x.Definition("in") from @out in x.Definition("out").Optional("out", "signed.xml") select (Command) new SignXmlFileCommand(@in.Value, @out.Value, key.Value)) .Or(from arg1 in x.Argument("validate") from @in in x.Definition("file") from sig in x.Definition("signature") select (Command) new ValidateXmlFileCommand(@in.Value, sig.Value)) ); }
static void InitializeCommandLineParser(ICommandLineElementParser<Option> x) { x.Add((from arg in x.Argument("install") select (Option)new InstallOption()) .Or(from arg in x.Argument("uninstall") select (Option)new UninstallOption()) .Or(from arg in x.Argument("start") select (Option)new StartOption()) .Or(from arg in x.Argument("help") select (Option)new HelpOption()) .Or(from arg in x.Argument("stop") select (Option)new StopOption()) .Or(from arg in x.Switch("sudo") select (Option)new SudoOption()) .Or(from arg in x.Argument("run") select (Option)new RunOption()) .Or(from username in x.Definition("username") from password in x.Definition("password") select (Option)new ServiceAccountOption(username.Value, password.Value)) .Or(from autostart in x.Switch("autostart") select (Option)new AutostartOption()) .Or(from autostart in x.Switch("localservice") select (Option)new LocalServiceOption()) .Or(from autostart in x.Switch("networkservice") select (Option)new NetworkServiceOption()) .Or(from autostart in x.Switch("help") select (Option)new HelpOption()) .Or(from instance in x.Definition("instance") select (Option)new InstanceOption(instance.Value))); }
static void InitializeCommandLineParser(ICommandLineElementParser <Option> x) { x.Add((from arg in x.Argument("install") select(Option) new InstallOption()) .Or(from arg in x.Argument("uninstall") select(Option) new UninstallOption()) .Or(from arg in x.Argument("start") select(Option) new StartOption()) .Or(from arg in x.Argument("help") select(Option) new HelpOption()) .Or(from arg in x.Argument("stop") select(Option) new StopOption()) .Or(from arg in x.Switch("sudo") select(Option) new SudoOption()) .Or(from arg in x.Argument("run") select(Option) new RunOption()) .Or(from username in x.Definition("username") from password in x.Definition("password") select(Option) new ServiceAccountOption(username.Value, password.Value)) .Or(from autostart in x.Switch("autostart") select(Option) new AutostartOption()) .Or(from autostart in x.Switch("localservice") select(Option) new LocalServiceOption()) .Or(from autostart in x.Switch("networkservice") select(Option) new NetworkServiceOption()) .Or(from autostart in x.Switch("help") select(Option) new HelpOption()) .Or(from instance in x.Definition("instance") select(Option) new InstanceOption(instance.Value))); }
private void InitializeCommandLineParser(ICommandLineElementParser <ICommand> x) { Parser <IEnumerable <ICommandLineElement>, IDefinitionElement> definitions = (from output in x.Definition("out") select output); Parser <IEnumerable <ICommandLineElement>, ISwitchElement> switches = (from verbose in x.Switch("verbose") select verbose) .Or(from quiet in x.Switch("quiet") select quiet); x.Add(from arg in x.Argument("version") from verbose in switches.Optional("verbose", false) from quiet in switches.Optional("quiet", false) from output in definitions.Optional("out", "output.txt") select(ICommand) new VersionCommand(verbose.Value, quiet.Value, output.Value)); }
private void InitializeCommandLineParser(ICommandLineElementParser<ICommand> x) { Parser<IEnumerable<ICommandLineElement>, IDefinitionElement> definitions = (from output in x.Definition("out") select output); Parser<IEnumerable<ICommandLineElement>, ISwitchElement> switches = (from verbose in x.Switch("verbose") select verbose) .Or(from quiet in x.Switch("quiet") select quiet); x.Add(from arg in x.Argument("version") from verbose in switches.Optional("verbose", false) from quiet in switches.Optional("quiet", false) from output in definitions.Optional("out", "output.txt") select (ICommand) new VersionCommand(verbose.Value, quiet.Value, output.Value)); }
internal static void InitializeCommandLineParser(ICommandLineElementParser <Option> x) { x.Add((from arg in x.Argument("install") select(Option) new InstallOption()) .Or(from arg in x.Argument("uninstall") select(Option) new UninstallOption()) .Or(from arg in x.Argument("start") select(Option) new StartOption()) .Or(from arg in x.Argument("help") select(Option) new HelpOption()) .Or(from arg in x.Argument("stop") select(Option) new StopOption()) .Or(from arg in x.Switch("sudo") select(Option) new SudoOption()) .Or(from arg in x.Argument("run") select(Option) new RunOption()) .Or(from username in x.Definition("username") from password in x.Definition("password") select(Option) new ServiceAccountOption(username.Value, password.Value)) .Or(from autostart in x.Switch("autostart") select(Option) new AutostartOption()) .Or(from manual in x.Switch("manual") select(Option) new ManualStartOption()) .Or(from disabled in x.Switch("disabled") select(Option) new DisabledOption()) .Or(from delayed in x.Switch("delayed") select(Option) new DelayedOption()) .Or(from interactive in x.Switch("interactive") select(Option) new InteractiveOption()) .Or(from autostart in x.Switch("localservice") select(Option) new LocalServiceOption()) .Or(from autostart in x.Switch("networkservice") select(Option) new NetworkServiceOption()) .Or(from autostart in x.Switch("help") select(Option) new HelpOption()) .Or(from name in x.Definition("servicename") select(Option) new ServiceNameOption(name.Value)) .Or(from desc in x.Definition("description") select(Option) new ServiceDescriptionOption(desc.Value)) .Or(from disp in x.Definition("displayname") select(Option) new DisplayNameOption(disp.Value)) .Or(from instance in x.Definition("instance") select(Option) new InstanceOption(instance.Value)) .Or(from unknown in x.Definition() select(Option) new UnknownOption(unknown.ToString())) .Or(from unknown in x.Switch() select(Option) new UnknownOption(unknown.ToString())) .Or(from unknown in x.Argument() select(Option) new UnknownOption(unknown.ToString()))); }
internal static void InitializeCommandLineParser(ICommandLineElementParser<Option> x) { x.Add((from arg in x.Argument("install") select (Option)new InstallOption()) .Or(from arg in x.Argument("uninstall") select (Option)new UninstallOption()) .Or(from arg in x.Argument("start") select (Option)new StartOption()) .Or(from arg in x.Argument("help") select (Option)new HelpOption()) .Or(from arg in x.Argument("stop") select (Option)new StopOption()) .Or(from arg in x.Switch("sudo") select (Option)new SudoOption()) .Or(from arg in x.Argument("run") select (Option)new RunOption()) .Or(from username in x.Definition("username") from password in x.Definition("password") select (Option)new ServiceAccountOption(username.Value, password.Value)) .Or(from autostart in x.Switch("autostart") select (Option)new AutostartOption()) .Or(from manual in x.Switch("manual") select (Option)new ManualStartOption()) .Or(from disabled in x.Switch("disabled") select (Option)new DisabledOption()) .Or(from delayed in x.Switch("delayed") select (Option)new DelayedOption()) .Or(from interactive in x.Switch("interactive") select (Option)new InteractiveOption()) .Or(from autostart in x.Switch("localservice") select (Option)new LocalServiceOption()) .Or(from autostart in x.Switch("networkservice") select (Option)new NetworkServiceOption()) .Or(from autostart in x.Switch("help") select (Option)new HelpOption()) .Or(from name in x.Definition("servicename") select (Option)new ServiceNameOption(name.Value)) .Or(from desc in x.Definition("description") select (Option)new ServiceDescriptionOption(desc.Value)) .Or(from disp in x.Definition("displayname") select (Option)new DisplayNameOption(disp.Value)) .Or(from instance in x.Definition("instance") select (Option)new InstanceOption(instance.Value)) .Or(from unknown in x.Definition() select (Option)new UnknownOption(unknown.ToString())) .Or(from unknown in x.Switch() select (Option)new UnknownOption(unknown.ToString())) .Or(from unknown in x.Argument() select (Option)new UnknownOption(unknown.ToString()))); }
private static void InitializeCommandLinePatterns(ICommandLineElementParser <ICommand> x) { Parser <IEnumerable <ICommandLineElement>, ISwitchElement> switches = (from replace in x.Switch("replace") select replace); x.Add(from remote in x.Argument("remote") from add in x.Argument("add") from replace in switches.Optional("replace", false) from alias in x.Argument() from url in x.Argument() select(ICommand) new AddRemoteRepositoryCommand(alias.Id, url.Id, replace.Value)); x.Add(from remote in x.Argument("remote") from add in x.Argument("rm") from alias in x.Argument() from url in x.Argument() select(ICommand) new RemoveRemoteRepositoryCommand(alias.Id, url.Id)); }
private static void InitializeCommandLinePatterns(ICommandLineElementParser<ICommand> x) { Parser<IEnumerable<ICommandLineElement>, ISwitchElement> switches = (from replace in x.Switch("replace") select replace); x.Add(from remote in x.Argument("remote") from add in x.Argument("add") from replace in switches.Optional("replace", false) from alias in x.Argument() from url in x.Argument() select (ICommand) new AddRemoteRepositoryCommand(alias.Id, url.Id, replace.Value)); x.Add(from remote in x.Argument("remote") from add in x.Argument("rm") from alias in x.Argument() from url in x.Argument() select (ICommand) new RemoveRemoteRepositoryCommand(alias.Id, url.Id)); }
static void InitializeCommandLineParser(ICommandLineElementParser <Command> x) { x.Add((from arg in x.Argument("exit") select(Command) new ExitCommand()) .Or(from arg in x.Argument("quit") select(Command) new ExitCommand()) .Or(from arg in x.Argument("help") select(Command) new HelpCommand()) .Or(from arg in x.Argument("set") from arg2 in x.Argument("uri") from uri in x.Argument() select(Command) new SetUriCommand(uri.Id)) .Or(from arg in x.Argument("count") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) select(Command) new CountCommand(uri.Value)) .Or(from arg in x.Argument("move") from fromUri in x.Definition("from") from toUri in x.Definition("to") from count in (from d in x.Definition("count") select d).Optional("count", "1") select(Command) new MoveCommand(fromUri.Value, toUri.Value, int.Parse(count.Value))) .Or(from arg in x.Argument("requeue") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) from count in (from d in x.Definition("count") select d).Optional("count", "1") select(Command) new RequeueCommand(uri.Value, int.Parse(count.Value))) .Or(from arg in x.Argument("peek") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) select(Command) new PeekCommand(uri.Value, 1)) .Or(from arg in x.Argument("save") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) from name in x.Definition("file") from count in (from d in x.Definition("count") select d).Optional("count", "1") from remove in (from s in x.Switch("remove") select s).Optional("remove", false) select(Command) new SaveCommand(uri.Value, name.Value, int.Parse(count.Value), remove.Value)) .Or(from arg in x.Argument("load") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) from name in x.Definition("file") from count in (from d in x.Definition("count") select d).Optional("count", "1") from remove in (from s in x.Switch("remove") select s).Optional("remove", false) select(Command) new LoadCommand(uri.Value, name.Value, int.Parse(count.Value), remove.Value)) .Or(from arg in x.Argument("trace") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) from count in (from d in x.Definition("count") select d).Optional("count", "100") select(Command) new TraceCommand(uri.Value, int.Parse(count.Value))) ); }
static void InitializeCommandLineParser(ICommandLineElementParser<Command> x) { x.Add((from arg in x.Argument("exit") select (Command) new ExitCommand()) .Or(from arg in x.Argument("quit") select (Command) new ExitCommand()) .Or(from arg in x.Argument("help") select (Command) new HelpCommand()) .Or(from arg in x.Argument("set") from arg2 in x.Argument("uri") from uri in x.Argument() select (Command) new SetUriCommand(uri.Id)) .Or(from arg in x.Argument("count") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) select (Command) new CountCommand(uri.Value)) .Or(from arg in x.Argument("move") from fromUri in x.Definition("from") from toUri in x.Definition("to") from count in (from d in x.Definition("count") select d).Optional("count", "1") select (Command) new MoveCommand(fromUri.Value, toUri.Value, int.Parse(count.Value))) .Or(from arg in x.Argument("requeue") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) from count in (from d in x.Definition("count") select d).Optional("count", "1") select (Command) new RequeueCommand(uri.Value, int.Parse(count.Value))) .Or(from arg in x.Argument("peek") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) select (Command) new PeekCommand(uri.Value, 1)) .Or(from arg in x.Argument("save") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) from name in x.Definition("file") from count in (from d in x.Definition("count") select d).Optional("count", "1") from remove in (from s in x.Switch("remove") select s).Optional("remove", false) select (Command)new SaveCommand(uri.Value, name.Value, int.Parse(count.Value), remove.Value)) .Or(from arg in x.Argument("load") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) from name in x.Definition("file") from count in (from d in x.Definition("count") select d).Optional("count", "1") from remove in (from s in x.Switch("remove") select s).Optional("remove", false) select (Command)new LoadCommand(uri.Value, name.Value, int.Parse(count.Value), remove.Value)) .Or(from arg in x.Argument("status") from uri in (from d in x.Definition("uri") select d).Optional("uri",Program.CurrentUri) select (Command) new StatusCommand(uri.Value)) .Or(from arg in x.Argument("trace") from uri in (from d in x.Definition("uri") select d).Optional("uri", Program.CurrentUri) from count in (from d in x.Definition("count") select d).Optional("count", "100") select (Command) new TraceCommand(uri.Value, int.Parse(count.Value))) ); }