Skip to content

Conversation

@fnando
Copy link
Member

@fnando fnando commented Apr 25, 2025

What

Add support for subcommand plugins lookup. If you have a binary like stellar-contract-bindings-typescript, that means you can call it by using stellar contract bindings typescript.

$ which stellar-hello
/Users/fnando/Projects/stellar/stellar-cli/target/debug/stellar-hello

$ stellar hello
running `stellar hello` with args:

$ stellar hello 1
running `stellar hello` with args: 1

$ which stellar-contract-hello
/Users/fnando/Projects/stellar/stellar-cli/target/debug/stellar-contract-hello

$ stellar contract hello
running `stellar contract hello` with args:

$ stellar contract hello foo bar --nice 1
running `stellar contract hello` with args: foo bar --nice 1

$ stellar env
STELLAR_ACCOUNT=me      # use
STELLAR_NETWORK=testnet # use

Why

This allows publishers to extend the CLI by bringing their own subcommands.

Known limitations

For now, we had to remove command suggestion, but clap already does command suggestion.

$ stellar contrac
error: unrecognized subcommand 'contrac'

  tip: some similar subcommands exist: 'container', 'contract'

Usage: stellar [OPTIONS] <COMMAND>

For more information, try '--help'.

@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Apr 25, 2025
Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻 I also think it's fine to leave command suggestion off of plugins if it's too cumbersome / complex to add.

Are there any commands we should disallow adding plugins to?

@fnando
Copy link
Member Author

fnando commented Apr 25, 2025

Are there any commands we should disallow adding plugins to?

@leighmcculloch Good question… I don't think so, because we even want to allow things like adding additional signing mechanisms.

@fnando fnando enabled auto-merge (squash) April 25, 2025 02:05
@fnando fnando merged commit 56d19c5 into main Apr 25, 2025
34 checks passed
@fnando fnando deleted the plugin-subcommand branch April 25, 2025 02:09
@github-project-automation github-project-automation bot moved this from Backlog (Not Ready) to Done in DevX Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants