Преглед изворни кода

improve(plugin): export api of exec_git_command

charlie пре 3 година
родитељ
комит
42fca338ec
2 измењених фајлова са 12 додато и 0 уклоњено
  1. 6 0
      libs/src/LSPlugin.ts
  2. 6 0
      src/main/logseq/api.cljs

+ 6 - 0
libs/src/LSPlugin.ts

@@ -278,6 +278,12 @@ export interface IAppProxy {
   quit: () => Promise<void>
   openExternalLink: (url: string) => Promise<void>
 
+  /**
+   * @link https://github.com/desktop/dugite/blob/master/docs/api/exec.md
+   * @param args
+   */
+  execGitCommand: (args: string[]) => Promise<string>
+
   // graph
   getCurrentGraph: () => Promise<AppGraphInfo | null>
 

+ 6 - 0
src/main/logseq/api.cljs

@@ -35,6 +35,7 @@
             [promesa.core :as p]
             [reitit.frontend.easy :as rfe]
             [sci.core :as sci]
+            [frontend.handler.shell :as shell]
             [frontend.modules.layout.core]))
 
 ;; helpers
@@ -615,6 +616,11 @@
   (when-let [repo (state/get-current-repo)]
     (export-handler/export-repo-as-zip! repo)))
 
+(defn ^:export exec_git_command
+  [^js args]
+  (when-let [args (and args (seq (bean/->clj args)))]
+    (shell/run-git-command! args)))
+
 ;; helpers
 (defn ^:export show_msg
   ([content] (show_msg content :success))