Skip to content

Commit

Permalink
refactor: remove TABTAB_FILE_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed Jan 31, 2024
1 parent 1d8ffe8 commit 11d4826
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 0 additions & 8 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ const COMPLETION_FILE_EXT = {
zsh: 'zsh',
};

const TABTAB_FILE_NAME = {
bash: '__tabtab.bash',
fish: '__tabtab.fish',
pwsh: '__tabtab.ps1',
zsh: '__tabtab.zsh',
};

module.exports = {
BASH_LOCATION,
ZSH_LOCATION,
Expand All @@ -33,5 +26,4 @@ module.exports = {
COMPLETION_DIR,
SHELL_LOCATIONS,
COMPLETION_FILE_EXT,
TABTAB_FILE_NAME,
};
8 changes: 4 additions & 4 deletions lib/filename.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { COMPLETION_FILE_EXT, TABTAB_FILE_NAME } = require('./constants');
const { COMPLETION_FILE_EXT } = require('./constants');

/**
* Get a template file name for the SHELL provided.
Expand Down Expand Up @@ -33,11 +33,11 @@ const completionFileName = (name, shell = systemShell()) => {
* @returns {String}
*/
const tabtabFileName = (shell = systemShell()) => {
const filename = TABTAB_FILE_NAME[shell];
if (!filename) {
const ext = COMPLETION_FILE_EXT[shell];
if (!ext) {
throw new Error(`Unsupported shell: ${shell}`);
}
return filename;
return `__tabtab.${ext}`;
};

module.exports = {
Expand Down

0 comments on commit 11d4826

Please sign in to comment.