Skip to content

Commit

Permalink
Take -v and --version options to show version
Browse files Browse the repository at this point in the history
  • Loading branch information
DQNEO committed Jul 9, 2023
1 parent 709ec0f commit c139092
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ import (
"unsafe"
)

const Version = "0.0.7"

var oFlag = flag.String("o", "a.out", "output file")

var debug = flag.Bool("d", false, "show debug message")

var oVersion = flag.Bool("version", false, "show version")
var oV = flag.Bool("v", false, "show version")

func debugf(s string, a ...interface{}) {
if !*debug {
return
Expand Down Expand Up @@ -612,11 +617,18 @@ func encodeAllData(ss []*Stmt) []byte {

var globalSymbols = make(map[string]bool)

func showVersion() {
fmt.Println("goas assembler version " + Version)
}

func main() {
flag.Parse()

var inFiles []string

if *oVersion || *oV {
showVersion()
return
}
if flag.NArg() > 0 {
inFiles = flag.Args()
} else {
Expand Down

0 comments on commit c139092

Please sign in to comment.