public ValueTask <int> GenerateCompletionSource(
            [FromService] ICoconaConsoleProvider console,
            [FromService] ICoconaCommandProvider commandProvider,
            [FromService] ICoconaShellCompletionCodeProvider shellCompletionCodeProvider,
            [Argument] string shellName
            )
        {
            if (!shellCompletionCodeProvider.CanHandle(shellName))
            {
                console.Error.Write($"Error: Shell completion for '{shellName}' is not supported. (Supported shells: {string.Join(", ", shellCompletionCodeProvider.SupportedTargets)})");
                return(new ValueTask <int>(1));
            }

            shellCompletionCodeProvider.Generate(shellName, console.Output, commandProvider.GetCommandCollection());
            return(new ValueTask <int>(0));
        }
        // --completion-candidates <shell>:<paramName> -- <incompleted command line...>
        // WARN: The option must be processed before '--help' or '--version' options.
        //       If '--completion-candidates' option is provided, '--help' and '--version' options are also always provided.
        //       And these options prevent to perform unintended **destructive** action if the command doesn't support on-the-fly candidates feature.
        //       Fortunately, Cocona rejects unknown options by default. This options guard is fail-safe.
        public ValueTask <int> GetCompletionCandidates(
            [FromService] ICoconaConsoleProvider console,
            [FromService] ICoconaShellCompletionCodeProvider shellCompletionCodeGenerator,
            [FromService] ICoconaCompletionCandidates completionCandidates,
            [Argument] string target,
            [Argument] string[] arguments
            )
        {
            var parts = target.Split(new[] { ':' }, 2);

            var(shellTarget, paramName) = (parts[0], parts[1]);

            var candidates = completionCandidates.GetOnTheFlyCandidates(paramName, arguments, 0, null);

            shellCompletionCodeGenerator.GenerateOnTheFlyCandidates(shellTarget, console.Output, candidates);
            return(new ValueTask <int>(0));
        }