protected override void OnExecute()
 {
     var info = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
     using (var writer = new CommandTextWriter(this.commandContext.Out))
     {
         if (this.IsQuiet == false)
         {
             writer.WriteLine(string.Join(" ", this.commandContext.Name, this.commandContext.Version).Trim());
             writer.WriteLine(info.LegalCopyright);
         }
         else
         {
             writer.WriteLine(this.commandContext.Version);
         }
     }
 }
        private void PrintUsage(CommandTextWriter writer, SwitchDescriptor[] switches)
        {
            var query = from item in switches
                        orderby item.Required descending
                        select this.GetString(item);

            var maxWidth = writer.Width - (writer.TabString.Length * writer.Indent);

            var line = this.Name;

            writer.WriteLine(Resources.Usage);
            writer.Indent++;

            foreach (var item in query)
            {
                if (line != string.Empty)
                    line += " ";

                if (line.Length + item.Length >= maxWidth)
                {
                    writer.WriteLine(line);
                    line = string.Empty.PadLeft(this.Name.Length + 1);
                }
                line += item;
            }
            writer.WriteLine(line);

            writer.Indent--;
            writer.WriteLine();
        }
        private void PrintList(CommandTextWriter writer)
        {
            this.commandContext.Parsers[this].PrintUsage();

            writer.WriteLine(Resources.AvaliableCommands);
            writer.Indent++;
            foreach (var item in this.commandContext.Commands)
            {
                if (this.commandContext.IsCommandVisible(item) == false)
                    continue;
                var summary = CommandDescriptor.GetUsageDescriptionProvider(item.GetType()).GetSummary(item);

                writer.WriteLine(item.Name);
                writer.Indent++;
                writer.WriteMultiline(summary);
                writer.Indent--;
            }
            writer.Indent--;
        }
        private void PrintSummary(CommandTextWriter writer, SwitchDescriptor[] switches)
        {
            if (this.Summary == string.Empty)
                return;

            writer.WriteLine(Resources.Summary);
            writer.Indent++;
            writer.WriteLine(this.Summary);
            writer.Indent--;
            writer.WriteLine();
        }
        private void PrintRequirements(CommandTextWriter writer, SwitchDescriptor[] switches)
        {
            var items = switches.Where(i => i.Required == true).ToArray();
            if (items.Any() == false)
                return;

            writer.WriteLine(Resources.Requirements);
            writer.Indent++;
            foreach (var item in items)
            {
                this.PrintRequirement(writer, item);
            }
            writer.Indent--;
            writer.WriteLine();
        }
 private void PrintRequirement(CommandTextWriter writer, SwitchDescriptor descriptor)
 {
     writer.WriteLine(descriptor.Name);
     if (descriptor.Description != string.Empty)
     {
         writer.Indent++;
         writer.WriteMultiline(descriptor.Description);
         writer.Indent--;
     }
     writer.WriteLine();
 }
        private void PrintOption(CommandTextWriter writer, SwitchDescriptor descriptor)
        {
            if (descriptor.ShortNamePattern != string.Empty)
                writer.WriteLine(descriptor.ShortNamePattern);
            if (descriptor.NamePattern != string.Empty)
                writer.WriteLine(descriptor.NamePattern);

            writer.Indent++;
            writer.WriteMultiline(descriptor.Description);
            writer.Indent--;
            writer.WriteLine();
        }
        private void PrintDescription(CommandTextWriter writer, SwitchDescriptor[] switches)
        {
            if (this.Description == string.Empty)
                return;

            writer.WriteLine(Resources.Description);
            writer.Indent++;
            writer.WriteMultiline(this.Description);
            writer.Indent--;
            writer.WriteLine();
        }