Beispiel #1
0
        private static string GetOptionDescription(OptionRule opt)
        {
            var sb = new StringBuilder(opt.Description);

            if (opt.Required)
            {
                sb.Append(" Required.");
            }
            if (opt.DependOnCommands.Length > 0)
            {
                sb.Append($" Valid with commands: {opt.DependOnCommands.Join(", ")}.");
            }
            return(sb.ToString());
        }
Beispiel #2
0
        private static string GetOptionString(OptionRule opt, bool full, string optPrefix)
        {
            switch (opt.Type)
            {
            case OptionType.Valueless:
                return(optPrefix + opt.Name);

            case OptionType.Bool:
                return(optPrefix + opt.Name + (full ? "[+|-]" : "+"));

            case OptionType.Value:
                return(optPrefix + opt.Name + (full ? "=<value>" : "="));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }