> For the complete documentation index, see [llms.txt](https://asus-isg-aidc.gitbook.io/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://asus-isg-aidc.gitbook.io/guide/v1.4.0/cli/commonflags.md).

# Common Flags and Options

| Developer | Last modified |
| --------- | ------------- |
| AIDC Team | 2026/02/12    |

## 1. Global Flags

These flags are available on **all commands** when a valid license is active.

| Flag              | Short | Type   | Description                                             | Example            |
| ----------------- | :---: | ------ | ------------------------------------------------------- | ------------------ |
| `--limit-hosts`   |  `-l` | string | Limit operation to specific hosts (comma-separated)     | `-l node01,node02` |
| `--exclude-hosts` |  `-e` | string | Exclude specific hosts from operation (comma-separated) | `-e node03,node04` |
| `--task-id`       |  `-i` | string | Assign a task ID for tracking and reporting             | `-i TASK-001`      |

### Root-Level Flags

| Flag        | Short | Description                          |
| ----------- | :---: | ------------------------------------ |
| `--version` |  `-v` | Display AIDC-CLI version information |
| `--help`    |  `-h` | Show help for any command            |

***

## 2. Usage Examples

### Limiting Hosts

```bash
# Run only on specific nodes
aidc-cli bmc power-on -l node01,node02,node03

# Deploy OS on a single node
aidc-cli deploy install -l node05

# Check firmware version on selected nodes
aidc-cli chkfw all-version -l node01,node10
```

### Excluding Hosts

```bash
# Deploy OS on all nodes except node04
aidc-cli deploy install -e node04

# Network validation excluding management nodes
aidc-cli chknet pxe -e mgmt01,mgmt02
```

### Combining Flags

```bash
# Run on specific nodes with a task ID
aidc-cli bmc bmc-ver -l node01,node02 -i TASK-BMC-001

# Configure network on specific nodes, excluding one
aidc-cli network eth-cfg -l node01,node02,node03 -e node02
```

***

## 3. Common Flag Patterns by Command

### Output Flags

| Command        | Flag       | Short | Description                            |
| -------------- | ---------- | :---: | -------------------------------------- |
| `license show` | `--json`   |  `-j` | Output license info in JSON format     |
| `chknet *`     | `--stdout` |  `-o` | Output report to stdout in JSON format |
| `sysinfo`      | `--stdout` |   —   | Output raw command results to stdout   |

### File Path Flags

| Command              | Flag     | Short | Description                  |
| -------------------- | -------- | :---: | ---------------------------- |
| `driver mlnx-ofed`   | `--file` |  `-f` | Driver file local path       |
| `driver nv-gpu`      | `--file` |  `-f` | Driver file local path       |
| `driver doca-host-*` | `--file` |  `-f` | Driver file local path       |
| `fwupdate bios-*`    | `--file` |  `-f` | Firmware file local path     |
| `fwupdate bmc-tool`  | `--file` |  `-f` | BMC firmware file local path |
| `pkg nvlink-sw`      | `--file` |  `-f` | NVLink switch OS file path   |

### Background Execution

| Command      | Flag           | Short | Description                               |
| ------------ | -------------- | :---: | ----------------------------------------- |
| `hwsensor *` | `--background` |  `-b` | Run in background (persists after logout) |

***

## 4. Shell Auto-Completion

AIDC-CLI provides context-aware shell completion. After setup (see [Installation](/guide/v1.4.0/cli/installation.md)), use `Tab` to auto-complete:

* Command names: `aidc-cli b<Tab>` → `bmc`
* Subcommands: `aidc-cli bmc p<Tab>` → `power-on`, `power-off`, `power-reset`, `pxe-boot`
* Flag names: `aidc-cli driver mlnx-ofed --<Tab>` → `--file`, `--fwreset`, `--uninstall`
* Flag values: `aidc-cli syscfg timezone-set -t <Tab>` → timezone completions
* Host names: `aidc-cli bmc power-on -l <Tab>` → available host names

***

## 5. Exit Codes

| Code | Meaning                                                                |
| :--: | ---------------------------------------------------------------------- |
|  `0` | Success                                                                |
|  `1` | General error (invalid flags, missing requirements, execution failure) |

***

## 6. Logging

AIDC-CLI writes detailed logs for auditing and troubleshooting:

* **Console output**: User-facing messages and command progress
* **File logger**: Detailed debug logs (check `AIDC_LOG_PATH` or default log location)
* **Task logs**: Execution results stored with task remarks (e.g., `bmc_power-on`, `deploy_install`)

Log remarks follow the pattern: `<module>_<subcommand>`, helping you identify which operation generated each log entry.
