API reference
GDCLIFlags
Parser reading typed bool flags such as true/false and 1/0, integers with 0x, 0o, and 0b prefixes, and collecting positional arguments.
Methods
set_name(name: String) -> voidflag_bool(name: String, fallback: bool, help: String = "") -> voidflag_str(name: String, fallback: String, help: String = "") -> voidflag_int(name: String, fallback: int, help: String = "") -> voidparse(args: Array) -> Variant, Errget_bool(name: String) -> boolget_str(name: String) -> Stringget_int(name: String) -> intget_rest() -> PackedStringArrayusage() -> String
set_name
set_name(name: String) -> void---------------- Command-line flags ----------------
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | String | Required | Name used to register or look up the corresponding entry. |
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
flag_bool
flag_bool(name: String, fallback: bool, help: String = "") -> voidDeclare a boolean command-line flag.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | String | Required | Name used to register or look up the corresponding entry. |
fallback | bool | Required | Value returned when the requested value is unavailable or omitted. |
help | String | "" | User-facing description shown in command-line usage output. |
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
flag_str
flag_str(name: String, fallback: String, help: String = "") -> voidDeclare a string command-line flag.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | String | Required | Name used to register or look up the corresponding entry. |
fallback | String | Required | Value returned when the requested value is unavailable or omitted. |
help | String | "" | User-facing description shown in command-line usage output. |
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
flag_int
flag_int(name: String, fallback: int, help: String = "") -> voidDeclare an integer command-line flag.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | String | Required | Name used to register or look up the corresponding entry. |
fallback | int | Required | Value returned when the requested value is unavailable or omitted. |
help | String | "" | User-facing description shown in command-line usage output. |
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
parse
parse(args: Array) -> Variant, ErrAccept both --name=value and --name value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
args | Array | Required | Arguments in call or parameter-binding order. |
Return value
Variant, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
get_bool
get_bool(name: String) -> boolReturn a boolean flag's current value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | String | Required | Name used to register or look up the corresponding entry. |
Return value
bool
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
get_str
get_str(name: String) -> StringReturn a string flag's current value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | String | Required | Name used to register or look up the corresponding entry. |
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
get_int
get_int(name: String) -> intReturn an integer flag's current value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | String | Required | Name used to register or look up the corresponding entry. |
Return value
int
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
get_rest
get_rest() -> PackedStringArrayReturn positional arguments left after parsing registered flags.
Parameters
No parameters.
Return value
PackedStringArray
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
usage
usage() -> StringReturn usage guidance.
Parameters
No parameters.
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.