Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // create Options object
            Options options = new Options();

            // add t option
            options.AddOption("t", false, "display current time");
            options.AddOption("h", false, "Display help options");
            CommandLineParser parser = new DefaultParser();
            CommandLine       cmd    = parser.Parse(options, args);

            options.AddOption("h", "help", false, "Print this usage information");
            options.AddOption("v", "verbose", false, "Print out VERBOSE information");

            OptionGroup optionGroup = new OptionGroup();

            optionGroup.AddOption(new OptionBuilder("f").HasArg(true).ArgName("filename").Build());
            optionGroup.AddOption(new OptionBuilder("m").HasArg(true).ArgName("email").Build());
            options.AddOptionGroup(optionGroup);

            if (cmd.HasOption("h"))
            {
                HelpFormatter formatter = new HelpFormatter();
                formatter.printHelp("x", options, true);
                return;
            }
            if (cmd.HasOption("t"))
            {
                Console.WriteLine(System.DateTime.Now);
            }
        }
Exemplo n.º 2
0
            internal virtual void AddOption(string longName, bool required, string description
                                            , string paramName)
            {
                Option option = OptionBuilder.Create(longName);

                options.AddOption(option);
            }
Exemplo n.º 3
0
        protected override Options CreateOptions()
        {
            Options options = new Options();

            options.AddOption("file", false, "Indicates the application will store data into files.");
            options.AddOption("dir", true, "The application directory.");
            return(options);
        }
Exemplo n.º 4
0
        private static Options GetOptions()
        {
            Options options = new Options();

            options.AddOption("c", "conf", true, "A file containing the configurations to make the " +
                              "instance of the network simulator.");
            options.AddOption("");
            return(options);
        }
Exemplo n.º 5
0
 public override void RegisterOptions(Options options)
 {
     options.AddOption("h", "address", true, "The address to a node of the network (typically a manager).");
     options.AddOption("x", "protocol", true, "Specifies the connection protocol ('http' or 'tcp').");
     options.AddOption("f", "format", true, "Format used to serialize messages to/from the manager " +
                       "service ('xml', 'json' or 'binary')");
     options.AddOption("p", "password", true, "The challenge password used in all connection handshaking " +
                       "throughout the network.");
     options.AddOption("u", "user", true, "The name of the user to authenticate in a HTTP connection.");
 }
Exemplo n.º 6
0
        private static Options InitOptions()
        {
            Options options = new Options();

            options.AddOption(OptionOutputFormat);
            options.AddOption(OptionPort);
            options.AddOption(OptionVerbose);
            options.AddOption(OptionXmlRegistry);
            return(options);
        }
Exemplo n.º 7
0
 static TimelineClientImpl()
 {
     // 1 minute
     opts = new Options();
     opts.AddOption("put", true, "Put the timeline entities/domain in a JSON file");
     opts.GetOption("put").SetArgName("Path to the JSON file");
     opts.AddOption(EntityDataType, false, "Specify the JSON file contains the entities"
                    );
     opts.AddOption(DomainDataType, false, "Specify the JSON file contains the domain"
                    );
     opts.AddOption("help", false, "Print usage");
 }
Exemplo n.º 8
0
 internal CommandLineOpts()
 {
     geteditsizeOpt = new Option("geteditsize", "return the number of uncheckpointed transactions on the NameNode"
                                 );
     checkpointOpt = OptionBuilder.Create("checkpoint");
     formatOpt     = new Option("format", "format the local storage during startup");
     helpOpt       = new Option("h", "help", false, "get help information");
     options.AddOption(geteditsizeOpt);
     options.AddOption(checkpointOpt);
     options.AddOption(formatOpt);
     options.AddOption(helpOpt);
 }
