]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix(ui-cli): resolve --url option collision between global and supervision
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 17 Apr 2026 18:38:42 +0000 (20:38 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 17 Apr 2026 18:38:42 +0000 (20:38 +0200)
Rename global --url to --server-url and supervision set-url --url to
--supervision-url to prevent Commander option shadowing. Update types,
action consumer, integration tests, and README documentation.

ui/cli/README.md
ui/cli/src/cli.ts
ui/cli/src/commands/action.ts
ui/cli/src/commands/supervision.ts
ui/cli/src/types.ts
ui/cli/tests/integration/cli.test.ts

index 5b9321d574ee9b49dcdd5a37c04194df0c033e33..6b02186fa42a989fd26759cb4987060e1ea35617 100644 (file)
@@ -83,7 +83,7 @@ The install script creates a default config file. To override, edit `~/.config/e
 
 ### 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.
 
@@ -108,7 +108,7 @@ node dist/cli.js [global-options] <command> [subcommand] [options]
 | `-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
@@ -195,7 +195,7 @@ node dist/cli.js performance stats  # Get performance statistics
 #### 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
index 355a271636a30a331839ad8bcabaf634e5dc5449..c1697ae8bea545e4b84586ec8f6239a1333557cd 100644 (file)
@@ -23,7 +23,7 @@ program
   .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))
index 17c1ac6c31bd52965e36c780ace530f59e58eea7..9f91ffb426b66206f5574ef745b419dc1a975fcf 100644 (file)
@@ -25,7 +25,7 @@ export const runAction = async (
   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) {
index 782181ec45b7e77335d4d320c3095b091a784668..d4c746a682bc6c49dd4c669f218e7a83e7578e8d 100644 (file)
@@ -10,10 +10,10 @@ export const createSupervisionCommands = (program: Command): Command => {
   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)
index 115bc9c8842421778d2ab47537bd5ec796911c84..63ae321ddb975348b823fbf9c282798966cd144a 100644 (file)
@@ -1,5 +1,5 @@
 export interface GlobalOptions {
   config?: string
   json: boolean
-  url?: string
+  serverUrl?: string
 }
index a338f7a3323644cb13d0063ebbe5dc7b378fbc1d..0c4f8fa043a9de8072b0c3356eb8c52bf7d8db5e 100644 (file)
@@ -68,13 +68,19 @@ await describe('evse-cli integration tests', async () => {
   })
 
   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)
   })