-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Glowman554
committed
May 27, 2024
1 parent
965590f
commit 75f3808
Showing
13 changed files
with
145 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package commands | ||
|
||
import ( | ||
"fire/arguments" | ||
"fire/firestorm" | ||
"strings" | ||
) | ||
|
||
type Compile struct{} | ||
|
||
func (Compile) PopulateParser(parser *arguments.Parser) { | ||
parser.Allow("input", "Input file") | ||
parser.Allow("outpu", "Output file") | ||
parser.Allow("target", "Compilation target") | ||
parser.Allow("include", "Add file to include path") | ||
} | ||
|
||
func (Compile) Execute(parser *arguments.Parser) error { | ||
input, err := parser.Consume("input", nil) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
defaultOutput := "a." + firestorm.DetectExtension() | ||
output, err := parser.Consume("output", &defaultOutput) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
defaultTarget := firestorm.DetectTarget() | ||
target, err := parser.Consume("target", &defaultTarget) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
includes := []string{} | ||
for parser.Has("include") { | ||
include, err := parser.Consume("include", nil) | ||
if err != nil { | ||
return nil | ||
} | ||
if !strings.HasSuffix(*include, "/") { | ||
includes = append(includes, *include+"/") | ||
} else { | ||
includes = append(includes, *include) | ||
} | ||
} | ||
|
||
firestorm.Compile(*input, *output, *target, includes) | ||
|
||
return nil | ||
} | ||
|
||
func (Compile) Description() string { | ||
return "Compile a file withouth using the build system" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters