Skip to content
Kelly Brazil edited this page Jun 15, 2022 · 4 revisions

Automatic shell completions for Bash and Zsh are available starting in jc v1.20.1.

If your system is already set up for Bash or Zsh completions, simply run the following commands to enable jc completions. See the Appendix below for initial completion setup for Bash and Zsh.

Bash

Linux

$ jc -B > /etc/bash_completion.d/jc

macOS

$ jc -B > /usr/local/etc/bash_completion.d/jc

Zsh

Linux and macOS

% jc -Z > "${fpath[1]}/_jc"

Appendix: Initial setup

If you don't already have completions set up for your system, see the following for installation and configuration.

Bash

Fedora/CentOS/Red Hat

Run the following, then restart your terminal.

# yum install bash-completion bash-completion-extras

Debian/Ubuntu

Run the following, then restart your terminal.

$ sudo apt update
$ sudo apt install bash-completion

macOS

Run the following two commands, then restart your terminal.

$ brew install bash-completion
$ echo "[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion" >> ~/.bash_profile

Zsh

macOS

Run the following commands, then restart your terminal.

% brew install zsh-completions
% echo "autoload -U compinit && compinit" >> ~/.zshrc

See the Brew formulae page for zsh-completions if you run into any issues.