toolchain version command
This commit is contained in:
@@ -11,6 +11,8 @@ import "core:os/os2"
|
||||
import "core:path/filepath"
|
||||
import "core:strings"
|
||||
|
||||
BROLANG_VERSION :: "0.0.0-dev"
|
||||
|
||||
Cli_Options :: struct {
|
||||
input_path: string,
|
||||
output_path: string,
|
||||
@@ -107,6 +109,9 @@ print_usage :: proc() {
|
||||
fmt.eprintln(
|
||||
" brolang init",
|
||||
)
|
||||
fmt.eprintln(
|
||||
" brolang version",
|
||||
)
|
||||
}
|
||||
|
||||
is_translate_c_command :: proc(arg: string) -> bool {
|
||||
@@ -125,6 +130,10 @@ is_init_command :: proc(arg: string) -> bool {
|
||||
return arg == "init"
|
||||
}
|
||||
|
||||
is_version_command :: proc(arg: string) -> bool {
|
||||
return arg == "version"
|
||||
}
|
||||
|
||||
template_root_valid :: proc(root: string) -> bool {
|
||||
std_build, std_error := filepath.join({root, "std", "build", "build.bro"})
|
||||
if std_error != nil {
|
||||
@@ -476,6 +485,14 @@ run_translate_c :: proc(args: []string) -> int {
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
if len(os2.args) >= 2 && is_version_command(os2.args[1]) {
|
||||
if len(os2.args) != 2 {
|
||||
print_usage()
|
||||
os2.exit(2)
|
||||
}
|
||||
fmt.printfln("brolang %s", BROLANG_VERSION)
|
||||
os2.exit(0)
|
||||
}
|
||||
if len(os2.args) >= 2 && is_build_command(os2.args[1]) {
|
||||
if len(os2.args) > 3 {
|
||||
print_usage()
|
||||
|
||||
Reference in New Issue
Block a user