Skip to content

Commit

Permalink
gonna remove query list
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Nov 21, 2023
1 parent 039437c commit 2f5dd8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 0 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ func main() {
log.Fatalf("Error: %s", err)
}
}
if opts.Arch != "" && opts.Syscall != "" {
_, err := assembuddy.GetSyscallData(opts.Arch, opts.Syscall, opts.PrettyPrint)
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
9 changes: 6 additions & 3 deletions pkg/assembuddy/requestTable.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,18 @@ func fetchData(endpointURL string, prettyp bool) ([]Syscall, error) {
}

func GetSyscallData(arch string, name string, prettyp bool) ([]Syscall, error) {
url := "https://api.syscall.sh/v1/syscalls/"
url := "https://api.syscall.sh/v1/syscalls"
// if arch is x64, x86, arm, or arm64, concat to endpointURL
if arch == "x64" || arch == "x86" || arch == "arm" || arch == "arm64" {
url += arch + "/"
url += "/" + arch
// if arch is not empty, return error
} else if arch != "" {
return nil, errors.New("invalid architecture")
}
url += name
if name != "" {
url += "/" + name
}
fmt.Println(url)
return fetchData(url, prettyp)
}

Expand Down

0 comments on commit 2f5dd8a

Please sign in to comment.