### Configuration precedence
-Defaults < config file < `--config <path>` < `--url <url>` (highest priority).
+Defaults < config file < `--config <path>` < `--server-url <url>` (highest priority).
Use `--config <path>` to load a specific config file instead of the XDG default.
| `-V, --version` | Print version |
| `-C, --config <path>` | Path to configuration file |
| `--json` | Machine-readable JSON output on stdout |
-| `--url <url>` | WebSocket URL (overrides config host/port/secure) |
+| `--server-url <url>` | WebSocket URL (overrides config host/port/secure) |
| `-h, --help` | Show help |
### Commands
#### supervision
```shell
-node dist/cli.js supervision set-url --url <url> [hashId...] # Set supervision URL
+node dist/cli.js supervision set-url --supervision-url <url> [hashId...] # Set supervision URL
```
### JSON Output Mode
.version(__CLI_VERSION__, '-V, --version', 'output the version number')
.option('-C, --config <path>', 'path to configuration file')
.option('--json', 'output results as JSON (machine-readable)', false)
- .option('--url <url>', 'simulator UI server WebSocket URL (overrides config)')
+ .option('--server-url <url>', 'simulator UI server WebSocket URL (overrides config)')
program.addCommand(createSimulatorCommands(program))
program.addCommand(createStationCommands(program))
const rootOpts = program.opts<GlobalOptions>()
const formatter = createFormatter(rootOpts.json)
try {
- const config = await loadConfig({ configPath: rootOpts.config, url: rootOpts.url })
+ const config = await loadConfig({ configPath: rootOpts.config, url: rootOpts.serverUrl })
await executeCommand({ config, formatter, payload, procedureName })
process.exitCode = 0
} catch (error: unknown) {
cmd
.command('set-url [hashIds...]')
.description('Set supervision URL for station(s)')
- .requiredOption('--url <url>', 'supervision URL')
- .action(async (hashIds: string[], options: { url: string }) => {
+ .requiredOption('--supervision-url <url>', 'supervision URL')
+ .action(async (hashIds: string[], options: { supervisionUrl: string }) => {
const payload: RequestPayload = {
- url: options.url,
+ url: options.supervisionUrl,
...buildHashIdsPayload(hashIds),
}
await runAction(program, ProcedureName.SET_SUPERVISION_URL, payload)
export interface GlobalOptions {
config?: string
json: boolean
- url?: string
+ serverUrl?: string
}
})
await it('should exit 1 with connection error when no simulator running', async () => {
- const result = await runCli(['--url', 'ws://localhost:19999', 'simulator', 'state'])
+ const result = await runCli(['--server-url', 'ws://localhost:19999', 'simulator', 'state'])
assert.strictEqual(result.code, 1)
assert.ok(result.stderr.length > 0 || result.stdout.length > 0, 'Expected error output')
})
await it('should exit 1 and output JSON error in --json mode when no simulator running', async () => {
- const result = await runCli(['--url', 'ws://localhost:19999', '--json', 'simulator', 'state'])
+ const result = await runCli([
+ '--server-url',
+ 'ws://localhost:19999',
+ '--json',
+ 'simulator',
+ 'state',
+ ])
assert.strictEqual(result.code, 1)
})