Skip to content

Commit

Permalink
Merge branch 'main' into feat/parse_legacy_file
Browse files Browse the repository at this point in the history
  • Loading branch information
aooohan authored Apr 11, 2024
2 parents 1bbc213 + 1c2bbaf commit 83099bc
Show file tree
Hide file tree
Showing 38 changed files with 204 additions and 2,314 deletions.
5 changes: 2 additions & 3 deletions cmd/commands/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package commands

import (
"fmt"
"github.com/urfave/cli/v2"
"github.com/version-fox/vfox/internal"
"strings"
Expand Down Expand Up @@ -51,9 +50,9 @@ func installCmd(ctx *cli.Context) error {
name = strings.ToLower(argArr[0])
version = ""
}
source, err := manager.LookupSdk(name)
source, err := manager.LookupSdkWithInstall(name)
if err != nil {
return fmt.Errorf("%s not supported, error: %w", name, err)
return err
}
return source.Install(version)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/commands/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func searchCmd(ctx *cli.Context) error {
}
manager := internal.NewSdkManager()
defer manager.Close()
source, err := manager.LookupSdk(sdkName)
source, err := manager.LookupSdkWithInstall(sdkName)
if err != nil {
return fmt.Errorf("%s not supported, error: %w", sdkName, err)
}
Expand Down
42 changes: 34 additions & 8 deletions cmd/commands/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,49 @@
package commands

import (
"fmt"

"github.com/pterm/pterm"
"github.com/urfave/cli/v2"
"github.com/version-fox/vfox/internal"
)

const allFlag = "all"

var Update = &cli.Command{
Name: "update",
Usage: "update specified plug-ins",
Name: "update",
Usage: "update specified plug-ins, --all/-a to update all installed plug-ins",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: allFlag,
Aliases: []string{"a"},
Usage: "all plugins flag",
},
},
Action: updateCmd,
}

func updateCmd(ctx *cli.Context) error {
args := ctx.Args()
l := args.Len()
if l < 1 {
return cli.Exit("invalid arguments", 1)
}
manager := internal.NewSdkManager()
defer manager.Close()
return manager.Update(args.First())
if ctx.Bool(allFlag) {
if sdks, err := manager.LoadAllSdk(); err == nil {
for sdk := range sdks {
if err = manager.Update(sdk); err != nil {
pterm.Println(fmt.Sprintf("update plugin(%s) failed, %s", sdk, err.Error()))
}
}
} else {
return cli.Exit(err.Error(), 1)
}
} else {
args := ctx.Args()
l := args.Len()
if l < 1 {
return cli.Exit("invalid arguments", 1)
}

return manager.Update(args.First())
}
return nil
}
1 change: 0 additions & 1 deletion docs/.vitepress/cache/deps/@theme_index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/.vitepress/cache/deps/@theme_index.js.map

Large diffs are not rendered by default.

29 changes: 10 additions & 19 deletions docs/.vitepress/cache/deps/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,49 @@
{
"hash": "c44299a9",
"hash": "96004987",
"configHash": "b25d5b92",
"lockfileHash": "eff6125a",
"browserHash": "4861eb3f",
"lockfileHash": "16b0c1ce",
"browserHash": "204f4453",
"optimized": {
"vue": {
"src": "../../../node_modules/vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "d1bb3707",
"fileHash": "68d2c152",
"needsInterop": false
},
"vitepress > @vue/devtools-api": {
"src": "../../../node_modules/@vue/devtools-api/dist/index.js",
"file": "vitepress___@vue_devtools-api.js",
"fileHash": "c819d541",
"fileHash": "0e500d10",
"needsInterop": false
},
"vitepress > @vueuse/core": {
"src": "../../../node_modules/@vueuse/core/index.mjs",
"file": "vitepress___@vueuse_core.js",
"fileHash": "d3a2931b",
"fileHash": "340cba74",
"needsInterop": false
},
"vitepress > @vueuse/integrations/useFocusTrap": {
"src": "../../../node_modules/@vueuse/integrations/useFocusTrap.mjs",
"file": "vitepress___@vueuse_integrations_useFocusTrap.js",
"fileHash": "5acf36a8",
"fileHash": "ed87f9b6",
"needsInterop": false
},
"vitepress > mark.js/src/vanilla.js": {
"src": "../../../node_modules/mark.js/src/vanilla.js",
"file": "vitepress___mark__js_src_vanilla__js.js",
"fileHash": "763a016f",
"fileHash": "664db382",
"needsInterop": false
},
"vitepress > minisearch": {
"src": "../../../node_modules/minisearch/dist/es/index.js",
"file": "vitepress___minisearch.js",
"fileHash": "20b60ae3",
"fileHash": "c3ca8272",
"needsInterop": false
},
"@theme/index": {
"src": "../../../node_modules/vitepress/dist/client/theme-default/index.js",
"file": "@theme_index.js",
"fileHash": "425c8599",
"needsInterop": false
},
"axios": {
"src": "../../../node_modules/axios/index.js",
"file": "axios.js",
"fileHash": "f47f47ab",
"fileHash": "e89a1f77",
"needsInterop": false
}
},
Expand All @@ -59,9 +53,6 @@
},
"chunk-Z6B2QTD3": {
"file": "chunk-Z6B2QTD3.js"
},
"chunk-CSAU5B4Q": {
"file": "chunk-CSAU5B4Q.js"
}
}
}
Loading

0 comments on commit 83099bc

Please sign in to comment.