Skip to content

feat: add shell completion generation #132

Closed

Description

@bwl21

Problem

ct has a growing command tree with nested commands and options, but currently offers no way to generate shell completion. Users must remember or repeatedly inspect commands such as ct report permissions --help.

Proposed CLI

Add a top-level command that writes a completion script to stdout:

ct completion zsh
ct completion bash
ct completion fish

Example installation for zsh:

mkdir -p ~/.zfunc
ct completion zsh > ~/.zfunc/_ct

The user's ~/.zshrc can then load it through fpath and compinit.

Requirements

  • Generate completion from the Commander command structure where practical, so commands and options do not drift from the actual CLI.
  • Complete top-level commands, nested subcommands, options, and enumerated option values.
  • Include current nested surfaces such as report permissions and its --by-subject, --by-object, and --by-both options.
  • Use filename/path completion for options that accept files or directories.
  • Work from both the npm installation and standalone binaries.
  • Document installation for zsh, bash, and fish.
  • Add tests that verify representative nested commands and options are present in each generated script.
  • Writing a completion script must not contact ChurchTools or require authentication.

Acceptance criteria

ct completion zsh  > /tmp/_ct
ct completion bash > /tmp/ct.bash
ct completion fish > /tmp/ct.fish

Each command exits successfully without credentials, emits a non-empty script, and the installed completion offers nested commands/options matching ct --help and the relevant subcommand help output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageUnsorted intake — decide in the weekly sweep

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions