Something went wrong. Try again.
A rewrite of the Plan 9 rc shell in Goose for UNIX-like systems and with structured CLI args
Something went wrong. Try again.
1234567891011121314import assert from 'node:assert/strict';import { spawnSync } from 'node:child_process';import { resolve } from 'node:path';
const shell = resolve(process.argv[2] || 'rc2');const script = resolve('examples/greet.rc');const generated = spawnSync(shell, ['--completions', 'bash', script], { encoding: 'utf8' });assert.equal(generated.status, 0, generated.stderr);const helper = generated.stdout.match(/(__rc2_[a-f0-9]+_complete)\(\)/)[1];const result = spawnSync('bash', ['-c', `${generated.stdout}\nCOMP_WORDS=(greet.rc -vsfr); COMP_CWORD=1; ${helper}; printf '%s\\n' "\${COMPREPLY[@]}"`], { encoding: 'utf8' });assert.equal(result.status, 0, result.stderr);assert.equal(result.stdout, '-vsfriendly\n');console.log('Short-option completion tests passed');