Skip to content

Commit

Permalink
refactor: aIDERコマンドの実装を整理 ♻️
Browse files Browse the repository at this point in the history
  • Loading branch information
nekowasabi committed Aug 4, 2024
1 parent 236d4fc commit d4835da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 11 additions & 0 deletions denops/aider/aiderCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ export const aiderCommand = {
await denops.cmd("b#");
},

async openIgnore(denops: Denops): Promise<void> {
const gitRoot = (await fn.system(denops, "git rev-parse --show-toplevel"))
.trim();
const filePathToOpen = `${gitRoot}/.aiderignore`;
if (await fn.filereadable(denops, filePathToOpen)) {
await denops.cmd(`edit ${filePathToOpen}`);
return;
}
console.log(".aiderignoreファイルが見つかりません。");
},

async run(denops: Denops): Promise<void> {
const aiderCommand = ensure(
await v.g.get(denops, "aider_command"),
Expand Down
9 changes: 1 addition & 8 deletions denops/aider/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,7 @@ export async function main(denops: Denops): Promise<void> {
}
},
async openIgnore(): Promise<void> {
const gitRoot = (await fn.system(denops, "git rev-parse --show-toplevel"))
.trim();
const filePathToOpen = `${gitRoot}/.aiderignore`;
if (await fn.filereadable(denops, filePathToOpen)) {
await denops.cmd(`edit ${filePathToOpen}`);
return;
}
console.log("No .aiderignore file found.");
await aiderCommand.openIgnore(denops);
},
async debug(): Promise<void> {
await aiderCommand.debug(denops);
Expand Down

0 comments on commit d4835da

Please sign in to comment.