mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-03 18:00:48 -07:00
fix: "allow always" for commands with paths (#23558)
This commit is contained in:
committed by
GitHub
parent
517961b2eb
commit
daf3691841
@@ -119,8 +119,10 @@ describe('getCommandRoots', () => {
|
|||||||
expect(getCommandRoots('ls -l')).toEqual(['ls']);
|
expect(getCommandRoots('ls -l')).toEqual(['ls']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle paths and return the binary name', () => {
|
it('should handle paths and return the full path', () => {
|
||||||
expect(getCommandRoots('/usr/local/bin/node script.js')).toEqual(['node']);
|
expect(getCommandRoots('/usr/local/bin/node script.js')).toEqual([
|
||||||
|
'/usr/local/bin/node',
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return an empty array for an empty string', () => {
|
it('should return an empty array for an empty string', () => {
|
||||||
|
|||||||
@@ -264,11 +264,7 @@ function normalizeCommandName(raw: string): string {
|
|||||||
return raw.slice(1, -1);
|
return raw.slice(1, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const trimmed = raw.trim();
|
return raw.trim();
|
||||||
if (!trimmed) {
|
|
||||||
return trimmed;
|
|
||||||
}
|
|
||||||
return trimmed.split(/[\\/]/).pop() ?? trimmed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractNameFromNode(node: Node): string | null {
|
function extractNameFromNode(node: Node): string | null {
|
||||||
|
|||||||
Reference in New Issue
Block a user