MCPcopy
hub / github.com/ValueCell-ai/ClawX / installCompletionToProfile

Function installCompletionToProfile

electron/utils/openclaw-cli.ts:379–415  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

377}
378
379export function installCompletionToProfile(): void {
380 if (!app.isPackaged) return;
381 if (process.platform === 'win32') return;
382
383 const entryPath = getOpenClawEntryPath();
384 if (!existsSync(entryPath)) return;
385
386 const execPath = getNodeExecForCli();
387
388 const child = spawn(
389 execPath,
390 [entryPath, 'completion', '--install', '-y'],
391 {
392 env: {
393 ...process.env,
394 ELECTRON_RUN_AS_NODE: '1',
395 OPENCLAW_NO_RESPAWN: '1',
396 OPENCLAW_EMBEDDED_IN: 'ClawX',
397 },
398 stdio: 'ignore',
399 detached: false,
400 windowsHide: true,
401 }
402 );
403
404 child.on('close', (code) => {
405 if (code === 0) {
406 logger.info('OpenClaw completion installed to shell profile');
407 } else {
408 logger.warn(`OpenClaw completion install exited with code ${code}`);
409 }
410 });
411
412 child.on('error', (err) => {
413 logger.warn('Failed to install completion to shell profile:', err);
414 });
415}

Callers 1

initializeFunction · 0.90

Calls 3

getOpenClawEntryPathFunction · 0.90
getNodeExecForCliFunction · 0.85
onMethod · 0.65

Tested by

no test coverage detected