Skip to content

Commit

Permalink
fixed list
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Nov 21, 2023
1 parent 82101da commit 66c213a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func parseArgs() *CLIOptions {
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 && !*listQuery) {
fmt.Print(parser.Usage(err))
os.Exit(1)
}
Expand All @@ -51,6 +51,12 @@ func main() {
log.Fatalf("Error: %s", err)
}
}
if opts.ListQueryMatches {
_, err := assembuddy.QueryInfo(opts.Arch)
if err != nil {
log.Fatalf("Error: %s", err)
}
}
table, err := assembuddy.GetSyscallData(opts.Arch, opts.Syscall, opts.PrettyPrint)
if err != nil {
log.Fatal(err)
Expand Down
11 changes: 11 additions & 0 deletions pkg/assembuddy/requestTable.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,14 @@ func ArchInfo() ([]Syscall, error) {
url := "https://api.syscall.sh/v1/conventions"
return fetchData(url, true)
}

func QueryInfo(arch string) ([]Syscall, error) {
url := "https://api.syscall.sh/v1/syscalls/"
if arch == "x64" || arch == "x86" || arch == "arm" || arch == "arm64" {
url += arch
} else if arch != "" {
return nil, errors.New("invalid architecture")
}
return fetchData(url, true)
// TODO:
}

0 comments on commit 66c213a

Please sign in to comment.