Exemplo n.º 9
0
        /// <exception cref="System.Exception"/>
        public override int Run(string[] args)
        {
            Options opts = new Options();

            opts.AddOption("lnl", ListLabelsCmd, false, "List cluster node-label collection");
            opts.AddOption("h", HelpCmd, false, "Displays help for all commands.");
            opts.AddOption("dnl", DirectlyAccessNodeLabelStore, false, "Directly access node label store, "
                           + "with this option, all node label related operations" + " will NOT connect RM. Instead, they will"
                           + " access/modify stored node labels directly." + " By default, it is false (access via RM)."
                           + " AND PLEASE NOTE: if you configured " + YarnConfiguration.FsNodeLabelsStoreRootDir
                           + " to a local directory" + " (instead of NFS or HDFS), this option will only work"
                           + " when the command run on the machine where RM is running." + " Also, this option is UNSTABLE, could be removed in future"
                           + " releases.");
            int         exitCode  = -1;
            CommandLine parsedCli = null;

            try
            {
                parsedCli = new GnuParser().Parse(opts, args);
            }
            catch (MissingArgumentException)
            {
                sysout.WriteLine("Missing argument for options");
                PrintUsage(opts);
                return(exitCode);
            }
            if (parsedCli.HasOption(DirectlyAccessNodeLabelStore))
            {
                accessLocal = true;
            }
            if (parsedCli.HasOption(ListLabelsCmd))
            {
                PrintClusterNodeLabels();
            }
            else
            {
                if (parsedCli.HasOption(HelpCmd))
                {
                    PrintUsage(opts);
                    return(0);
                }
                else
                {
                    syserr.WriteLine("Invalid Command Usage : ");
                    PrintUsage(opts);
                }
            }
            return(0);
        }
