<commit_before>using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DocoptNet;
using Microsoft.AppHub.Common;

namespace Microsoft.AppHub.Cli.Commands
{
    public class HelpCommandDescription: ICommandDescription
    {
        public const string HelpCommandName = "help";

        public string Name
        {
            get { return HelpCommandName; }
        }

        public string Summary
        {
            get { return "Prints help for a command"; }
        }

        public string Syntax
        {
            get 
            {
                return $@"Command '{this.Name}': {this.Summary}.
                
Usage: 
  {ProgramUtilities.CurrentExecutableName} [{this.Name}]
  {ProgramUtilities.CurrentExecutableName} {this.Name} <command>
";
            }
        }

        public ICommand CreateCommand(IDictionary<string, ValueObject> options, IServiceProvider serviceProvider)
        {
            var commandName = options["<command>"];
            var commandsRegistry = (CommandsRegistry)serviceProvider.GetService(typeof(CommandsRegistry));
            
            if (commandName?.IsNullOrEmpty ?? true)
            {
                return new ListCommandsCommand(commandsRegistry);
            }
            else
            {
                return new PrintCommandSyntaxCommand(commandsRegistry, commandName.ToString());
            }
        }
    }

    public class ListCommandsCommand: ICommand
    {
        private readonly CommandsRegistry _commandsRegistry;

        public ListCommandsCommand(CommandsRegistry commandsRegistry)
        {
            if (commandsRegistry == null)
                throw new ArgumentNullException(nameof(commandsRegistry));

            _commandsRegistry = commandsRegistry;
        }

        public Task ExecuteAsync()
        {
            var allCommandDescriptions = _commandsRegistry.CommandDescriptions.Values.OrderBy(d => d.Name);

            Console.WriteLine($@"Usage: {ProgramUtilities.CurrentExecutableName} <command> [options])");
            Console.WriteLine("Available commands:");
<commit_msg>Fixing usage string printed by ListCommandsCommand<commit_after>using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DocoptNet;
using Microsoft.AppHub.Common;

namespace Microsoft.AppHub.Cli.Commands
{
    public class HelpCommandDescription: ICommandDescription
    {
        public const string HelpCommandName = "help";

        public string Name
        {
            get { return HelpCommandName; }
        }

        public string Summary
        {
            get { return "Prints help for a command"; }
        }

        public string Syntax
        {
            get 
            {
                return $@"Command '{this.Name}': {this.Summary}.
                
Usage: 
  {ProgramUtilities.CurrentExecutableName} [{this.Name}]
  {ProgramUtilities.CurrentExecutableName} {this.Name} <command>
";
            }
        }

        public ICommand CreateCommand(IDictionary<string, ValueObject> options, IServiceProvider serviceProvider)
        {
            var commandName = options["<command>"];
            var commandsRegistry = (CommandsRegistry)serviceProvider.GetService(typeof(CommandsRegistry));
            
            if (commandName?.IsNullOrEmpty ?? true)
            {
                return new ListCommandsCommand(commandsRegistry);
            }
            else
            {
                return new PrintCommandSyntaxCommand(commandsRegistry, commandName.ToString());
            }
        }
    }

    public class ListCommandsCommand: ICommand
    {
        private readonly CommandsRegistry _commandsRegistry;

        public ListCommandsCommand(CommandsRegistry commandsRegistry)
        {
            if (commandsRegistry == null)
                throw new ArgumentNullException(nameof(commandsRegistry));

            _commandsRegistry = commandsRegistry;
        }

        public Task ExecuteAsync()
        {
            var allCommandDescriptions = _commandsRegistry.CommandDescriptions.Values.OrderBy(d => d.Name);

            Console.WriteLine($@"Usage: {ProgramUtilities.CurrentExecutableName} <command> [options]");
            Console.WriteLine("Available commands:");

{'fraction_non_alphanumeric': 0.08112505811250581, 'fraction_numerical': 0.0, 'mean_word_length': 2.206408345752608, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6950929', 'n_tokens_mistral': 1015, 'n_tokens_neox': 1005, 'n_words': 223}