/// <summary>
        /// Registers the template of the help option.
        /// </summary>
        /// <param name="template">Template that identifies invocation of the help option.</param>
        /// <param name="helpWriter">Help writer instance to use. If not specified, the default console
        /// writer is used.</param>
        /// <returns>Configuration.</returns>
        public ApplicationConfiguration <TOptions> HelpOption(string template, IHelpWriter?helpWriter = null)
        {
            HelpTemplate = Template.Parse(template);
            _helpWriter  = helpWriter;
            ParserConfig.AddTemplate(HelpTemplate);
            ParserConfig.AddParser(new HelpOptionParser <TOptions>(HelpTemplate));

            return(this);
        }
        /// <summary>
        /// Registers a command as an application sub-program.
        /// </summary>
        /// <param name="template">Template that identifies the command.</param>
        /// <param name="configureAction">Configuration action.</param>
        /// <typeparam name="TCommandOptions">Command options.</typeparam>
        /// <returns>Configuration.</returns>
        /// <exception cref="Exception">Invalid configuration.</exception>
        public ApplicationConfiguration <TOptions> Command <TCommandOptions>(string template,
                                                                             Action <CommandConfiguration <TCommandOptions> > configureAction)
            where TCommandOptions : class, TOptions
        {
            Check.NotNull(configureAction, nameof(configureAction));

            try
            {
                var commandTemplate = Template.ForCommand(template);
                var configuration   = new CommandConfiguration <TCommandOptions>(commandTemplate);
                configureAction(configuration);
                _subConfigurations.Add(configuration);
                ParserConfig.AddTemplate(commandTemplate);
                return(this);
            }
            catch (Exception ex)
            {
                throw ConfigurationExceptions.InvalidCommandConfiguration(template, ex);
            }
        }