Package: org.apache.groovy.groovysh.jline

## [Groovy] Class GroovyCommands

- org.apache.groovy.groovysh.jline.GroovyCommands

- All Implemented Interfaces and Traits:
    CommandRegistry

      class GroovyCommands
      extends JlineCommandRegistry
      implements CommandRegistry

  Registers the Groovy-specific commands exposed by the groovysh JLine console.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `GroovyCommands(GroovyEngine engine, Supplier<Path> workDir, Printer printer, SyntaxHighlighter highlighter)` Creates the Groovy-specific command registry for groovysh.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `CmdDesc` | `commandDescription(List<String> args)` Builds the detailed description for the selected command.
    `` | `List<String>` | `commandInfo(String command)` Returns the short help text registered for the named command.
    `` | `void` | `console(CommandInput input)` Launches the Swing Groovy console seeded with the current shell state.
    `` | `Object` | `doc(CommandInput input)` Opens configured documentation for the supplied object or type.
    `` | `Object` | `getParser(String format, String parserName)` Creates the parser implementation backing a named slurper format.
    `` | `Object` | `grab(CommandInput input)` Lists cached grapes or grabs the supplied dependency coordinates.
    `` | `Object` | `img(CommandInput input)` Displays an image inline using JLine's terminal-graphics support (Sixel, Kitty, iTerm2).
    `` | `void` | `importsCommand(CommandInput input)` Lists or removes import statements tracked by the shell.
    `` | `Object` | `inspect(CommandInput input)` Displays object details in the terminal or object browser.
    `` | `void` | `load(CommandInput input)` Restores saved state or loads a file into the current buffer.
    `` | `static void` | `loadFile(GroovyEngine engine, File file, boolean merge)` Replays file contents through the engine, optionally merging with existing state.
    `` | `void` | `methodsCommand(CommandInput input)` Lists or removes tracked method definitions.
    `` | `String` | `name()` Returns the display name for this command registry.
    `` | `void` | `reset(CommandInput input)` Clears the current buffer.
    `` | `void` | `save(CommandInput input)` Saves shared state or the current buffer to disk.
    `` | `static void` | `saveFile(GroovyEngine engine, File file, boolean overwrite)` Writes the current buffer to the target file.
    `` | `Object` | `slurpcmd(CommandInput input)` Reads content into `_` from a file, URL, or literal value.
    `` | `void` | `typesCommand(CommandInput input)` Lists or removes tracked type declarations.
    `` | `void` | `varsCommand(CommandInput input)` Lists or removes tracked variable declarations.

- - ### Constructor Detail

    - #### GroovyCommands(GroovyEngine engine, Supplier<Path> workDir, Printer printer, SyntaxHighlighter highlighter)

      Creates the Groovy-specific command registry for groovysh.

      Parameters:
        `engine` - shell execution engine
        `workDir` - supplier for the current working directory
        `printer` - terminal printer
        `highlighter` - syntax highlighter used for previews

  - ### Method Detail

    - #### @Override
      CmdDesc commandDescription(List<String> args)

      Builds the detailed description for the selected command.

      Parameters:
        `args` - command arguments whose first element identifies the command
      Returns:
        command description metadata

    - #### @Override
      List<String> commandInfo(String command)

      Returns the short help text registered for the named command.

      Parameters:
        `command` - command name
      Returns:
        command summary lines

    - #### void console(CommandInput input)

      Launches the Swing Groovy console seeded with the current shell state.

      Parameters:
        `input` - parsed command input

    - #### Object doc(CommandInput input)

      Opens configured documentation for the supplied object or type.

      Parameters:
        `input` - parsed command input
      Returns:
        always `null`

    - #### Object getParser(String format, String parserName)

      Creates the parser implementation backing a named slurper format.

      Parameters:
        `format` - user-facing format name
        `parserName` - parser class name
      Returns:
        parser instance

    - #### Object grab(CommandInput input)

      Lists cached grapes or grabs the supplied dependency coordinates.

      Parameters:
        `input` - parsed command input
      Returns:
        always `null`

    - #### Object img(CommandInput input)

      Displays an image inline using JLine's terminal-graphics support (Sixel, Kitty, iTerm2). Falls back to a summary line when the terminal doesn't speak any supported protocol; the `--gui` flag opens a Swing window instead.

      Parameters:
        `input` - parsed command input
      Returns:
        always `null`

    - #### void importsCommand(CommandInput input)

      Lists or removes import statements tracked by the shell.

      Parameters:
        `input` - parsed command input

    - #### Object inspect(CommandInput input)

      Displays object details in the terminal or object browser.

      Parameters:
        `input` - parsed command input
      Returns:
        always `null`

    - #### void load(CommandInput input)

      Restores saved state or loads a file into the current buffer.

      Parameters:
        `input` - parsed command input

    - #### static void loadFile(GroovyEngine engine, File file, boolean merge)

      Replays file contents through the engine, optionally merging with existing state.

      Parameters:
        `engine` - shell execution engine
        `file` - source file to load
        `merge` - whether existing state should be preserved

    - #### void methodsCommand(CommandInput input)

      Lists or removes tracked method definitions.

      Parameters:
        `input` - parsed command input

    - #### String name()

      Returns the display name for this command registry.

      Returns:
        registry name

    - #### void reset(CommandInput input)

      Clears the current buffer.

      Parameters:
        `input` - parsed command input

    - #### void save(CommandInput input)

      Saves shared state or the current buffer to disk.

      Parameters:
        `input` - parsed command input

    - #### static void saveFile(GroovyEngine engine, File file, boolean overwrite)

      Writes the current buffer to the target file.

      Parameters:
        `engine` - shell execution engine
        `file` - target file
        `overwrite` - whether existing files may be replaced

    - #### Object slurpcmd(CommandInput input)

      Reads content into `_` from a file, URL, or literal value.

      Parameters:
        `input` - parsed command input
      Returns:
        the parsed value

    - #### void typesCommand(CommandInput input)

      Lists or removes tracked type declarations.

      Parameters:
        `input` - parsed command input

    - #### void varsCommand(CommandInput input)

      Lists or removes tracked variable declarations.

      Parameters:
        `input` - parsed command input