Skip to content

Conversation

@ptrus
Copy link
Member

@ptrus ptrus commented Dec 23, 2025

Fixes: #4

Wanted to experiment with adding autocomplete a bit, feels quite nice.

Note: this is heavily AI-generated code.

How to test:

  # 1. Build the CLI
  go build -o oasis .

  # 2. Enable completions for current session (use your shell: bash, zsh, fish, or powershell)
  source <(./oasis completion zsh)

   # 3. Test
  ./oasis <TAB>
  ./oasis account transfer --network <TAB>
  ./oasis account transfer 100 <TAB>

Examples:

   # === BASIC COMMAND/SUBCOMMAND COMPLETION ===
  ./oasis <TAB>                              # lists: account, addressbook, contract, network, paratime, rofl, tx, wallet
  ./oasis account <TAB>                      # lists: allow, burn, delegate, deposit, show, transfer, undelegate, withdraw, entity...
  ./oasis network <TAB>                      # lists: add, governance, remove, set-chain-context, set-default, set-rpc, show, status...
  ./oasis network governance <TAB>           # lists: cast-vote, create, list, show

  # === FLAG COMPLETION (--flag) ===
  ./oasis account transfer --<TAB>           # lists all flags: --network, --paratime, --account, --offline, --gas-limit...
  ./oasis network show --<TAB>               # lists: --network, --height, --format...

  # === FLAG VALUE COMPLETION ===
  ./oasis account transfer --network <TAB>   # lists: mainnet, testnet
  ./oasis account transfer --paratime <TAB>  # lists paratimes for default network
  ./oasis account transfer --account <TAB>   # lists wallet names

  # === POSITIONAL ARGUMENT COMPLETION ===
  ./oasis wallet remove <TAB>                # wallet names only
  ./oasis wallet show <TAB>                  # wallet names only
  ./oasis addressbook remove <TAB>           # addressbook names only
  ./oasis account show <TAB>                 # wallet + addressbook names
  ./oasis account transfer 100 <TAB>         # wallet + addressbook names (at position 1)
  ./oasis network remove <TAB>               # network names

@netlify
Copy link

netlify bot commented Dec 23, 2025

Deploy Preview for oasisprotocol-cli canceled.

Name Link
🔨 Latest commit 1aabd9d
🔍 Latest deploy log https://app.netlify.com/projects/oasisprotocol-cli/deploys/694a6573be8ec40008ca18db

@ptrus ptrus force-pushed the ptrus/feature/cli-autocomplete branch from f78afe5 to 1aabd9d Compare December 23, 2025 09:48
@ptrus ptrus requested a review from matevz December 23, 2025 09:58
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.

CLI: add autocomplete for arguments

2 participants