Exemple #1
0
        internal CommandOption Configure(CommandLineApplication app, PropertyInfo prop)
        {
            var           optionType = GetOptionType(prop, app.ValueParsers);
            CommandOption option;

            if (Template != null)
            {
                option = new CommandOption(Template, optionType);
            }
            else
            {
                var longName = prop.Name.ToKebabCase();
                option = new CommandOption(optionType)
                {
                    LongName  = longName,
                    ShortName = longName.Substring(0, 1),
                    ValueName = prop.Name.ToConstantCase(),
                };
            }

            option.UnderlyingType = prop.PropertyType;

            Configure(option);

            option.Description ??= prop.Name;

            app.AddOption(option);
            return(option);
        }