Skip to content

Support alias "ranges" for commands #575

Description

@jedevc

Wanting to gauge whether this would be an accepted feature! See #66 (comment), where I saw this mentioned before. I want to implement something like the ip address command, which can be called using ip address, ip addr, ip a, etc - all prefixes of address are allowed. Manually specifying all allowed values in kong is currently very verbose, and clutters up the help.

Here's a potential proposal to allow something like this - added as an extension to aliases so that each command would need to opt into this.

Essentially, something like:

type Cmd struct {
	// aliases is extended to allow a range of valid aliases
	// the <cert> portion indicates the minimum allowed value
	// the <ificates> portion indicates optional characters
	Certificates `cmd:"" aliases:"cert|ificates"`
}

Would allow all of:

$ cmd certificates
$ cmd certificate
$ cmd cert
$ cmd certif # weird but allowed

For showing aliases in the help, we can abbreviate this to cert[ificates].

Very very happy to submit a patch for this, but wanted to see if it's a good idea first.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions