mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 08:31:14 -07:00
fix(cli): support comma separated values for extensions and allowed mcp server names (#9007)
This commit is contained in:
@@ -307,6 +307,23 @@ describe('parseArguments', () => {
|
||||
const argv = await parseArguments({} as Settings);
|
||||
expect(argv.allowedTools).toEqual(['read_file', 'ShellTool(git status)']);
|
||||
});
|
||||
|
||||
it('should support comma-separated values for --allowed-mcp-server-names', async () => {
|
||||
process.argv = [
|
||||
'node',
|
||||
'script.js',
|
||||
'--allowed-mcp-server-names',
|
||||
'server1,server2',
|
||||
];
|
||||
const argv = await parseArguments({} as Settings);
|
||||
expect(argv.allowedMcpServerNames).toEqual(['server1', 'server2']);
|
||||
});
|
||||
|
||||
it('should support comma-separated values for --extensions', async () => {
|
||||
process.argv = ['node', 'script.js', '--extensions', 'ext1,ext2'];
|
||||
const argv = await parseArguments({} as Settings);
|
||||
expect(argv.extensions).toEqual(['ext1', 'ext2']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('loadCliConfig', () => {
|
||||
|
||||
@@ -229,6 +229,11 @@ export async function parseArguments(settings: Settings): Promise<CliArgs> {
|
||||
type: 'array',
|
||||
string: true,
|
||||
description: 'Allowed MCP server names',
|
||||
coerce: (mcpServerNames: string[]) =>
|
||||
// Handle comma-separated values
|
||||
mcpServerNames.flatMap((mcpServerName) =>
|
||||
mcpServerName.split(',').map((m) => m.trim()),
|
||||
),
|
||||
})
|
||||
.option('allowed-tools', {
|
||||
type: 'array',
|
||||
@@ -244,6 +249,11 @@ export async function parseArguments(settings: Settings): Promise<CliArgs> {
|
||||
string: true,
|
||||
description:
|
||||
'A list of extensions to use. If not provided, all extensions are used.',
|
||||
coerce: (extensions: string[]) =>
|
||||
// Handle comma-separated values
|
||||
extensions.flatMap((extension) =>
|
||||
extension.split(',').map((e) => e.trim()),
|
||||
),
|
||||
})
|
||||
.option('list-extensions', {
|
||||
alias: 'l',
|
||||
|
||||
Reference in New Issue
Block a user