Exemplo n.º 10
0
        private void ParseHelp(string[] args)
        {
            var options = new Options();

            options.AddOption(_helpOption);
            options.AddOption(OptionBuilder.Factory.Create(Port));
            options.AddOption(OptionBuilder.Factory.Create(RunTime));
            options.AddOption(OptionBuilder.Factory.Create(Server));
            var commandLine = new GnuParser().Parse(options, args);

            if (commandLine.HasOption(Help) || args.Length == 0)
            {
                ShowHelp();
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Adds each viewer's opened/closed flag to user Options.
        /// </summary>
        private void AddViewersOptions()
        {
            foreach (MenuItem it in _menuViewers.MenuItems)
            {
                string key = it.Text;
                if (!key.Equals(Divider, StringComparison.Ordinal))
                {
                    _options.AddOption(
                        key,
//									!(it.Tag is MapView.Forms.MapObservers.TileViews.TopRouteViewForm),	// q. why is TopRouteViewForm under 'TileViews'
                        // a. why not.
                        (it.Tag is TopViewForm) ||                                                      // true to have the viewer open on 1st run.
                        (it.Tag is RouteViewForm) ||
                        (it.Tag is TileViewForm),
                        "Open on load - " + key,                                                                // appears as a tip at the bottom of the Options screen.
                        "Windows");                                                                             // this identifies what Option category the setting appears under.
                    // NOTE: the Console is not technically a viewer
                    var f = it.Tag as Form;                                                                     // but it appears under Options like the real viewers.
                    if (f != null)
                    {
                        f.VisibleChanged += (sender, e) => {
                            if (!_quitting)
                            {
                                var fsender = sender as Form;
                                if (fsender != null)
                                {
                                    _options[key].Value = fsender.Visible;
                                }
                            }
                        };
                    }
                }
            }
        }
Exemplo n.º 12
0
 static HamletGen()
 {
     opts.AddOption("h", "help", false, "Print this help message").AddOption("s", "spec-class"
                                                                             , true, "The class that holds the spec interfaces. e.g. HamletSpec").AddOption("i"
                                                                                                                                                            , "impl-class", true, "An implementation class. e.g. HamletImpl").AddOption("o",
                                                                                                                                                                                                                                        "output-class", true, "Output class name").AddOption("p", "output-package", true
                                                                                                                                                                                                                                                                                             , "Output package name");
 }
Exemplo n.º 13
0
        /// <summary>parse args</summary>
        /// <exception cref="System.ArgumentException"/>
        private static CommandLine ParseArgs(Options opts, params string[] args)
        {
            OptionBuilder.WithArgName("NameNode|DataNode");
            OptionBuilder.HasArg();
            OptionBuilder.WithDescription("specify jmx service (NameNode by default)");
            Option jmx_service = OptionBuilder.Create("service");

            OptionBuilder.WithArgName("mbean server");
            OptionBuilder.HasArg();
            OptionBuilder.WithDescription("specify mbean server (localhost by default)");
            Option jmx_server = OptionBuilder.Create("server");

            OptionBuilder.WithDescription("print help");
            Option jmx_help = OptionBuilder.Create("help");

            OptionBuilder.WithArgName("mbean server port");
            OptionBuilder.HasArg();
            OptionBuilder.WithDescription("specify mbean server port, " + "if missing - it will try to connect to MBean Server in the same VM"
                                          );
            Option jmx_port = OptionBuilder.Create("port");

            OptionBuilder.WithArgName("VM's connector url");
            OptionBuilder.HasArg();
            OptionBuilder.WithDescription("connect to the VM on the same machine;" + "\n use:\n jstat -J-Djstat.showUnsupported=true -snap <vmpid> | "
                                          + "grep sun.management.JMXConnectorServer.address\n " + "to find the url");
            Option jmx_localVM = OptionBuilder.Create("localVM");

            opts.AddOption(jmx_server);
            opts.AddOption(jmx_help);
            opts.AddOption(jmx_service);
            opts.AddOption(jmx_port);
            opts.AddOption(jmx_localVM);
            CommandLine       commandLine = null;
            CommandLineParser parser      = new GnuParser();

            try
            {
                commandLine = parser.Parse(opts, args, true);
            }
            catch (ParseException e)
            {
                PrintUsage(opts);
                throw new ArgumentException("invalid args: " + e.Message);
            }
            return(commandLine);
        }
Exemplo n.º 14
0
            private Options BuildOptions()
            {
                Options opts = new Options();

                opts.AddOption(OptionBuilder.Create("s"));
                opts.AddOption(OptionBuilder.Create("r"));
                opts.AddOption(OptionBuilder.Create("c"));
                opts.AddOption(OptionBuilder.Create("m"));
                opts.AddOption(OptionBuilder.Create("t"));
                opts.AddOption(OptionBuilder.Create("p"));
                opts.AddOption(OptionBuilder.Create('h'));
                opts.AddOption(OptionBuilder.Create('e'));
                opts.AddOption(OptionBuilder.Create('?'));
                return(opts);
            }
Exemplo n.º 15
0
        /// <exception cref="System.Exception"/>
        public override int Run(string[] args)
        {
            Options opts = new Options();

            opts.AddOption(StatusCmd, true, "List queue information about given queue.");
            opts.AddOption(HelpCmd, false, "Displays help for all commands.");
            opts.GetOption(StatusCmd).SetArgName("Queue Name");
            CommandLine cliParser = null;

            try
            {
                cliParser = new GnuParser().Parse(opts, args);
            }
            catch (MissingArgumentException)
            {
                sysout.WriteLine("Missing argument for options");
                PrintUsage(opts);
                return(-1);
            }
            if (cliParser.HasOption(StatusCmd))
            {
                if (args.Length != 2)
                {
                    PrintUsage(opts);
                    return(-1);
                }
                return(ListQueue(cliParser.GetOptionValue(StatusCmd)));
            }
            else
            {
                if (cliParser.HasOption(HelpCmd))
                {
                    PrintUsage(opts);
                    return(0);
                }
                else
                {
                    syserr.WriteLine("Invalid Command Usage : ");
                    PrintUsage(opts);
                    return(-1);
                }
            }
        }
 public static void LoadOptions(Options options)
 {
     options.AddOption(
         VolutarMcdEditorPath,
         String.Empty,
         "Path to Volutar MCD Editor" + Environment.NewLine
         + "note: The path specified can actually be "
         + "used to start any valid program or to open "
         + "a specific file with its associated application.",
         "McdViewer");
 }
Exemplo n.º 17
0
        public static void Main(string[] args)
        {
            try
            {
                System.Console.Out.WriteLine("khubla.com Paradox DB reader");

                /*
                 * options
                 */
                Options options = new Options();
                Option  oo      = Option.Builder().ArgName(FileOption).LongOpt(FileOption).Type(Sharpen.Runtime.GetClassForType
                                                                                                    (typeof(string))).HasArg().Required(true).Desc("file to read").Build();
                options.AddOption(oo);

                /*
                 * parse
                 */
                CommandLineParser parser = new DefaultParser();
                CommandLine       cmd    = null;
                try
                {
                    cmd = parser.Parse(options, args);
                }
                catch (Exception e)
                {
                    Sharpen.Runtime.PrintStackTrace(e);
                    HelpFormatter formatter = new HelpFormatter();
                    formatter.PrintHelp("posix", options);
                    System.Environment.Exit(0);
                }

                /*
                 * get file
                 */
                string filename = cmd.GetOptionValue(FileOption);
                if (null != filename)
                {
                    File inputFile = new File(filename);
                    if (inputFile.Exists())
                    {
                        DBTableFile       pdxFile           = new DBTableFile();
                        PDXReaderListener pdxReaderListener = new PDXReaderCSVListenerImpl();
                        pdxFile.Read(inputFile, pdxReaderListener);
                        System.Console.Out.WriteLine("done");
                    }
                }
            }
            catch (Exception e)
            {
                Sharpen.Runtime.PrintStackTrace(e);
            }
        }
Exemplo n.º 18
0
        private static Options GetOptions()
        {
            Options options = new Options();

            options.AddOption("netconfig", true, "The network configuration file (default: network.conf).");
            options.AddOption("host", true, "The interface address to bind the socket on the local machine " +
                              "(optional - if not given binds to all interfaces)");
            options.AddOption("port", true, "The port to bind the socket.");
            options.AddOption("install", false, "Installs the node as a service in this machine");
            options.AddOption("user", true, "The user name for the authorization credentials to install/uninstall " +
                              "the service.");
            options.AddOption("password", true, "The password credential used to authorize installation and " +
                              "uninstallation of the service in this machine.");
            options.AddOption("service", false, "Starts the node as a service (used internally)");
            options.AddOption("uninstall", false, "Uninstalls a service for the node that was previously installed.");
            options.AddOption("protocol", true, "The connection protocol used by this node to listen connections");
            return(options);
        }
Exemplo n.º 19
0
 public ArgumentParser()
 {
     _options = new Options();
     _options.AddOption(OptionBuilder.Factory
                        .IsRequired()
                        .HasArg()
                        .WithArgName(RunTime)
                        .WithDescription("Setzt die Laufzeit in Minuten")
                        .Create(RunTime));
     _options.AddOption(OptionBuilder.Factory
                        .IsRequired()
                        .HasArg()
                        .WithArgName(Port)
                        .WithDescription("Setzt den COM-Port")
                        .Create(Port));
     _helpOption = OptionBuilder.Factory.WithDescription("Zeigt die Hilfe zu den Befehlen an.").Create(Help);
     _options.AddOption(_helpOption);
     _serverOption = OptionBuilder.Factory.WithArgName("url,user,password")
                     .HasArgs(3).IsRequired().WithValueSeparator(Convert.ToChar(","))
                     .WithDescription("Referenz zum TeamCity server").Create(Server);
     _options.AddOption(_serverOption);
 }
Exemplo n.º 20
0
 public ArgumentParser()
 {
     _options = new Options();
     _options.AddOption(OptionBuilder.Factory
                           .IsRequired()
                           .HasArg()
                           .WithArgName(RunTime)
                           .WithDescription("Setzt die Laufzeit in Minuten")
                           .Create(RunTime));
     _options.AddOption(OptionBuilder.Factory
                           .IsRequired()
                           .HasArg()
                           .WithArgName(Port)
                           .WithDescription("Setzt den COM-Port")
                           .Create(Port));
     _helpOption = OptionBuilder.Factory.WithDescription("Zeigt die Hilfe zu den Befehlen an.").Create(Help);
     _options.AddOption(_helpOption);
     _serverOption = OptionBuilder.Factory.WithArgName("url,user,password")
         .HasArgs(3).IsRequired().WithValueSeparator(Convert.ToChar(","))
         .WithDescription("Referenz zum TeamCity server").Create(Server);
     _options.AddOption(_serverOption);
 }
Exemplo n.º 21
0
        /// <summary>Creates configuration options object.</summary>
        private Options MakeOptions()
        {
            Options options = new Options();

            options.AddOption("datanodes", true, "How many datanodes to start (default 1)").AddOption
                ("format", false, "Format the DFS (default false)").AddOption("cmdport", true, "Which port to listen on for commands (default 0--we choose)"
                                                                              ).AddOption("nnport", true, "NameNode port (default 0--we choose)").AddOption("namenode"
                                                                                                                                                            , true, "URL of the namenode (default " + "is either the DFS cluster or a temporary dir)"
                                                                                                                                                            ).AddOption(OptionBuilder.Create("D")).AddOption(OptionBuilder.Create("writeConfig"
                                                                                                                                                                                                                                  )).AddOption(OptionBuilder.Create("writeDetails")).AddOption(OptionBuilder.Create
                                                                                                                                                                                                                                                                                                   ("help"));
            return(options);
        }
Exemplo n.º 22
0
        /// <summary>Build command-line options and descriptions</summary>
        private static Options BuildOptions()
        {
            Options options = new Options();

            // Build in/output file arguments, which are required, but there is no
            // addOption method that can specify this
            OptionBuilder.IsRequired();
            OptionBuilder.HasArgs();
            OptionBuilder.WithLongOpt("inputFile");
            options.AddOption(OptionBuilder.Create("i"));
            options.AddOption("o", "outputFile", true, string.Empty);
            options.AddOption("p", "processor", true, string.Empty);
            options.AddOption("h", "help", false, string.Empty);
            options.AddOption("maxSize", true, string.Empty);
            options.AddOption("step", true, string.Empty);
            options.AddOption("addr", true, string.Empty);
            options.AddOption("delimiter", true, string.Empty);
            options.AddOption("t", "temp", true, string.Empty);
            return(options);
        }
Exemplo n.º 23
0
        /// <summary>Creates configuration options object.</summary>
        private Options MakeOptions()
        {
            Options options = new Options();

            options.AddOption("nodfs", false, "Don't start a mini DFS cluster").AddOption("nomr"
                                                                                          , false, "Don't start a mini MR cluster").AddOption("nodemanagers", true, "How many nodemanagers to start (default 1)"
                                                                                                                                              ).AddOption("datanodes", true, "How many datanodes to start (default 1)").AddOption
                ("format", false, "Format the DFS (default false)").AddOption("nnport", true, "NameNode port (default 0--we choose)"
                                                                              ).AddOption("namenode", true, "URL of the namenode (default " + "is either the DFS cluster or a temporary dir)"
                                                                                          ).AddOption("rmport", true, "ResourceManager port (default 0--we choose)").AddOption
                ("jhsport", true, "JobHistoryServer port (default 0--we choose)").AddOption(OptionBuilder
                                                                                            .Create("D")).AddOption(OptionBuilder.Create("writeConfig")).AddOption(OptionBuilder
                                                                                                                                                                   .Create("writeDetails")).AddOption(OptionBuilder.Create("help"));
            return(options);
        }
Exemplo n.º 24
0
        private void ParseServers(string[] args)
        {
            var parser        = new GnuParser();
            var serverOptions = new Options();

            serverOptions.AddOption(_serverOption);
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i] != "-" + Server || i + 1 >= args.Length)
                {
                    continue;
                }
                var currentLine = parser.Parse(serverOptions, new[] { args[i], args[i + 1] });
                AddServer(currentLine.GetOptionValues(Server));
            }
        }
