Diffstat (limited to 'Main.gd')
-rw-r--r--Main.gd49
1 files changed, 25 insertions, 24 deletions
diff --git a/Main.gd b/Main.gd
index 280c943..d478378 100644
--- a/Main.gd
+++ b/Main.gd
@@ -2,27 +2,28 @@ extends Node
func _ready():
- var p = Parser.new()
- p.add_argument(
- Arg.new(
- {
- triggers = ["-fly", "--fley"],
- n_args = 2,
- help = "i eat donkeys",
- default = ["donkey kong", "ha"]
- }
- )
- )
- p.add_argument(Arg.new({triggers = ["-bard", "--flgersog"], n_args = 2, help = "me 4"}))
- p.add_argument(Arg.new({triggers = ["--radiation"], n_args = "*", help = "i am radiation"}))
- p.add_argument(
- Arg.new(
- {
- triggers = ["-h", "--help", "-?"],
- help = "show this help message and exit",
- action = "store_true"
- }
- )
- )
- print(p.parse_arguments())
- print(p.help())
+ var p = Parser.new() # create the parser
+ p.add_argument(Arg.new({ # add an argument
+ triggers = ["-F", "--fly"], # triggers
+ n_args = 2, # number of arguments
+ help = "Fly places", # help message
+ default = ["sky", "ground"] # default args if called without arguments
+ }))
+ p.add_argument(Arg.new({ # arg n2
+ triggers = ["--eat"],
+ n_args = "*", # any number of arguments
+ help = "eats all args you give it",
+ dest = "restaurant" # the variable it goes into (defaults to longest trigger)
+ }))
+ p.add_argument(Arg.new({
+ triggers = ["-H", "-?"],
+ dest = "help",
+ help = "show this help message and exit",
+ action = "store_true"
+ }))
+ var args = p.parse_arguments() # Parse
+ if args.get("help", false): # Check if we want help
+ print(p.help()) # Show help
+ else:
+ print(args) # Just show args otherwise
+ get_tree().quit()