Skip to content

Add shell completion kind values and man page generation#878

Open
lamchau wants to merge 2 commits intodalance:masterfrom
lamchau:master
Open

Add shell completion kind values and man page generation#878
lamchau wants to merge 2 commits intodalance:masterfrom
lamchau:master

Conversation

@lamchau
Copy link

@lamchau lamchau commented Mar 1, 2026

Summary

  • Shell completions for --sorta, --sortd, --insert, and --only now include all valid column kind names with descriptions, enabling tab-completion in fish, bash, and zsh
  • Add --gen-man-page flag and build-time man page generation via clap_mangen (controlled by MAN_PATH env var)

Shell completion output

Kind values are injected only into the completion generator, preserving existing partial/substring matching at runtime (e.g. --sorta cpu still works).

fish (with descriptions):

$ procs --sorta <TAB>
command    (Command with all arguments)  nice                         (Nice value)
contextsw        (Context switch count)  pgid                   (Process group ID)
cputime           (Cumulative CPU time)  pid                          (Process ID)
docker          (Docker container name)  policy                (Scheduling policy)
elapsedtime              (Elapsed time)  ppid                  (Parent process ID)
empty                           (Empty)  priority                       (Priority)
gid                          (Group ID)  readbytes       (Read bytes from storage)
gidreal                 (Real group ID)  separator  (Show | for column separation)
gidsaved               (Saved group ID)  session              (Process Session ID)
group                      (Group name)  slot         (Slot for `--insert` option)
groupreal             (Real group name)  starttime                 (Starting time)
groupsaved           (Saved group name)  state                     (Process state)
majflt         (Major page fault count)  tcpport                 (Bound TCP ports)
minflt         (Minor page fault count)  threads                    (Thread count)
multislot  (Slot for `--insert` option)  treeslot           (Slot for tree column)
image

bash:

$ procs --sorta <TAB>
command      elapsedtime  gidsaved     minflt    pgid      readbytes  slot       tcpport   tty       uidreal   usagemem   vmrss      writebytes
contextsw    empty        group        multislot nice      ppid       separator  session   starttime threads   udpport    usagecpu   usersaved
cputime      gid          groupreal    majflt    pid       policy     priority   session   state     treeslot  uid        uidsaved   userreal   vmsize
docker       gidreal      groupsaved   minflt    pgid      readbytes  separator  slot      starttime tty       uidreal    usagecpu   user       vmtotal

zsh (with descriptions):

$ procs --sorta <TAB>
command      -- Command with all arguments
contextsw    -- Context switch count
cputime      -- Cumulative CPU time
...

Man page

$ procs --gen-man-page | man -l -

Build-time generation:

$ MAN_PATH=./man cargo build

Test plan (macOS/Ubuntu)

  • cargo build succeeds
  • cargo test — 9/9 pass
  • procs --sorta cpu — partial matching still works
  • fish/bash/zsh completions include kind values
  • procs --gen-man-page outputs valid roff (man markup)

Inject KIND_LIST entries as possible values into the clap Command used
for completion generation, so --sorta, --sortd, --insert, and --only
now offer tab-completable kind names with descriptions.
Add --gen-man-page flag that renders a man page to stdout. Build-time
generation is also supported via the MAN_PATH env var, mirroring the
existing COMPLETION_PATH pattern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant