diff --git a/cmd/main.go b/cmd/main.go index 6fe7fc6..10d055f 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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) diff --git a/pkg/assembuddy/requestTable.go b/pkg/assembuddy/requestTable.go index e1ee91a..f56a0bb 100644 --- a/pkg/assembuddy/requestTable.go +++ b/pkg/assembuddy/requestTable.go @@ -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) }