Skip to content

Commit 1b9749c

Browse files
author
Mike Morris
committed
Configure kingpin to stop thinking args for command belong to it
Fix the annoying behavior where flags passed as part of command were being sucked in by kingpin and throwing errors about undefined flags. That required users to explicitly put `--` between the profile and command. This fixes that behavior so kingpin only handles its own flags, and leaves flags for cmd alone, and passed thru
1 parent 9c98c55 commit 1b9749c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ func getAWSSession() *session.Session {
182182
}
183183

184184
func main() {
185+
// Tell kingpin to stop parsing flags once we start processing 'cmd', allows something like:
186+
// `aws-runas --verbose profile command -a --long_arg`
187+
// without needing an explicit `--` between 'profile' and 'cmd'
188+
kingpin.CommandLine.Interspersed(false)
185189
kingpin.Parse()
186190

187191
if *verbose {

0 commit comments

Comments
 (0)