Skip to content

Commit c9fba71

Browse files
committed
Add -v option to print version
It's now v0.2!
1 parent 6e53909 commit c9fba71

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ If you have golang environment setup:
3434

3535
Or, just download the binary:
3636

37-
$ wget https://github.com/namhyung/das/releases/download/v0.1/das-linux-amd64
37+
$ wget https://github.com/namhyung/das/releases/download/v0.2/das-linux-amd64
3838
$ sudo install -D das-linux-amd64 /usr/local/bin/das

das.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ import (
1717
str "strings"
1818
)
1919

20+
const (
21+
DasVersion string = "v0.2"
22+
)
23+
2024
const (
2125
OPTYPE_OTHER = iota
2226
OPTYPE_BRANCH
@@ -65,13 +69,19 @@ var (
6569
csect *DasFunc // current section
6670
strs map[uint64]string // string table
6771
lastOffset uint64 // last code offset
68-
capstone bool
69-
objdump string
72+
)
73+
74+
var (
75+
// command line options
76+
capstone bool
77+
objdump string
78+
version bool
7079
)
7180

7281
func init() {
7382
flag.BoolVar(&capstone, "c", false, "Use capstone disassembler")
7483
flag.StringVar(&objdump, "d", "objdump", "Path to objdump tool")
84+
flag.BoolVar(&version, "v", false, "Show version number")
7585
}
7686

7787
func initDasParser(target string) *DasParser {
@@ -105,6 +115,12 @@ func main() {
105115
flag.Parse()
106116

107117
args := flag.Args()
118+
119+
if version {
120+
fmt.Printf("das (TUI disassembler): %s\n", DasVersion)
121+
return
122+
}
123+
108124
if len(args) < 1 {
109125
log.Fatal("Usage: das <binary>")
110126
}

0 commit comments

Comments
 (0)