Skip to content

Add concept of arguments #2

Description

@peterbourgon

Rarely do I want a simple <command> <opaque parameter string> structure. I'd like to register commands with some kind of argument spec, which could be validated and propagated to my handler function.

Concrete use case: register all of the following commands:

  • foo —plain command as it exists now; trailing arguments passed as opaque string to handler
  • bar <string> [string] —one string argument is required, everything after that is passed as an opaque string to my handler, which is (ideally) func doBar(string, string) but could be func doBar([]interface{}) or func doBar(interface{}...)
  • baz {alpha,beta,delta} <integer> [string]{alpha,beta,delta} being valid string tokens for that required argument (with tab-completion, natch), <integer> being a required argument that must successfully strconv.ParseInt, and [string] being an optional opaque string argument.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions