Skip to content

feat: add shell completions and help commands#59

Merged
alvinreal merged 1 commit intomainfrom
fix/issue-30
Feb 22, 2026
Merged

feat: add shell completions and help commands#59
alvinreal merged 1 commit intomainfrom
fix/issue-30

Conversation

@alvinreal
Copy link
Owner

Adds shell completion generation and enhanced help commands for discoverability.

New CLI Options

Flag Description
--completions <shell> Generate shell completions (bash, zsh, fish, powershell, elvish)
--formats Enhanced format listing with tabular layout
--functions List all built-in mapping functions with signatures

Shell Completions

Uses clap_complete to generate completions for all major shells:

# Install bash completions
morph --completions bash > ~/.local/share/bash-completion/completions/morph

# Install zsh completions
morph --completions zsh > ~/.zsh/completions/_morph

# Install fish completions
morph --completions fish > ~/.config/fish/completions/morph.fish

Enhanced --formats Output

Now shows a formatted table:

Supported formats:

  FORMAT          EXTENSIONS   CAPABILITIES
  ──────          ──────────   ────────────
  JSON            json         read, write
  JSONL           jsonl, ndjson read, write
  ...

--functions Output

Lists all 30+ built-in functions organized by category:

  • String: lower, upper, trim, replace, contains, split, join, etc.
  • Type conversion: to_int, to_float, to_string, to_bool, type_of
  • Math: abs, min, max, floor, ceil, round
  • Null/existence: is_null, is_array, coalesce, default
  • Collection: keys, values, unique, first, last, sum, group_by
  • Conditional: if

Tests

6 integration tests:

  • Bash/Zsh/Fish completion generation
  • Unknown shell error handling
  • --formats table output with all formats
  • --functions output with categories and signatures

Fixes #30

Adds shell completion generation and improved help commands:

- --completions <shell>: generates shell completions for bash, zsh,
  fish, powershell, and elvish via clap_complete
- --formats: enhanced format listing with tabular layout showing
  format name, file extensions, and read/write capabilities
- --functions: comprehensive listing of all 30+ built-in mapping
  functions organized by category (String, Type conversion, Math,
  Null/existence, Collection, Conditional) with signatures, type
  info, and descriptions

Includes 6 integration tests covering all three commands and
error handling for unknown shells.

Fixes #30
@alvinreal alvinreal merged commit 60577e6 into main Feb 22, 2026
6 checks passed
@alvinreal alvinreal deleted the fix/issue-30 branch February 22, 2026 14:39
@github-actions github-actions bot mentioned this pull request Mar 20, 2026
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.

Shell completions and help commands

1 participant