Khalid / Docs

The khalid command

Everything Khalid does starts from one command, khalid, followed by what you want it to do, such as khalid build. This page shows how to see every command, how to make your shell finish the commands for you, and where the manual pages are. A test runs each example that starts with $ against the real binary (crates/khalid/tests/doc_examples.rs), so the output shown is what you get; ... stands for the lines left out.

See every command

khalid --help lists every command with one line on what it does. khalid <command> --help explains one command and each of its options, such as khalid lint --help.

$ khalid --help
An open-source blog engine with SEO defaults built in, by SerpDad.

Usage: khalid [OPTIONS] [COMMAND]
...

Every command also takes --json, which prints the result as JSON for scripts and AI agents instead of sentences.

Finish commands with Tab

Shell completion means your shell finishes a command or an option when you press Tab, and lists the choices when there are several. Type khalid li, press Tab, and the shell writes khalid lint.

khalid completions <shell> prints the script that teaches your shell Khalid's commands. It works for bash, zsh, fish, PowerShell and elvish. The script comes from the binary you run, so after an update, run the line for your shell again to pick up new commands.

$ khalid completions zsh
#compdef khalid
...

The one-line install in docs/deploy.md does this for you on bash, zsh and fish. Otherwise, run the line for your shell once, then open a new terminal.

bash, on Linux, or on a Mac with the bash-completion package:

mkdir -p ~/.local/share/bash-completion/completions
khalid completions bash > ~/.local/share/bash-completion/completions/khalid

zsh, the shell on a Mac. The first line writes the script; the second tells zsh where to find it, and goes in ~/.zshrc before any line that runs compinit:

mkdir -p ~/.zfunc && khalid completions zsh > ~/.zfunc/_khalid
echo 'fpath=(~/.zfunc $fpath); autoload -Uz compinit && compinit' >> ~/.zshrc

fish:

khalid completions fish > ~/.config/fish/completions/khalid.fish

PowerShell, on Windows. This adds one line to your PowerShell profile, the script PowerShell runs each time it starts:

Add-Content $PROFILE 'khalid completions powershell | Out-String | Invoke-Expression'

elvish. This adds one line to ~/.config/elvish/rc.elv:

echo 'eval (khalid completions elvish | slurp)' >> ~/.config/elvish/rc.elv

Read the manual pages

A manual page is the help for one command in the form the man command shows, on Linux and on a Mac. Khalid has one for itself and one for each command, such as khalid-init.1 for khalid init.

The one-line install in docs/deploy.md puts them where man finds them. Each release also has them in khalid-<version>-man.tar.gz, beside the binaries. To install them by hand, unpack it into a folder man reads, then open a page:

mkdir -p ~/.local/share/man/man1
tar -xzf khalid-<version>-man.tar.gz -C ~/.local/share/man/man1
man khalid-init

The Docker image holds them in /usr/share/man/man1. To make them from the source code, run just man, which writes them to target/man.

Written in the Khalid repository. Edit this page on GitHub.