2.0.2 • Published 12 months ago

@bendn/gdcli v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

godot cli options parser

version

A utility for parsing command line arguments for godot.

Note Versions < 2.0.0 are for 3.x

Warning

Waiting 4 godot-proposals/4815 for the full experience.


Features

  • 0-* Arguments
  • Default values
  • Help creation
  • Any number of triggers

Usage example

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(OS.get_cmdline_args() + OS.get_cmdline_user_args()) # Parse
if args.get("help", false): # Check if we want help
    print(p.help()) # Show help
else:
    print(args) # Just show args otherwise
2.0.2

12 months ago

2.0.1

12 months ago

2.0.0

12 months ago

1.2.5

2 years ago

1.2.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago