Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add -version flag and disply in help output #91

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/vmars
/gmars
/compile_test
/vmars.exe
/gmars.exe
/compile_test.exe
18 changes: 18 additions & 0 deletions cmd/gmars/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ import (
"github.com/bobertlo/gmars"
)

const (
usage = `gMARS %s

Usage: gmars [options] [warrior1.red] [warrior2.red]
`
)

func main() {
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), usage, "v0.1.14")
flag.PrintDefaults()
}

use88Flag := flag.Bool("8", false, "Enforce ICWS'88 rules")
sizeFlag := flag.Int("s", 8000, "Size of core")
procFlag := flag.Int("p", 8000, "Max. Processes")
Expand All @@ -20,8 +32,14 @@ func main() {
debugFlag := flag.Bool("debug", false, "Dump verbose reporting of simulator state")
assembleFlag := flag.Bool("A", false, "Assemble and output warriors only")
presetFlag := flag.String("preset", "", "Load named preset config (and ignore other flags)")
versionFlag := flag.Bool("version", false, "Print version and exit")
flag.Parse()

if *versionFlag {
fmt.Printf("gMARS %s\n", "v0.1.14")
os.Exit(0)
}

var config gmars.SimulatorConfig
if *presetFlag != "" {
presetConfig, err := gmars.PresetConfig(*presetFlag)
Expand Down
20 changes: 20 additions & 0 deletions cmd/vmars/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const (
defaultSpeedStep = 6
)

const (
usage = `vMARS %s

Usage: vmars [options] [warrior1.red] [warrior2.red]
`
)

var (
mplusFaceSource *text.GoTextFaceSource

Expand Down Expand Up @@ -53,6 +60,13 @@ func init() {
}

func main() {

flag.Usage = func() {
// fmt.
fmt.Fprintf(flag.CommandLine.Output(), usage, "v0.1.14")
flag.PrintDefaults()
}

use88Flag := flag.Bool("8", false, "Enforce ICWS'88 rules")
sizeFlag := flag.Int("s", 8000, "Size of core")
procFlag := flag.Int("p", 8000, "Max. Processes")
Expand All @@ -63,8 +77,14 @@ func main() {
showReadFlag := flag.Bool("showread", false, "display reads in the visualizer")
debugFlag := flag.Bool("debug", false, "Dump verbose reporting of simulator state")
presetFlag := flag.String("preset", "", "Load named preset config (and ignore other flags)")
versionFlag := flag.Bool("version", false, "Print version and exit")
flag.Parse()

if *versionFlag {
fmt.Printf("vMARS %s\n", "v0.1.14")
os.Exit(0)
}

var config gmars.SimulatorConfig
if *presetFlag != "" {
presetConfig, err := gmars.PresetConfig(*presetFlag)
Expand Down
Loading