Exemplo n.º 25
0
        public virtual int Rm(string[] args)
        {
            Option  recursive = OptionBuilder.Create("r");
            Options rmOption  = new Options();

            rmOption.AddOption(recursive);
            bool recursiveOpt        = false;
            CommandLineParser parser = new GnuParser();

            try
            {
                CommandLine    line     = parser.Parse(rmOption, args);
                IList <string> argsList = line.GetArgList();
                if (argsList.Count != 2)
                {
                    return(UsageError("RM requires exactly one path argument", RmUsage));
                }
                if (!ValidatePath(argsList[1]))
                {
                    return(-1);
                }
                try
                {
                    if (line.HasOption("r"))
                    {
                        recursiveOpt = true;
                    }
                    registry.Delete(argsList[1], recursiveOpt);
                    return(0);
                }
                catch (Exception e)
                {
                    syserr.WriteLine(AnalyzeException("rm", e, argsList));
                }
                return(-1);
            }
            catch (ParseException exp)
            {
                return(UsageError("Invalid syntax " + exp.ToString(), RmUsage));
            }
        }
Exemplo n.º 26
0
        /// <summary>Command-line interface</summary>
        /// <exception cref="System.Exception"/>
        public static void Main(string[] args)
        {
            Configuration conf           = new HdfsConfiguration();
            Options       fetcherOptions = new Options();

            fetcherOptions.AddOption(Webservice, true, "HTTP url to reach the NameNode at");
            fetcherOptions.AddOption(Renewer, true, "Name of the delegation token renewer");
            fetcherOptions.AddOption(Cancel, false, "cancel the token");
            fetcherOptions.AddOption(Renew, false, "renew the token");
            fetcherOptions.AddOption(Print, false, "print the token");
            fetcherOptions.AddOption(HelpShort, Help, false, "print out help information");
            GenericOptionsParser parser = new GenericOptionsParser(conf, fetcherOptions, args
                                                                   );
            CommandLine cmd = parser.GetCommandLine();
            // get options
            string webUrl  = cmd.HasOption(Webservice) ? cmd.GetOptionValue(Webservice) : null;
            string renewer = cmd.HasOption(Renewer) ? cmd.GetOptionValue(Renewer) : null;
            bool   cancel  = cmd.HasOption(Cancel);
            bool   renew   = cmd.HasOption(Renew);
            bool   print   = cmd.HasOption(Print);
            bool   help    = cmd.HasOption(Help);

            string[] remaining = parser.GetRemainingArgs();
            // check option validity
            if (help)
            {
                PrintUsage(System.Console.Out);
                System.Environment.Exit(0);
            }
            if (cancel && renew || cancel && print || renew && print || cancel && renew && print)
            {
                System.Console.Error.WriteLine("ERROR: Only specify cancel, renew or print.");
                PrintUsage(System.Console.Error);
            }
            if (remaining.Length != 1 || remaining[0][0] == '-')
            {
                System.Console.Error.WriteLine("ERROR: Must specify exacltly one token file");
                PrintUsage(System.Console.Error);
            }
            // default to using the local file system
            FileSystem           local             = FileSystem.GetLocal(conf);
            Path                 tokenFile         = new Path(local.GetWorkingDirectory(), remaining[0]);
            URLConnectionFactory connectionFactory = URLConnectionFactory.DefaultSystemConnectionFactory;

            // Login the current user
            UserGroupInformation.GetCurrentUser().DoAs(new _PrivilegedExceptionAction_152(print
                                                                                          , tokenFile, conf, renew, cancel, webUrl, connectionFactory, renewer));
        }
Exemplo n.º 27
0
        /// <exception cref="Org.Apache.Commons.Cli.ParseException"/>
        public virtual bool Init(string[] args)
        {
            Options opts = new Options();

            opts.AddOption("appname", true, "Application Name. Default value - UnmanagedAM");
            opts.AddOption("priority", true, "Application Priority. Default 0");
            opts.AddOption("queue", true, "RM Queue in which this application is to be submitted"
                           );
            opts.AddOption("master_memory", true, "Amount of memory in MB to be requested to run the application master"
                           );
            opts.AddOption("cmd", true, "command to start unmanaged AM (required)");
            opts.AddOption("classpath", true, "additional classpath");
            opts.AddOption("help", false, "Print usage");
            CommandLine cliParser = new GnuParser().Parse(opts, args);

            if (args.Length == 0)
            {
                PrintUsage(opts);
                throw new ArgumentException("No args specified for client to initialize");
            }
            if (cliParser.HasOption("help"))
            {
                PrintUsage(opts);
                return(false);
            }
            appName    = cliParser.GetOptionValue("appname", "UnmanagedAM");
            amPriority = System.Convert.ToInt32(cliParser.GetOptionValue("priority", "0"));
            amQueue    = cliParser.GetOptionValue("queue", "default");
            classpath  = cliParser.GetOptionValue("classpath", null);
            amCmd      = cliParser.GetOptionValue("cmd");
            if (amCmd == null)
            {
                PrintUsage(opts);
                throw new ArgumentException("No cmd specified for application master");
            }
            YarnConfiguration yarnConf = new YarnConfiguration(conf);

            rmClient = YarnClient.CreateYarnClient();
            rmClient.Init(yarnConf);
            return(true);
        }
