Ejemplo n.º 1
0
        private static string CreateArg(CliArgAttribute arg, string argStyle, string valueStyle, string delimiterStyle, bool useOptionalDelimiters = true)
        {
            var name = arg.Names.First();

            if (!string.IsNullOrEmpty(arg.ValueName))
            {
                return(string.Format(
                           "{10}{6}{11}{0}{1}{2} {10}{8}{11}{3}{4}{5}{10}{9}{11}{10}{7}{11}",
                           argStyle,
                           name,
                           GetReset(argStyle),
                           valueStyle,
                           arg.ValueName,
                           GetReset(valueStyle),
                           arg.IsRequired || !useOptionalDelimiters ? "" : Cli.Escape(_optionalDelimterLeft),
                           arg.IsRequired || !useOptionalDelimiters ? "" : Cli.Escape(_optionalDelimterRight),
                           Cli.Escape(_valueDelimterLeft),
                           Cli.Escape(_valueDelimterRight),
                           delimiterStyle,
                           GetReset(delimiterStyle)));
            }
            else
            {
                return(string.Format(
                           "{5}{3}{6}{0}{1}{2}{5}{4}{6}",
                           argStyle,
                           name,
                           GetReset(argStyle),
                           arg.IsRequired || !useOptionalDelimiters ? "" : Cli.Escape(_optionalDelimterLeft),
                           arg.IsRequired || !useOptionalDelimiters ? "" : Cli.Escape(_optionalDelimterRight),
                           delimiterStyle,
                           GetReset(delimiterStyle)));
            }
        }
Ejemplo n.º 2
0
        private static string CreateArgDescription(
            CliArgAttribute arg,
            string argStyle,
            string valueStyle,
            string delimiterStyle)
        {
            var name = arg.Names.First();

            var argStr = CreateArg(
                arg, argStyle,
                valueStyle,
                delimiterStyle,
                useOptionalDelimiters: false);

            var requiredStr = arg.IsRequired ? " ~DarkYellow~(Required)~R~" : "";

            return(string.Format("~Cyan~{0}~R~{2}\r\n{1}\r\n", argStr, arg.Description, requiredStr));
        }