diff options
author | Spartan322 <Megacake1234@gmail.com> | 2023-04-29 08:49:48 +0200 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2023-05-02 01:00:09 +0200 |
commit | 865e7aeca7c3090fee914b9ebde9490ef23d3559 (patch) | |
tree | 7836ab6e2e5bd751c226d86646883f8424577a7c /game/src/ArgumentParser.tscn | |
parent | 10053cf259c55ee45803268a844edf1011d8a16b (diff) |
Add ArgumentParser
Streamlines parsing of commandline arguments
Arguments reside in ProjectSettings as `openvic2/data/arguments` as a dictionary
The dictionary's key is the option name
The dictionary is set with default values
This enables project setting overrides for arguments (user specified arguments take priority)
Add help commandline option
Prepare for removal of GameDebug.gd
Add game project description
Diffstat (limited to 'game/src/ArgumentParser.tscn')
-rw-r--r-- | game/src/ArgumentParser.tscn | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/game/src/ArgumentParser.tscn b/game/src/ArgumentParser.tscn new file mode 100644 index 0000000..964c19e --- /dev/null +++ b/game/src/ArgumentParser.tscn @@ -0,0 +1,24 @@ +[gd_scene load_steps=5 format=3 uid="uid://dayjmgc34tqo6"] + +[ext_resource type="Script" path="res://src/ArgumentParser.gd" id="1_8e7gi"] +[ext_resource type="Script" path="res://src/ArgumentOption.gd" id="2_f3c26"] + +[sub_resource type="Resource" id="Resource_tq3y4"] +script = ExtResource("2_f3c26") +name = &"help" +aliases = Array[StringName]([&"h"]) +type = 1 +description = "Displays help and quits." +default_value = false + +[sub_resource type="Resource" id="Resource_j1to4"] +script = ExtResource("2_f3c26") +name = &"game-debug" +aliases = Array[StringName]([&"d", &"-debug", &"-debug-mode"]) +type = 1 +description = "Start in debug mode." +default_value = false + +[node name="ArgumentParser" type="Node"] +script = ExtResource("1_8e7gi") +option_array = Array[ExtResource("2_f3c26")]([SubResource("Resource_tq3y4"), SubResource("Resource_j1to4")]) |