Ejemplo n.º 1
0
        private void ShowHelp(TextWriter writer, ModeParser specifiedMode = null)
        {
            writer.WriteLine($"Canvas {GetVersion()} {GetCopyright()}");
            writer.WriteLine();
            string modeName = specifiedMode?.Name ?? "[MODE]";

            if (specifiedMode != null)
            {
                writer.WriteLine($"{specifiedMode.Name} - {specifiedMode.Description}");
                writer.WriteLine();
            }
            writer.WriteLine($"Usage: Canvas.exe {modeName} [OPTIONS]+");
            writer.WriteLine();
            if (specifiedMode == null)
            {
                writer.WriteLine("Available modes:");
                foreach (var mode in _modeParsers.Values)
                {
                    writer.WriteLine($"\t{mode.Name} - {mode.Description}");
                }
                writer.WriteLine();
            }
            writer.WriteLine("Options:");
            if (specifiedMode != null)
            {
                specifiedMode.ShowHelp(writer);
            }
            BaseOptionsParser.ShowHelp(writer);
        }
Ejemplo n.º 2
0
        private bool HandleBaseOptions(BaseOptions baseOptions, TextWriter writer, ModeParser specifiedMode = null)
        {
            if (baseOptions.ShowHelp)
            {
                ShowHelp(writer, specifiedMode);
                return(true);
            }

            if (baseOptions.ShowVersion)
            {
                ShowVersion(writer);
                return(true);
            }
            return(false);
        }