Beispiel #1
0
        public Program(IProgramConsole console) : base(console, PROGRAM_NAME, PROGRAM_DESCRIPTION, PROGRAM_SYNOPSIS)
        {
            UnknownOptionAction = ByPass;

            Spec
            .Option("Command", "-c|--command", "The command name")
            .Option("UserName", "--username", "The user name")
            .Flag("TestOnly", "-t|--test-only", "Run on test mode");
        }
        protected ProgramDescription(IProgramConsole console, string name, string description, string synopsis)
            : this(console, name, description)
        {
            if (string.IsNullOrWhiteSpace(synopsis))
            {
                throw new ArgumentNullException(nameof(synopsis));
            }

            Synopsis = synopsis;
        }
        protected ProgramDescription(IProgramConsole console, string name, string description)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrWhiteSpace(description))
            {
                throw new ArgumentNullException(nameof(description));
            }

            _console = console;
            Name = name;
            Description = description;
            UnknownOptionAction = UnknownOptionAction.ThrowException;
            RepeatedOptionAction = RepeatedOptionAction.ThrowException;
            Spec = new OptionSpecification();
        }
 protected ProgramDescription(IProgramConsole console, string name, string description, string[] synopsis)
     : this(console, name, description, string.Join(Environment.NewLine, synopsis ?? new string[] { }))
 { }