コード例 #1
0
        private static string CreateMessage(ICommandLineOption option)
        {
            var hasShort = option.HasShortName;
            var hasLong  = option.HasLongName;
            var hasBoth  = hasShort && hasLong;

            var hasBothSeperator = hasBoth ? "|" : string.Empty;
            var shortName        = hasShort ? $"{option.ShortName}" : string.Empty;
            var longName         = hasLong ? $"{option.LongName}" : string.Empty;
            var optionString     = hasShort || hasLong ? string.Empty : option.ToString();

            return($"Required option '{shortName}{hasBothSeperator}{longName}{optionString}' not found!");
        }
コード例 #2
0
        private static string CreateMessage(ICommandLineOption option, ArgumentModel argModel)
        {
            bool hasShort = option.HasShortName;
            bool hasLong  = option.HasLongName;
            bool hasBoth  = hasShort && hasLong;

            string optionName = !hasShort && !hasLong?option.ToString() : string.Empty;

            string hasBothSeperator = hasBoth ? "|" : string.Empty;
            string shortName        = hasShort ? option.ShortName : string.Empty;
            string longName         = hasLong ? option.LongName : string.Empty;

            return($"Unable to parse option '{shortName}{hasBothSeperator}{longName}{optionName}' value '{string.Join(", ", argModel.Values)}' is invalid!");
        }