# CLI

The **CLI / Ad-Hoc Script Editor** has two main functions:

* It provides a very simple command line interface (CLI) to the Directory Opus command set.
* In Script mode, it allows you to design and test ad-hoc [scripts](https://chaoses-ib.gitbook.io/directory-opus/manual/scripting).

You can open the CLI using the **Tools / Opus CLI** menu command.

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-0a1474817b5eba62e1a13a911d92cf8491917b3e%2Fcli.png?alt=media)

The command line lets you run [internal commands](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/command_reference/internal_commands) directly without having to configure a button or hotkey first. It is similar to using the [find-as-you-type](https://chaoses-ib.gitbook.io/directory-opus/manual/basic_concepts/the_lister/find-as-you-type_field) field in command mode. You can also display the full template for any internal command by entering the command name followed by a ? symbol (as in the screenshot above).

Turning on the **Script interpreter** option puts the CLI in Script mode, which allows you to design and test ad-hoc scripts. The drop-down field lets you select the script language - if the language you wish to use isn't listed, simply type the name in. You will need to consult the documentation for third-party languages as to the name of the "script engine".

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-cecb12c8ef305d98c9cfe396252163405f40d380%2Fcli_scriptmode.png?alt=media)

Press **F5** or click the **Run** button to run your script. Any errors, warnings or text output from the script (e.g. via the **DOpus.Output** method) will be displayed in output field below the editor.

(Accelerator keys mentioned below are for the English version of Directory Opus. Hover the mouse over buttons to discover their accelerators in your language.)

The **Abort** (**Alt+A**) button can be used to stop a script which is caught in a loop.

The **New** (**Alt+N**) button clears both the script and output field so you can start afresh.

The **Load** (**Alt+L**) and **Save** (**Alt+S**) buttons allow you to load and save scripts for use at a later date.

If the **Clear** option is checked, the output field will be cleared each time a script is run; otherwise, output from each run will accumulate.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chaoses-ib.gitbook.io/directory-opus/manual/additional_functionality/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
