protected override object OnExecute(CommandContext context)
        {
            if (context.Expression.Arguments.Length == 0)
            {
                throw new CommandException(Resources.ResourceUtility.GetString("Text.Command.MissingArguments"));
            }

            //从环境中查找秘密提供程序
            var secretProvider = SecretCommand.FindSecretProvider(context.CommandNode);

            if (secretProvider == null)
            {
                throw new CommandException("Missing required secret provider for the command.");
            }

            if (secretProvider.Verify(context.Expression.Options.GetValue <string>(KEY_NAME_OPTION), context.Expression.Arguments[0], out var extra))
            {
                if (extra != null && extra.Length > 0)
                {
                    context.Output.WriteLine(extra);
                }

                return(true);
            }

            return(false);
        }
        protected override object OnExecute(CommandContext context)
        {
            //从环境中查找秘密提供程序
            var secretProvider = SecretCommand.FindSecretProvider(context.CommandNode);

            if (secretProvider == null)
            {
                throw new CommandException("Missing required secret provider for the command.");
            }

            var name    = context.Expression.Options.GetValue <string>(KEY_NAME_OPTION);
            var pattern = context.Expression.Options.GetValue <string>(KEY_PATTERN_OPTION);

            switch (context.Expression.Arguments.Length)
            {
            case 0:
                return(secretProvider.Generate(name, pattern, null));

            case 1:
                return(secretProvider.Generate(name, pattern, context.Expression.Arguments[0]));
            }

            //定义返回验证码的数组
            var results = new string[context.Expression.Arguments.Length];

            for (int i = 0; i < context.Expression.Arguments.Length; i++)
            {
                results[i] = secretProvider.Generate(name, pattern, context.Expression.Arguments[i]);
            }

            return(results);
        }