From 865e7aeca7c3090fee914b9ebde9490ef23d3559 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Sat, 29 Apr 2023 02:49:48 -0400 Subject: 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 --- game/src/ArgumentParser.tscn | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 game/src/ArgumentParser.tscn (limited to 'game/src/ArgumentParser.tscn') 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")]) -- cgit v1.2.3-56-ga3b1