public static IServiceCollection AddCoconaShellCompletion(this IServiceCollection services)
        {
            services.AddSingleton <ICoconaShellCompletionCodeGenerator, BashCoconaShellCompletionCodeGenerator>();
            services.AddSingleton <ICoconaShellCompletionCodeGenerator, ZshCoconaShellCompletionCodeGenerator>();
            services.TryAddSingleton <ICoconaShellCompletionCodeProvider, CoconaShellCompletionCodeProvider>();
            services.TryAddSingleton <ICoconaCompletionCandidatesMetadataFactory, CoconaCompletionCandidatesMetadataFactory>();
            services.TryAddSingleton <ICoconaCompletionCandidatesProviderFactory, CoconaCompletionCandidatesProviderFactory>();
            services.TryAddSingleton <ICoconaCompletionCandidates, CoconaCompletionCandidates>();

            return(services);
        }
        public static IServiceCollection AddCoconaCore(this IServiceCollection services, string[] args)
        {
#if COCONA_LITE
            services.AddSingleton <ICoconaInstanceActivator>(_ => new CoconaLiteInstanceActivator());
#else
            services.AddSingleton <ICoconaInstanceActivator>(_ => new CoconaInstanceActivator());
#endif

            services.AddSingleton <ICoconaCommandProvider>(sp =>
            {
#if COCONA_LITE
                var options = (CoconaLiteAppOptions)sp.GetService(typeof(CoconaLiteAppOptions));
#else
                var options = sp.GetService <IOptions <CoconaAppOptions> >().Value;
#endif

                return(new CoconaBuiltInCommandProvider(
                           new CoconaCommandProvider(
                               options.CommandTypes.ToArray(),
                               options.TreatPublicMethodsAsCommands,
                               options.EnableConvertOptionNameToLowerCase,
                               options.EnableConvertCommandNameToLowerCase
                               ),
                           options.EnableShellCompletionSupport
                           ));
            });
            services.TryAddSingleton <ICoconaCommandLineArgumentProvider>(serviceProvider =>
                                                                          new CoconaCommandLineArgumentProvider(args));
            services.TryAddSingleton <ICoconaCommandDispatcherPipelineBuilder, CoconaCommandDispatcherPipelineBuilder>();
            services.TryAddSingleton <ICoconaAppContextAccessor, CoconaAppContextAccessor>();
            services.TryAddSingleton <ICoconaApplicationMetadataProvider, CoconaApplicationMetadataProvider>();
            services.TryAddSingleton <ICoconaConsoleProvider, CoconaConsoleProvider>();
            services.TryAddSingleton <ICoconaParameterValidatorProvider, DataAnnotationsParameterValidatorProvider>();

            services.TryAddTransient <ICoconaParameterBinder, CoconaParameterBinder>();
            services.TryAddTransient <ICoconaValueConverter, CoconaValueConverter>();
            services.TryAddTransient <ICoconaCommandLineParser, CoconaCommandLineParser>();
            services.TryAddTransient <ICoconaCommandDispatcher, CoconaCommandDispatcher>();
            services.TryAddTransient <ICoconaCommandMatcher, CoconaCommandMatcher>();
            services.TryAddTransient <ICoconaCommandResolver, CoconaCommandResolver>();
            services.TryAddTransient <ICoconaHelpRenderer, CoconaHelpRenderer>();
            services.TryAddTransient <ICoconaCommandHelpProvider, CoconaCommandHelpProvider>();
            services.TryAddTransient <ICoconaHelpMessageBuilder, CoconaHelpMessageBuilder>();

            return(services);
        }