alecthomas / kingpin

CONTRIBUTIONS ONLY: A Go (golang) command line and flag parser
MIT License
3.5k stars 273 forks source link

Actions should have a way to determine the what triggered them #294

Open pgier opened 5 years ago

pgier commented 5 years ago

AFAICT there is currently no way to determine which flag triggered an action from within the action function itself. This makes it difficult to re-use an action function between multiple flags. It would be nice if either the context contained the particular flag that called the action, or if there was a second parameter which contained this information.