Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Nov 21, 2023
1 parent 2f5dd8a commit c4bd0b1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import (
)

type CLIOptions struct {
Syscall string
Arch string
ListQueryMatches bool
ListArchQueries bool
PrettyPrint bool
Syscall string
Arch string
ListArchQueries bool
PrettyPrint bool
}

func parseArgs() *CLIOptions {
Expand All @@ -25,18 +24,16 @@ func parseArgs() *CLIOptions {
arch := parser.String("a", "architecture", &argparse.Options{Help: "Architecture for queries"})

listArch := parser.Flag("r", "list-arch", &argparse.Options{Help: "Get all supported architechture convensions"})
listQuery := parser.Flag("n", "list-name", &argparse.Options{Help: "Get all syscalls with given name"})

prettyPrint := parser.Flag("p", "pretty-print", &argparse.Options{Help: "Pretty print JSON result"})

err := parser.Parse(os.Args)
if err != nil || (*query == "" && *arch == "") && (!*listArch && !*listQuery) {
if err != nil || (*query == "" && *arch == "") && !*listArch {
fmt.Print(parser.Usage(err))
os.Exit(1)
}
opts.Syscall = *query
opts.Arch = *arch
opts.ListQueryMatches = *listQuery
opts.ListArchQueries = *listArch
opts.PrettyPrint = *prettyPrint

Expand Down

0 comments on commit c4bd0b1

Please sign in to comment.