Skip to content

Commit

Permalink
cmd/geas: improve error message when more than one arg given
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Sep 29, 2023
1 parent b7b7bc2 commit d61ac65
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/geas/geas.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ func main() {
)
flag.Parse()

if flag.NArg() != 1 {
var file string
switch flag.NArg() {
case 0:
exit(fmt.Errorf("need filename as argument"))
case 1:
file = flag.Arg(0)
default:
exit(fmt.Errorf("too many arguments"))
}
file := flag.Arg(0)

c := asm.NewCompiler(os.DirFS("."))
c.SetUsePush0(!*noPush0)
Expand Down

0 comments on commit d61ac65

Please sign in to comment.