google / google/subcommands

Prefix matching for subcommands

Open
#25 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
795
Forks
51
PR merge metrics
No merged PRs in 30d

Description

I'd like to be able to invoke a subcommand using a unique prefix instead of having to type an exact match. E.g., if "foo" defines subcommands "dobaz", "doqux" and "dropit", then

```
"foo dob", "foo doba" -> "foo dobaz"
"foo doq", "foo doqu" -> "foo doqux"
"foo dr", "foo dro", ... -> "foo dropit"
"foo d", "foo do" -> error, ambiguous prefix
````

This is sufficiently different behavior from previously that it should probably be optional, but I'm not sure how best to fit it in.

I have an implementation I use in my own code that I can contribute.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.