Esempio n. 1
0
        internal static CmdAllowedArg GetAllowedArgOrThrow(this IList <CmdAllowedArg> source, string name)
        {
            var cmdAllowedArg = source.SingleOrDefault(a => a.ShortName.ToString() == name || a.LongName == name);

            if (cmdAllowedArg == null)
            {
                ExceptionThrower.ArgNameNotAllowed(name);
            }

            return(cmdAllowedArg);
        }
Esempio n. 2
0
        public CmdArg Create(string name, string value = null)
        {
            var allowedArg = _cmdAllowedArgs.SingleOrDefault(a => a.ShortName.ToString() == name || a.LongName == name);

            if (allowedArg == null)
            {
                ExceptionThrower.ArgNameNotAllowed(name);
            }

            return(new CmdArg
            {
                ShortName = allowedArg.ShortName,
                Value = allowedArg.HasValue ? value : null,
                LongName = allowedArg.LongName,
                Description = allowedArg.Description
            });
        }