Exemplo n.º 28
0
        /// <summary>Build command-line options and descriptions</summary>
        /// <returns>command line options</returns>
        public static Options BuildOptions()
        {
            Options options = new Options();

            // Build in/output file arguments, which are required, but there is no
            // addOption method that can specify this
            OptionBuilder.IsRequired();
            OptionBuilder.HasArgs();
            OptionBuilder.WithLongOpt("outputFilename");
            options.AddOption(OptionBuilder.Create("o"));
            OptionBuilder.IsRequired();
            OptionBuilder.HasArgs();
            OptionBuilder.WithLongOpt("inputFilename");
            options.AddOption(OptionBuilder.Create("i"));
            options.AddOption("p", "processor", true, string.Empty);
            options.AddOption("v", "verbose", false, string.Empty);
            options.AddOption("f", "fix-txids", false, string.Empty);
            options.AddOption("r", "recover", false, string.Empty);
            options.AddOption("h", "help", false, string.Empty);
            return(options);
        }
Exemplo n.º 29
0
//		internal const string TileMinHeight     = "TileMinHeight";


        /// <summary>
        /// Loads default options for TopView in TopRouteView screens.
        /// </summary>
        protected internal override void LoadControl0Options()
        {
            _topBrushes = new Dictionary <string, SolidBrush>();
            _topPens    = new Dictionary <string, Pen>();

            _topBrushes.Add(FloorColor, new SolidBrush(Color.BurlyWood));
            _topBrushes.Add(ContentColor, new SolidBrush(Color.MediumSeaGreen));
            _topBrushes.Add(SelectedTypeColor, QuadrantsPanel.SelectColor);

            var penWest = new Pen(Color.Khaki, 4);

            _topPens.Add(WestColor, penWest);
            _topPens.Add(WestWidth, penWest);

            var penNorth = new Pen(Color.Wheat, 4);

            _topPens.Add(NorthColor, penNorth);
            _topPens.Add(NorthWidth, penNorth);

            var penOver = new Pen(Color.Black, 2);

            _topPens.Add(SelectorColor, penOver);
            _topPens.Add(SelectorWidth, penOver);

            var penSelected = new Pen(Color.RoyalBlue, 2);

            _topPens.Add(SelectedColor, penSelected);
            _topPens.Add(SelectedWidth, penSelected);

            var penGrid = new Pen(Color.Black, 1);

            _topPens.Add(GridColor, penGrid);
            _topPens.Add(GridWidth, penGrid);

            var pen10Grid = new Pen(Color.Black, 2);

            _topPens.Add(Grid10Color, pen10Grid);
            _topPens.Add(Grid10Width, pen10Grid);

            OptionChangedEventHandler bc = OnBrushChanged;
            OptionChangedEventHandler pc = OnPenColorChanged;
            OptionChangedEventHandler pw = OnPenWidthChanged;

//			ValueChangedEventHandler  dh = OnDiamondHeight;

            Options.AddOption(FloorColor, Color.BurlyWood, "Color of the floor tile indicator", Tile, bc);
            Options.AddOption(WestColor, Color.Khaki, "Color of the west tile indicator", Tile, pc);
            Options.AddOption(NorthColor, Color.Wheat, "Color of the north tile indicator", Tile, pc);
            Options.AddOption(ContentColor, Color.MediumSeaGreen, "Color of the content tile indicator", Tile, bc);
            Options.AddOption(WestWidth, 3, "Width of the west tile indicator in pixels", Tile, pw);
            Options.AddOption(NorthWidth, 3, "Width of the north tile indicator in pixels", Tile, pw);

            Options.AddOption(SelectorColor, Color.Black, "Color of the mouse-over indicator", Selector, pc);
            Options.AddOption(SelectorWidth, 2, "Width of the mouse-over indicator in pixels", Selector, pw);
            Options.AddOption(SelectedColor, Color.RoyalBlue, "Color of the selection line", Selector, pc);
            Options.AddOption(SelectedWidth, 2, "Width of the selection line in pixels", Selector, pw);
            Options.AddOption(SelectedTypeColor, Color.LightBlue, "Background color of the selected tiletype", Selector, bc);

            Options.AddOption(GridColor, Color.Black, "Color of the grid lines", Grid, pc);
            Options.AddOption(GridWidth, 1, "Width of the grid lines in pixels", Grid, pw);
            Options.AddOption(Grid10Color, Color.Black, "Color of every tenth grid line", Grid, pc);
            Options.AddOption(Grid10Width, 2, "Width of every tenth grid line in pixels", Grid, pw);
//			Options.AddOption(TileMinHeight,     _topViewPanel.TileLozengeHeight, "Minimum height of the grid tiles in pixels",  Grid,     dh);

            QuadrantsPanel.Pens       =
                _topViewPanel.TopPens = _topPens;

            QuadrantsPanel.Brushes       =
                _topViewPanel.TopBrushes = _topBrushes;

            Invalidate();
        }
