make "help" refuse arguments for now

Since they are otherwise silently ignored.
pull/294/head
Daniel Martí 3 years ago committed by lu4p
parent 664f834906
commit e94b8e3750

@ -237,6 +237,9 @@ func mainErr(args []string) error {
// If we recognize an argument, we're not running within -toolexec.
switch command, args := args[0], args[1:]; command {
case "help":
if len(args) > 0 {
return fmt.Errorf("the help command does not take arguments")
}
return flag.ErrHelp
case "version":
if len(args) > 0 {

@ -1,25 +1,29 @@
! garble
stderr -count=1 'Usage'
stderr 'garble \[flags\] build'
stderr 'garble \[garble flags\] command'
! stderr 'usage: go build'
! stdout .
! garble -h
stderr 'garble \[flags\] build'
stderr 'garble \[garble flags\] command'
! stdout .
! garble help
stderr 'garble \[flags\] build'
stderr 'garble \[garble flags\] command'
! stdout .
! garble help foo bar
stderr 'does not take arguments'
! stdout .
! garble build -h
stderr 'garble \[flags\] build'
stderr 'garble \[garble flags\] command'
! stderr 'usage: go build'
! stdout .
! garble -badflag
stderr 'flag provided but not defined'
stderr 'garble \[flags\] build'
stderr 'garble \[garble flags\] command'
! stdout .
! garble badcmd

Loading…
Cancel
Save