From 05762a2d1a914d966004f3c3958bb3a72afe9325 Mon Sep 17 00:00:00 2001 From: Alisue Date: Sun, 24 Sep 2023 20:50:45 +0900 Subject: [PATCH] :+1: Use dispatch to execute command in actions To support persistent arguments in actions as well. --- denops/gin/action/add.ts | 5 ++--- denops/gin/action/branch_delete.ts | 5 ++--- denops/gin/action/branch_move.ts | 3 +-- denops/gin/action/branch_new.ts | 5 ++--- denops/gin/action/chaperon.ts | 21 +++++++++------------ denops/gin/action/cherry_pick.ts | 3 +-- denops/gin/action/diff.ts | 23 ++++++++++------------- denops/gin/action/diff_smart.ts | 23 +++++++++++------------ denops/gin/action/edit.ts | 19 ++++++++----------- denops/gin/action/merge.ts | 3 +-- denops/gin/action/patch.ts | 21 +++++++++------------ denops/gin/action/rebase.ts | 5 ++--- denops/gin/action/reset.ts | 3 +-- denops/gin/action/reset_file.ts | 3 +-- denops/gin/action/restore.ts | 3 +-- denops/gin/action/revert.ts | 3 +-- denops/gin/action/rm.ts | 3 +-- denops/gin/action/show.ts | 11 ++++++----- denops/gin/action/stage.ts | 17 ++++++++--------- denops/gin/action/stash.ts | 3 +-- denops/gin/action/switch.ts | 7 +++++-- denops/gin/action/tag.ts | 3 +-- 22 files changed, 84 insertions(+), 108 deletions(-) diff --git a/denops/gin/action/add.ts b/denops/gin/action/add.ts index 8552f58b..3ddc7b1d 100644 --- a/denops/gin/action/add.ts +++ b/denops/gin/action/add.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { path: string }; @@ -36,12 +35,12 @@ async function doAdd( gatherCandidates: GatherCandidates, ): Promise { const xs = await gatherCandidates(denops, bufnr, range); - await execBare(denops, [ + await denops.dispatch("gin", "command", "silent", [ "add", "--ignore-errors", "--force", ...extraArgs, "--", ...xs.map((x) => x.path), - ], { stdoutIndicator: "null" }); + ]); } diff --git a/denops/gin/action/branch_delete.ts b/denops/gin/action/branch_delete.ts index 4ad4a767..6ec05ed9 100644 --- a/denops/gin/action/branch_delete.ts +++ b/denops/gin/action/branch_delete.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = | { kind: "remote"; branch: string; remote: string } @@ -43,7 +42,7 @@ async function doDelete( case "alias": continue; case "remote": - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "push", "--delete", x.remote, @@ -51,7 +50,7 @@ async function doDelete( ]); break; default: - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "branch", force ? "-D" : "-d", x.branch, diff --git a/denops/gin/action/branch_move.ts b/denops/gin/action/branch_move.ts index 3e6ae3ea..277ca2e1 100644 --- a/denops/gin/action/branch_move.ts +++ b/denops/gin/action/branch_move.ts @@ -2,7 +2,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import * as helper from "https://deno.land/x/denops_std@v5.0.1/helper/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { branch: string }; @@ -51,7 +50,7 @@ async function doMove( await helper.echoerr(denops, "Cancelled"); return; } - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "branch", ...(force ? ["--force"] : []), "--move", diff --git a/denops/gin/action/branch_new.ts b/denops/gin/action/branch_new.ts index 8806926d..3106e68c 100644 --- a/denops/gin/action/branch_new.ts +++ b/denops/gin/action/branch_new.ts @@ -2,7 +2,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import * as helper from "https://deno.land/x/denops_std@v5.0.1/helper/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { target?: string }; @@ -54,7 +53,7 @@ async function doNew( await helper.echoerr(denops, "Cancelled"); return; } - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "switch", force ? "-C" : "-c", name, @@ -76,5 +75,5 @@ async function doNewOrphan( await helper.echoerr(denops, "Cancelled"); return; } - await execBare(denops, ["switch", "--orphan", name]); + await denops.dispatch("gin", "command", "", ["switch", "--orphan", name]); } diff --git a/denops/gin/action/chaperon.ts b/denops/gin/action/chaperon.ts index 54598aab..1c2264b0 100644 --- a/denops/gin/action/chaperon.ts +++ b/denops/gin/action/chaperon.ts @@ -1,10 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { alias, define, GatherCandidates, Range } from "./core.ts"; -import { - exec as execChaperon, - ExecOptions as ExecChaperonOptions, -} from "../command/chaperon/command.ts"; export type Candidate = { path: string }; @@ -19,21 +15,21 @@ export async function init( bufnr, "chaperon:both", (denops, bufnr, range) => - doChaperon(denops, bufnr, range, {}, gatherCandidates), + doChaperon(denops, bufnr, range, [], gatherCandidates), ); await define( denops, bufnr, "chaperon:theirs", (denops, bufnr, range) => - doChaperon(denops, bufnr, range, { noOurs: true }, gatherCandidates), + doChaperon(denops, bufnr, range, ["++no-ours"], gatherCandidates), ); await define( denops, bufnr, "chaperon:ours", (denops, bufnr, range) => - doChaperon(denops, bufnr, range, { noTheirs: true }, gatherCandidates), + doChaperon(denops, bufnr, range, ["++no-theirs"], gatherCandidates), ); await alias( denops, @@ -48,14 +44,15 @@ async function doChaperon( denops: Denops, bufnr: number, range: Range, - options: ExecChaperonOptions, + extraArgs: string[], gatherCandidates: GatherCandidates, ): Promise { const xs = await gatherCandidates(denops, bufnr, range); for (const x of xs) { - await execChaperon(denops, x.path, { - opener: "tabedit", - ...options, - }); + await denops.dispatch("gin", "chaperon:command", "", "", [ + "++opener=tabedit", + ...extraArgs, + x.path, + ]); } } diff --git a/denops/gin/action/cherry_pick.ts b/denops/gin/action/cherry_pick.ts index c2137a7c..42f2fde3 100644 --- a/denops/gin/action/cherry_pick.ts +++ b/denops/gin/action/cherry_pick.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { commit: string }; @@ -47,7 +46,7 @@ async function doCherryPick( if (!x) { return; } - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "cherry-pick", ...(mainline ? [] : ["--mainline", mainline]), x.commit, diff --git a/denops/gin/action/diff.ts b/denops/gin/action/diff.ts index e6021dc5..a18dd574 100644 --- a/denops/gin/action/diff.ts +++ b/denops/gin/action/diff.ts @@ -1,10 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { alias, define, GatherCandidates, Range } from "./core.ts"; -import { - exec as execDiff, - ExecOptions as ExecDiffOptions, -} from "../command/diff/command.ts"; export type Candidate = { path: string }; @@ -26,7 +22,7 @@ export async function init( bufnr, `diff:local:${opener}`, (denops, bufnr, range) => - doDiff(denops, bufnr, range, opener, {}, gatherCandidates), + doDiff(denops, bufnr, range, opener, [], gatherCandidates), ); await define( denops, @@ -38,7 +34,7 @@ export async function init( bufnr, range, opener, - { flags: { "cached": "" } }, + ["--cached"], gatherCandidates, ), ); @@ -52,7 +48,7 @@ export async function init( bufnr, range, opener, - { commitish: "HEAD" }, + ["HEAD"], gatherCandidates, ), ); @@ -89,15 +85,16 @@ async function doDiff( bufnr: number, range: Range, opener: string, - options: ExecDiffOptions, + extraArgs: string[], gatherCandidates: GatherCandidates, ): Promise { const xs = await gatherCandidates(denops, bufnr, range); for (const x of xs) { - await execDiff(denops, { - opener, - paths: [x.path], - ...options, - }); + await denops.dispatch("gin", "diff:command", "", "", [ + `++opener=${opener}`, + ...extraArgs, + "--", + x.path, + ]); } } diff --git a/denops/gin/action/diff_smart.ts b/denops/gin/action/diff_smart.ts index 78135a66..7b4513cd 100644 --- a/denops/gin/action/diff_smart.ts +++ b/denops/gin/action/diff_smart.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { alias, define, GatherCandidates, Range } from "./core.ts"; -import { exec as execDiff } from "../command/diff/command.ts"; export type Candidate = { path: string; XY: string }; @@ -51,18 +50,18 @@ async function doDiffSmart( const xs = await gatherCandidates(denops, bufnr, range); for (const x of xs) { if (x.XY.startsWith(".")) { - await execDiff(denops, { - opener, - paths: [x.path], - }); + await denops.dispatch("gin", "diff:command", "", "", [ + `++opener=${opener}`, + "--", + x.path, + ]); } else { - await execDiff(denops, { - opener, - paths: [x.path], - flags: { - "cached": "", - }, - }); + await denops.dispatch("gin", "diff:command", "", "", [ + `++opener=${opener}`, + "--cached", + "--", + x.path, + ]); } } } diff --git a/denops/gin/action/edit.ts b/denops/gin/action/edit.ts index dd21710d..02fd51a0 100644 --- a/denops/gin/action/edit.ts +++ b/denops/gin/action/edit.ts @@ -2,10 +2,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import * as buffer from "https://deno.land/x/denops_std@v5.0.1/buffer/mod.ts"; import { alias, define, GatherCandidates, Range } from "./core.ts"; -import { - exec as execEdit, - ExecOptions as ExecEditOptions, -} from "../command/edit/command.ts"; export type Candidate = { path: string }; @@ -34,7 +30,7 @@ export async function init( bufnr, `edit:cached:${opener}`, (denops, bufnr, range) => - doEdit(denops, bufnr, range, opener, {}, gatherCandidates), + doEdit(denops, bufnr, range, opener, [], gatherCandidates), ); await define( denops, @@ -46,7 +42,7 @@ export async function init( bufnr, range, opener, - { commitish: "HEAD" }, + ["HEAD"], gatherCandidates, ), ); @@ -83,15 +79,16 @@ async function doEdit( bufnr: number, range: Range, opener: string, - options: ExecEditOptions, + extraArgs: string[], gatherCandidates: GatherCandidates, ): Promise { const xs = await gatherCandidates(denops, bufnr, range); for (const x of xs) { - await execEdit(denops, x.path, { - opener, - ...options, - }); + await denops.dispatch("gin", "edit:command", "", "", [ + `++opener=${opener}`, + ...extraArgs, + x.path, + ]); } } diff --git a/denops/gin/action/merge.ts b/denops/gin/action/merge.ts index 4164b700..9855e9b9 100644 --- a/denops/gin/action/merge.ts +++ b/denops/gin/action/merge.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { alias, define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { commit: string }; @@ -53,7 +52,7 @@ async function doMerge( if (!x) { return; } - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "merge", `--${method}`, x.commit, diff --git a/denops/gin/action/patch.ts b/denops/gin/action/patch.ts index b63e6e35..3eae1e75 100644 --- a/denops/gin/action/patch.ts +++ b/denops/gin/action/patch.ts @@ -1,10 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { alias, define, GatherCandidates, Range } from "./core.ts"; -import { - exec as execPatch, - ExecOptions as ExecPatchOptions, -} from "../command/patch/command.ts"; export type Candidate = { path: string }; @@ -19,21 +15,21 @@ export async function init( bufnr, "patch:both", (denops, bufnr, range) => - doPatch(denops, bufnr, range, {}, gatherCandidates), + doPatch(denops, bufnr, range, [], gatherCandidates), ); await define( denops, bufnr, "patch:head", (denops, bufnr, range) => - doPatch(denops, bufnr, range, { noWorktree: true }, gatherCandidates), + doPatch(denops, bufnr, range, ["++no-worktree"], gatherCandidates), ); await define( denops, bufnr, "patch:worktree", (denops, bufnr, range) => - doPatch(denops, bufnr, range, { noHead: true }, gatherCandidates), + doPatch(denops, bufnr, range, ["++no-head"], gatherCandidates), ); await alias( denops, @@ -48,14 +44,15 @@ async function doPatch( denops: Denops, bufnr: number, range: Range, - options: ExecPatchOptions, + extraArgs: string[], gatherCandidates: GatherCandidates, ): Promise { const xs = await gatherCandidates(denops, bufnr, range); for (const x of xs) { - await execPatch(denops, x.path, { - opener: "tabedit", - ...options, - }); + await denops.dispatch("gin", "patch:command", "", "", [ + `++opener=tabedit`, + ...extraArgs, + x.path, + ]); } } diff --git a/denops/gin/action/rebase.ts b/denops/gin/action/rebase.ts index 2c25f566..dc2f3377 100644 --- a/denops/gin/action/rebase.ts +++ b/denops/gin/action/rebase.ts @@ -2,7 +2,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import * as helper from "https://deno.land/x/denops_std@v5.0.1/helper/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { commit: string }; @@ -40,7 +39,7 @@ async function doRebase( if (!x) { return; } - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "rebase", x.commit, ]); @@ -60,7 +59,7 @@ async function doRebaseInteractive( // NOTE: // We must NOT await the command otherwise Vim would freeze // because command proxy could not work if we await here. - execBare(denops, [ + denops.dispatch("gin", "command", "", [ "rebase", "--interactive", x.commit, diff --git a/denops/gin/action/reset.ts b/denops/gin/action/reset.ts index 2e6894e5..a27e75a0 100644 --- a/denops/gin/action/reset.ts +++ b/denops/gin/action/reset.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { commit: string }; @@ -61,7 +60,7 @@ export async function doReset( if (!x) { return; } - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "reset", "--quiet", ...(mode ? [`--${mode}`] : []), diff --git a/denops/gin/action/reset_file.ts b/denops/gin/action/reset_file.ts index fb745696..05fadbdf 100644 --- a/denops/gin/action/reset_file.ts +++ b/denops/gin/action/reset_file.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { path: string }; @@ -28,7 +27,7 @@ export async function doResetFile( gatherCandidates: GatherCandidates, ): Promise { const xs = await gatherCandidates(denops, bufnr, range); - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "reset", "--quiet", "--", diff --git a/denops/gin/action/restore.ts b/denops/gin/action/restore.ts index d012dbd3..8a0c2c39 100644 --- a/denops/gin/action/restore.ts +++ b/denops/gin/action/restore.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { path: string }; @@ -88,7 +87,7 @@ async function doRestore( gatherCandidates: GatherCandidates, ): Promise { const xs = await gatherCandidates(denops, bufnr, range); - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "restore", "--quiet", ...extraArgs, diff --git a/denops/gin/action/revert.ts b/denops/gin/action/revert.ts index 7ecd668e..98685ca1 100644 --- a/denops/gin/action/revert.ts +++ b/denops/gin/action/revert.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { commit: string }; @@ -47,7 +46,7 @@ async function doRevert( if (!x) { return; } - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "revert", ...(mainline ? [] : ["--mainline", mainline]), x.commit, diff --git a/denops/gin/action/rm.ts b/denops/gin/action/rm.ts index cf303989..45facd42 100644 --- a/denops/gin/action/rm.ts +++ b/denops/gin/action/rm.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { path: string }; @@ -36,7 +35,7 @@ async function doRm( gatherCandidates: GatherCandidates, ): Promise { const xs = await gatherCandidates(denops, bufnr, range); - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "rm", "--quiet", "--ignore-unmatch", diff --git a/denops/gin/action/show.ts b/denops/gin/action/show.ts index a8197d06..c09349ea 100644 --- a/denops/gin/action/show.ts +++ b/denops/gin/action/show.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { alias, define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBuffer } from "../command/buffer/command.ts"; export type Candidate = { commit: string }; @@ -58,9 +57,11 @@ async function doShow( ): Promise { const xs = await gatherCandidates(denops, bufnr, range); for (const x of xs) { - await execBuffer(denops, ["show", x.commit], { - opener, - emojify, - }); + await denops.dispatch("gin", "buffer:command", "", "", [ + `++opener=${opener}`, + ...(emojify ? [`++emojify`] : []), + "show", + x.commit, + ]); } } diff --git a/denops/gin/action/stage.ts b/denops/gin/action/stage.ts index 585ef082..cd6efe5f 100644 --- a/denops/gin/action/stage.ts +++ b/denops/gin/action/stage.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; import { doResetFile } from "./reset_file.ts"; export type Candidate = { path: string; XY: string }; @@ -52,7 +51,7 @@ async function doStage( const xsRemoved = xs.filter((x) => x.XY.endsWith("D")); const xsOthers = xs.filter((x) => !x.XY.endsWith(".") && !x.XY.endsWith("D")); if (xsRemoved.length) { - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "rm", "--quiet", "--ignore-unmatch", @@ -62,7 +61,7 @@ async function doStage( ]); } if (xsOthers.length) { - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "add", "--ignore-errors", "--force", @@ -83,7 +82,7 @@ async function doStageIntentToAdd( const xsRemoved = xs.filter((x) => x.XY.endsWith("D")); const xsOthers = xs.filter((x) => x.XY !== "??" && !x.XY.endsWith("D")); if (xsUnknown.length) { - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "add", "--ignore-errors", "--force", @@ -93,7 +92,7 @@ async function doStageIntentToAdd( ]); } if (xsRemoved.length) { - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "rm", "--quiet", "--ignore-unmatch", @@ -103,7 +102,7 @@ async function doStageIntentToAdd( ]); } if (xsOthers.length) { - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "add", "--ignore-errors", "--force", @@ -123,13 +122,13 @@ async function doUnstageIntentToAdd( const xsAdded = xs.filter((x) => x.XY === "A."); const xsOthers = xs.filter((x) => x.XY !== "A."); if (xsAdded.length) { - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "reset", "--quiet", "--", ...xsAdded.map((x) => x.path), ]); - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "add", "--ignore-errors", "--force", @@ -139,7 +138,7 @@ async function doUnstageIntentToAdd( ]); } if (xsOthers.length) { - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "reset", "--quiet", "--", diff --git a/denops/gin/action/stash.ts b/denops/gin/action/stash.ts index 74a18a88..c5bd9180 100644 --- a/denops/gin/action/stash.ts +++ b/denops/gin/action/stash.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { path: string }; @@ -36,7 +35,7 @@ async function doStash( gatherCandidates: GatherCandidates, ): Promise { const xs = await gatherCandidates(denops, bufnr, range); - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "stash", "push", "--all", diff --git a/denops/gin/action/switch.ts b/denops/gin/action/switch.ts index 71d2ecf4..3627806a 100644 --- a/denops/gin/action/switch.ts +++ b/denops/gin/action/switch.ts @@ -1,7 +1,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import { define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { target: string }; @@ -40,5 +39,9 @@ async function doSwitch( if (!x) { return; } - await execBare(denops, ["switch", ...extraArgs, x.target]); + await denops.dispatch("gin", "command", "", [ + "switch", + ...extraArgs, + x.target, + ]); } diff --git a/denops/gin/action/tag.ts b/denops/gin/action/tag.ts index fc14e925..3e000e7e 100644 --- a/denops/gin/action/tag.ts +++ b/denops/gin/action/tag.ts @@ -2,7 +2,6 @@ import type { Denops } from "https://deno.land/x/denops_std@v5.0.1/mod.ts"; import * as batch from "https://deno.land/x/denops_std@v5.0.1/batch/mod.ts"; import * as helper from "https://deno.land/x/denops_std@v5.0.1/helper/mod.ts"; import { alias, define, GatherCandidates, Range } from "./core.ts"; -import { exec as execBare } from "../command/bare/command.ts"; export type Candidate = { commit: string }; @@ -81,7 +80,7 @@ async function doTag( await helper.echo(denops, "Cancelled"); return; } - await execBare(denops, [ + await denops.dispatch("gin", "command", "", [ "tag", ...(annotate ? ["--annotate"] : []), ...(sign ? ["--sign"] : []),