Exemplo n.º 30
0
 // Don't add FORCEMANUAL, since that's added separately for all commands
 // that change state.
 /// <summary>
 /// Add CLI options which are specific to the transitionToActive command and
 /// no others.
 /// </summary>
 private void AddTransitionToActiveCliOpts(Options transitionToActiveCliOpts)
 {
     transitionToActiveCliOpts.AddOption(Forceactive, false, "force active");
 }
Exemplo n.º 31
0
 /// <summary>
 /// Add CLI options which are specific to the failover command and no
 /// others.
 /// </summary>
 private void AddFailoverCliOpts(Options failoverOpts)
 {
     failoverOpts.AddOption(Forcefence, false, "force fencing");
     failoverOpts.AddOption(Forceactive, false, "force failover");
 }
Exemplo n.º 32
0
 private void ParseServers(string[] args)
 {
     var parser = new GnuParser();
     var serverOptions = new Options();
     serverOptions.AddOption(_serverOption);
     for (int i = 0; i < args.Length; i++)
     {
         if (args[i] != "-" + Server || i + 1 >= args.Length) continue;
         var currentLine = parser.Parse(serverOptions, new[] {args[i], args[i + 1]});
         AddServer(currentLine.GetOptionValues(Server));
     }
 }
Exemplo n.º 33
0
 private void ParseHelp(string[] args)
 {
     var options = new Options();
     options.AddOption(_helpOption);
     options.AddOption(OptionBuilder.Factory.Create(Port));
     options.AddOption(OptionBuilder.Factory.Create(RunTime));
     options.AddOption(OptionBuilder.Factory.Create(Server));
     var commandLine = new GnuParser().Parse(options, args);
     if (commandLine.HasOption(Help) || args.Length == 0)
     {
         ShowHelp();
     }
 }