> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/cli/cligetargs.md).

# CLIGetArgs

This method will parse the cli arguments and return a struct of the following:

* `options` - A struct of the options
* `positionals` - An array of the positional arguments

The options can be provided in the following formats:

* `--option` - A boolean option
* `--option=value` - An option with a value
* `--option="value"` - An option with a quoted value
* `--option='value'` - An option with a quoted value
* `-o=value` - A shorthand option with a value
* `-o` - A shorthand boolean option
* `--!option` - A negation option

For example, the following cli arguments:

```
 --debug --!verbose --bundles=Spec -o='/path/to/file' -v my/path/template
 
```

Will be parsed into the following struct:

```
 {
 "options" :  {
    	"debug": true,
   	"verbose": false,
  	"bundles": "Spec",
 	   	"o": "/path/to/file",
 	   	"v": true
 },
 "positionals": [ "my/path/template" ]
 
```

## Some Ground Rules

* Options are prefixed with --
* Shorthand options are prefixed with -
* Options can be negated with --! or --no-
* Options can have values separated by =
* Values can be quoted with single or double quotes
* Repeated options will override the previous value

## Method Signature

```
CLIGetArgs()
```

### Arguments

This function does not accept any arguments

## Examples

### Get parsed command-line arguments

```java
args = cliGetArgs();
writeOutput( isStruct( args ) );

```

Result: true

## Related

* [CLIClear](/boxlang-language/reference/built-in-functions/cli/cliclear.md)
* [CLIExit](/boxlang-language/reference/built-in-functions/cli/cliexit.md)
* [CLIRead](/boxlang-language/reference/built-in-functions/cli/cliread.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/cli/cligetargs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
