diff --git a/.changeset/funny-students-marry.md b/.changeset/funny-students-marry.md new file mode 100644 index 0000000..d65e3a6 --- /dev/null +++ b/.changeset/funny-students-marry.md @@ -0,0 +1,5 @@ +--- +"terminal-keeper": patch +--- + +fix: add cwd when import the commands diff --git a/src/commands/importAsync.ts b/src/commands/importAsync.ts index 2946ef0..2ea1957 100644 --- a/src/commands/importAsync.ts +++ b/src/commands/importAsync.ts @@ -96,8 +96,9 @@ const chooseFilePath = async (filePaths: string[]): Promise let selectedFilePath = filePaths[0]; if (filePaths.length >= 1) { const options = filePaths.map((filePath): QuickPickItem => { + const dirname = path.dirname(filePath); const filename = path.basename(filePath); - return { label: filename, detail: filePath.replace(filename, '') }; + return { label: filename, detail: dirname }; }); const quickPickItem = await window.showQuickPick(options, { title: constants.selectFileTitle, @@ -198,9 +199,11 @@ export const importAsync = async (fileType: ImportFileType): Promise => { } // Parse to terminal item from scripts + const cwd = path.dirname(selectedFilePath); const terminalItems = Object.entries(scripts).map(([key, value]) => { const item: TerminalItem = { name: key, + cwd, commands: [value] }; return item;