Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Nov 16, 2023
1 parent 444b024 commit 42ab39b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 593 deletions.
20 changes: 10 additions & 10 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@ import (
)

type CLIOptions struct {
Query string
Architecture string
ListQueries bool
AllStrings bool
Query string
Architecture string
ListQueryMatches bool
ListArchQueries bool
}

func parseArgs() *CLIOptions {
options := &CLIOptions{}

parser := argparse.NewParser("AssemBuddy", "Tool for querying assembly keywords")
query := parser.String("q", "query", &argparse.Options{Help: "Search query"})
architecture := parser.String("a", "architecture", &argparse.Options{Help: "Architecture for queries"})
arch := parser.String("a", "architecture", &argparse.Options{Help: "Architecture for queries"})

listQueries := parser.Flag("r", "list-arch", &argparse.Options{Help: "Get all syscalls from given architechture"})
allStrings := parser.Flag("n", "list-name", &argparse.Options{Help: "Get all syscalls with given name"})
listArchQueries := parser.Flag("r", "list-arch", &argparse.Options{Help: "Get all syscalls from given architechture"})
listQueryMatches := parser.Flag("n", "list-name", &argparse.Options{Help: "Get all syscalls with given name"})

err := parser.Parse(os.Args)
if err != nil {
fmt.Print(parser.Usage(err))
}

options.Query = *query
options.Architecture = *architecture
options.ListQueries = *listQueries
options.AllStrings = *allStrings
options.Architecture = *arch
options.ListQueryMatches = *listQueryMatches
options.ListArchQueries = *listArchQueries

return options
}
Expand Down
20 changes: 1 addition & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Selyss/Assembuddy
module github.com/Selyss/AssemBuddy

go 1.21.3

Expand All @@ -8,40 +8,22 @@ require (
github.com/charmbracelet/bubbletea v0.24.2
github.com/charmbracelet/lipgloss v0.9.1
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/viper v1.17.0
)

require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.13.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 42ab39b

Please sign in to comment.