LinuxCommandLibrary

gcrane-completion

Generate shell completion script for gcrane

TLDR

Generate the autocompletion script for your shell

$ gcrane completion [shell_name]
copy

Disable completion descriptions
$ gcrane completion [shell_name] --no-descriptions
copy

Load completions in your current shell session (bash/zsh)
$ source <(gcrane completion bash/zsh)
copy

Load completions in your current shell session (fish)
$ gcrane completion fish | source
copy

Load completions for every new session (bash)
$ gcrane completion bash > /etc/bash_completion.d/gcrane
copy

Load completions for every new session (zsh)
$ gcrane completion zsh > "${fpath[1]}/_gcrane"
copy

Load completions for every new session (fish)
$ gcrane completion fish > ~/.config/fish/completions/gcrane.fish
copy

Display help
$ gcrane completion [shell_name] [[-h|--help]]
copy

SYNOPSIS

gcrane completion [bash|zsh|fish|powershell]

PARAMETERS

bash
    Generate bash completion script.

zsh
    Generate zsh completion script.

fish
    Generate fish completion script.

powershell
    Generate powershell completion script.

--help
    Show help for the completion command.

DESCRIPTION

This command provides shell completion support for the gcrane tool. Shell completion enables users to press the Tab key while typing a gcrane command in their shell to have the shell automatically complete the command, subcommand, option, or argument. This significantly improves command-line efficiency and reduces errors. The gcrane completion command generates the necessary shell scripts or configuration snippets to enable completion for various shells, including Bash, Zsh, Fish, and PowerShell.

The primary purpose is to enhance the user experience when working with gcrane in a terminal environment. By integrating seamless completion capabilities, gcrane aims to streamline workflows and lower the learning curve for new and existing users.

Users usually need to save the output of the completion command to a file and source this file in their shell configuration (e.g., .bashrc, .zshrc) or use a package manager that can automatically install completion scripts.

SHELL CONFIGURATION

After generating the completion script, you'll need to configure your shell to load it. For example, in Bash, you might add `source <(gcrane completion bash)` to your ~/.bashrc. For Zsh, you might add `source <(gcrane completion zsh)` to your ~/.zshrc.

SHELL RESTART

After setting up completion, you may need to restart your shell or source your shell configuration file for the changes to take effect.

SEE ALSO

bash(1), zsh(1), fish(1)

Copied to clipboard