From 1aded38e366332a83903e9e2b2b77e31ec16f763 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Wed, 9 Oct 2019 16:08:45 -0700 Subject: [PATCH] Added -version command --- BeefBuild/src/BuildApp.bf | 8 ++++++++ BeefBuild/src/Program.bf | 16 ++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/BeefBuild/src/BuildApp.bf b/BeefBuild/src/BuildApp.bf index 690df582..3f958d4f 100644 --- a/BeefBuild/src/BuildApp.bf +++ b/BeefBuild/src/BuildApp.bf @@ -46,6 +46,8 @@ namespace BeefBuild public override void Init() { + GetVersionInfo(); + if (mVerbosity == .Default) mVerbosity = .Normal; @@ -109,6 +111,9 @@ namespace BeefBuild public override bool HandleCommandLineParam(String key, String value) { + if (key.StartsWith("--")) + key.Remove(0, 1); + if (value == null) { switch (key) @@ -133,6 +138,9 @@ namespace BeefBuild case "-noir": mConfig_NoIR = true; return true; + case "-version": + mVerb = .GetVersion; + return true; } } else diff --git a/BeefBuild/src/Program.bf b/BeefBuild/src/Program.bf index 7583dcff..2c045cf9 100644 --- a/BeefBuild/src/Program.bf +++ b/BeefBuild/src/Program.bf @@ -22,6 +22,7 @@ namespace BeefBuild -run Compile and run the startup project in the workspace -test= Executes test script -verbosity= Set verbosity level to: quiet/minimal/normal/detailed/diagnostic + -version Get version -workspace= Sets workspace path (defaults to current working directory) """); return 0; @@ -33,14 +34,21 @@ namespace BeefBuild BuildApp mApp = new BuildApp(); mApp.ParseCommandLine(commandLine); - if (mApp.mFailed) + if (mApp.mVerb == .GetVersion) { - Console.Error.WriteLine(" Run with \"-help\" for a list of command-line arguments"); + Console.WriteLine("BeefBuild {}", mApp.GetVersionInfo().FileVersion); } else { - mApp.Init(); - mApp.Run(); + if (mApp.mFailed) + { + Console.Error.WriteLine(" Run with \"-help\" for a list of command-line arguments"); + } + else + { + mApp.Init(); + mApp.Run(); + } } mApp.Shutdown(); int32 result = mApp.mFailed ? 1 : 0;