Exemple #1
0
        /// <summary>
        /// Parse command line arguments for sort command
        /// </summary>
        /// <param name="args">Array of command line arguments.</param>
        private static void SortOption(string[] args)
        {
            Sort options = new Sort();
            CommandLineArguments parser = new CommandLineArguments();

            // Add the parameters
            parser.Parameter(ArgumentType.DefaultArgument, "InputFilename", ArgumentValueType.String, "", "File Paths");
            parser.Parameter(ArgumentType.Optional, "SortByReadName", ArgumentValueType.Bool, "n", "Sort by read name");
            parser.Parameter(ArgumentType.Optional, "Help", ArgumentValueType.Bool, "", "");
            parser.Parameter(ArgumentType.Optional, "OutputFilename", ArgumentValueType.String, "o", "Output file name");

            if (args.Length > 0)
            {
                try
                {
                    parser.Parse(args, options);
                }
                catch (ArgumentParserException ex)
                {
                    DisplayErrorMessage(ex.Message);
                    DisplayErrorMessage(Resources.SortHelp);
                    Environment.Exit(-1);
                }
                if (options.Help)
                {
                    DisplayErrorMessage(Resources.SortHelp);
                }
                else
                {
                    options.DoSort();
                }
            }
            else
            {
                DisplayErrorMessage(Resources.SortHelp);
            }
        }