Skip to content

Commit

Permalink
fix: add cwd when import the commands
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenngoclongdev authored Oct 14, 2024
1 parent a284647 commit 89d08da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/funny-students-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"terminal-keeper": patch
---

fix: add cwd when import the commands
5 changes: 4 additions & 1 deletion src/commands/importAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ const chooseFilePath = async (filePaths: string[]): Promise<string | undefined>
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,
Expand Down Expand Up @@ -198,9 +199,11 @@ export const importAsync = async (fileType: ImportFileType): Promise<void> => {
}

// 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;
Expand Down

0 comments on commit 89d08da

Please sign in to comment.