command to update Kiss-VSCode

This commit is contained in:
2021-10-21 11:42:14 -04:00
parent d36555c603
commit e88dd2a098
2 changed files with 30 additions and 1 deletions

View File

@@ -239,6 +239,7 @@
(registerCommand description (lambda :Void [&opt _] (executeCommand command))))
(loadFrom "kiss-vscode" "src/commands/KissTools.kiss")
(loadFrom "kiss-vscode" "src/commands/ExtensionTools.kiss")
(function :Void registerBuiltins []
(set Prelude.printStr ->:Void s (infoMessage s))
@@ -248,7 +249,10 @@
(registerCommand "[K]iss: Run a keyboard [s]hortcut command" runKeyboardShortcut)
// KissTools.kiss:
(registerCommand "[K]iss: [e]valuate and print an expression" evalAndPrint)
(registerCommand "[K]iss: create [n]ew kiss class" newKissClass))
(registerCommand "[K]iss: create [n]ew kiss class" newKissClass)
// ExtensionTools.kiss:
(registerCommand "[K]iss: [u]pdate Kiss-VSCode" updateKissVscode)
(registerCommand "[K]iss: [t]est and [u]pdate Kiss-VSCode" updateKissVscode))
// TODO standardize this with KissInterp
(function :Void prepareInterp []

View File

@@ -0,0 +1,25 @@
(loadFrom "kiss-vscode" "src/Util.kiss")
(function kvLibpath [] (.trim (assertProcess "haxelib" ["libpath" "kiss-vscode"])))
(function :ChildProcessSpawnSyncOptions options [] (object cwd (let [path (kvLibpath)] (path.substr 0 (- path.length 1)))))
(function handleUpdateFailure [error]
(errorMessage "Error updating Kiss-VSCode: $error")
(throw error))
(function :Void updateKissVscode [&opt _]
(trySpawnSync "haxe" ["build.hxml"] (options) handleUpdateFailure)
(if (= "Windows" (Sys.systemName))
(trySpawnSync "cmd.exe" ["/c" "vsce" "package"] (options) handleUpdateFailure)
(trySpawnSync "vsce" ["package"] (options) handleUpdateFailure))
(awaitLet [_ (executeCommand
"workbench.extensions.command.installFromVSIX"
(Uri.file (joinPath (kvLibpath) (last (filter (FileSystem.readDirectory (kvLibpath)) ->file (file.endsWith ".vsix"))))))]
(catch [error]
(handleUpdateFailure error)))
{})
(function testAndUpdateKissVscode [&opt _]
(trySpawnSync "test.sh" [] (options) handleUpdateFailure)
(updateKissVscode))