Skip to content

Commit

Permalink
add support for specifying output file when building
Browse files Browse the repository at this point in the history
  • Loading branch information
JLaferri committed Oct 15, 2019
1 parent 97b5d2a commit 725e650
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gecko.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ func main() {
"codes.json",
"Used to specify a path to a config file.",
)
outputFilePtr := buildFlags.String(
"o",
"",
"Additional output file path. Using a .gct extension will output a gct. Everything else will output text. Will be appended to the files in the config file.",
)
defsymPtr := buildFlags.String(
"defsym",
"",
Expand All @@ -111,7 +116,11 @@ func main() {
buildFlags.Parse(os.Args[2:])

config := readConfigFile(*configFilePathPtr)
if len(config.OutputFiles) < 1 {
outputFiles = config.OutputFiles
if *outputFilePtr != "" {
outputFiles = append(outputFiles, FileDetails{File: *outputFilePtr})
}
if len(outputFiles) < 1 {
log.Panic("Must have at least one output file configured in the outputFiles field\n")
}

Expand All @@ -125,7 +134,6 @@ func main() {
argConfig.DefSym = *defsymPtr

buildBody(config)
outputFiles = config.OutputFiles
case "assemble":
assembleFlags := flag.NewFlagSet("assemble", flag.ExitOnError)
outputFilePtr := assembleFlags.String(
Expand Down

0 comments on commit 725e650

Please sign in to comment.