completions: offer --help and --version in zsh and short flags in bash, and test them

Open
#105 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
71/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, fish, python, zsh
Domain
cli, testing, tooling

Research direction

Read completions/btc-toolkit.zsh, the bash and fish completion files, tests/test_completions.py, and btc_toolkit/api.py for SUPPORTED_NETWORKS; inspect the parser through cli.build_parser() as the issue describes. Update the zsh and bash completions, then extend the tests to compare flags, network choices, and value-taking options across all three files. Done when the stated acceptance cases work and the tests detect each listed omission.

Written by the indexing model from the issue text.

Description

enhancement help wanted

What

  • zsh does not complete --help or --version at the top level (btc-toolkit --ver<Tab>); bash and fish do. See the CURRENT == 2 branch in completions/btc-toolkit.zsh.
  • bash offers no short flags (-n, -h in a subcommand; -h, -v at the top level); fish does.
  • tests/test_completions.py compares the completions with the commands and long flags only, and the real-shell tests try five fixed inputs, of which only block 0 -n s → signet touches a short flag or a network value. Nothing checks the top-level options, the other short options, the full list of -n values (they should match SUPPORTED_NETWORKS in btc_toolkit/api.py) or which flags take a value: today a completion file can drop testnet, or fish can drop --version, and the suite still passes.

What to do

  1. Fix the zsh and bash completions.
  2. Extend tests/test_completions.py so it reads the real parser (cli.build_parser() and its subparsers: each action's option_strings, choices and nargs; nargs is 0 for a flag and None for an option that takes one value) and checks the three files against it, including the top-level options and the -n values.

Acceptance

  • btc-toolkit --ver<Tab> completes in zsh; btc-toolkit tx -<Tab> offers -n in bash.
  • The extended tests fail if a completion file drops a flag, a short flag or a network value.
  • They also fail if a file stops treating an option that takes a value (nargs is None) as one: in bash it must be in a case branch that completes nothing or the value, in fish it needs -x or -r, in zsh a :message: after its description.

See CONTRIBUTING.md for the test, lint and type-check commands. Comment below before starting, so two people don't take the same issue.

Dominant language
Python
Stars
2
Forks
1
Avg merge
1h 45m
Merged PRs (30d)
23

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from devdavidejesus/btc-toolkit

All issues in devdavidejesus/btc-toolkit

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.