Class CompletionScriptGenerator

java.lang.Object
dev.metaschema.cli.processor.completion.CompletionScriptGenerator

public class CompletionScriptGenerator extends Object
Generates shell completion scripts for Bash and Zsh.

This generator introspects registered commands and their options to produce completion scripts that provide intelligent tab-completion for command-line tools built on the cli-processor framework.

  • Constructor Details

    • CompletionScriptGenerator

      public CompletionScriptGenerator(@NonNull String programName, @NonNull List<ICommand> commands)
      Construct a new generator.
      Parameters:
      programName - the name of the CLI program
      commands - the top-level commands to include in completion
  • Method Details

    • getProgramName

      @NonNull public String getProgramName()
      Get the program name.
      Returns:
      the program name
    • getCommands

      @NonNull public List<ICommand> getCommands()
      Get the commands.
      Returns:
      the commands
    • generateBashCompletion

      @NonNull public String generateBashCompletion()
      Generate a Bash completion script.
      Returns:
      the bash completion script
    • generateZshCompletion

      @NonNull public String generateZshCompletion()
      Generate a Zsh completion script.
      Returns:
      the zsh completion script