forked from mklabs/tabtab
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed cross-shell completion issue: - Before this change, the completer would rely on the `SHELL` environment variable provided by the first login shell. This can be unreliable. For example: Launching another bash from zsh does not change the `SHELL` environment variable which was already set to `/bin/zsh`. - After this change, the completion scripts will explicitly set the `SHELL` environment variable to whatever shell it supposed to serve * Replace `systemShell` with `getShellFromEnv` and require the user to pass `env` explicitly.
- Loading branch information
Showing
9 changed files
with
62 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
const tabtabDebug = require('./tabtabDebug'); | ||
const systemShell = require('./systemShell'); | ||
const exists = require('./exists'); | ||
|
||
module.exports = { | ||
systemShell, | ||
tabtabDebug, | ||
exists | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const assert = require('assert'); | ||
const { SUPPORTED_SHELLS, getShellFromEnv } = require('..'); | ||
|
||
describe('getShellFromEnv', () => { | ||
it('errors when env lacks SHELL', () => { | ||
assert.throws( | ||
() => getShellFromEnv({}), | ||
{ | ||
message: 'SHELL cannot be empty', | ||
}, | ||
) | ||
}); | ||
|
||
it('errors on unsupported shells', () => { | ||
assert.throws( | ||
() => getShellFromEnv({ SHELL: 'unknown' }), | ||
{ | ||
message: "SHELL was set to an invalid value (unknown). Supported values are: 'bash', 'fish', 'pwsh', 'zsh'", | ||
}, | ||
); | ||
}) | ||
|
||
it('returns supported shells', () => { | ||
assert.deepStrictEqual( | ||
SUPPORTED_SHELLS.map(SHELL => getShellFromEnv({ SHELL })), | ||
SUPPORTED_SHELLS, | ||
); | ||
}); | ||
}); |