mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-02 01:11:24 -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']);
|
||||
});
|
||||
|
||||
it('should handle paths and return the binary name', () => {
|
||||
expect(getCommandRoots('/usr/local/bin/node script.js')).toEqual(['node']);
|
||||
it('should handle paths and return the full path', () => {
|
||||
expect(getCommandRoots('/usr/local/bin/node script.js')).toEqual([
|
||||
'/usr/local/bin/node',
|
||||
]);
|
||||
});
|
||||
|
||||
it('should return an empty array for an empty string', () => {
|
||||
|
||||
@@ -264,11 +264,7 @@ function normalizeCommandName(raw: string): string {
|
||||
return raw.slice(1, -1);
|
||||
}
|
||||
}
|
||||
const trimmed = raw.trim();
|
||||
if (!trimmed) {
|
||||
return trimmed;
|
||||
}
|
||||
return trimmed.split(/[\\/]/).pop() ?? trimmed;
|
||||
return raw.trim();
|
||||
}
|
||||
|
||||
function extractNameFromNode(node: Node): string | null {
|
||||
|
||||
Reference in New Issue
Block a user