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.
feat: stricter types, uninstall from all shells (#21)
* refactor: remove duplicated items * feat: stricter types for `shell` params * test: remove debug env * test: remove unnecessary directory creation * fix: restore prompting act for installer * feat: uninstall from all shells * docs: improve * refactor: test * docs: improve * refactor: use SUPPORTED_SHELLS * refactor: improve typings for prompt * refactor: replace @ts-ignore with type casts * fix: forgot sourceLineForShell * refactor: use dot syntax * feat: strict type for log * feat: isShellSupported * refactor: strict types for dict constants
- Loading branch information
Showing
11 changed files
with
164 additions
and
138 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
const BASH_LOCATION = '~/.bashrc'; | ||
const FISH_LOCATION = '~/.config/fish/config.fish'; | ||
const ZSH_LOCATION = '~/.zshrc'; | ||
const PWSH_LOCATION = '~/Documents/PowerShell/Microsoft.PowerShell_profile.ps1'; | ||
const COMPLETION_DIR = '~/.config/tabtab'; | ||
|
||
/** @type {Record.<String, String | undefined>} */ | ||
const SHELL_LOCATIONS = { | ||
const SUPPORTED_SHELLS = /** @type {const} */ (['bash', 'fish', 'pwsh', 'zsh']); | ||
|
||
/** | ||
* @typedef {typeof SUPPORTED_SHELLS[number]} SupportedShell | ||
*/ | ||
|
||
/** @satisfies {Record.<SupportedShell, String>} */ | ||
const SHELL_LOCATIONS = /** @type {const} */ ({ | ||
bash: '~/.bashrc', | ||
zsh: '~/.zshrc', | ||
fish: '~/.config/fish/config.fish', | ||
pwsh: '~/Documents/PowerShell/Microsoft.PowerShell_profile.ps1' | ||
}; | ||
}); | ||
|
||
/** @type {Record.<String, String | undefined>} */ | ||
const COMPLETION_FILE_EXT = { | ||
/** @satisfies {Record.<SupportedShell, String>} */ | ||
const COMPLETION_FILE_EXT = /** @type {const} */ ({ | ||
bash: 'bash', | ||
fish: 'fish', | ||
pwsh: 'ps1', | ||
zsh: 'zsh', | ||
}; | ||
}); | ||
|
||
module.exports = { | ||
BASH_LOCATION, | ||
ZSH_LOCATION, | ||
FISH_LOCATION, | ||
PWSH_LOCATION, | ||
COMPLETION_DIR, | ||
SUPPORTED_SHELLS, | ||
SHELL_LOCATIONS, | ||
COMPLETION_FILE_EXT, | ||
}; |
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
Oops, something went wrong.