From 555ad7abca8064462b4acc7c78ee30b4559491a1 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Wed, 24 Jul 2024 01:10:34 +0800 Subject: [PATCH] docs: fix typos Found via `typos --hidden --format brief` --- cmd/commands/activate.go | 2 +- cmd/commands/env.go | 4 ++-- docs/guides/faq.md | 2 +- docs/guides/intro.md | 4 ++-- docs/misc/vs-asdf.md | 2 +- docs/plugins/create/howto_registry.md | 2 +- docs/public/{performence.png => performance.png} | Bin docs/usage/all-commands.md | 2 +- docs/zh-hans/guides/faq.md | 2 +- docs/zh-hans/guides/intro.md | 4 ++-- docs/zh-hans/misc/vs-asdf.md | 2 +- docs/zh-hans/plugins/create/howto_registry.md | 2 +- docs/zh-hans/usage/all-commands.md | 2 +- internal/manager.go | 4 ++-- internal/plugin.go | 2 +- internal/shim/shim_windows.go | 8 ++++---- internal/util/{verison.go => version.go} | 0 17 files changed, 22 insertions(+), 22 deletions(-) rename docs/public/{performence.png => performance.png} (100%) rename internal/util/{verison.go => version.go} (100%) diff --git a/cmd/commands/activate.go b/cmd/commands/activate.go index 8c7c3747..7d05e1b4 100644 --- a/cmd/commands/activate.go +++ b/cmd/commands/activate.go @@ -88,7 +88,7 @@ func activateCmd(ctx *cli.Context) error { path = strings.Replace(path, "\\", "/", -1) s := shell.NewShell(name) if s == nil { - return fmt.Errorf("unknow target shell %s", name) + return fmt.Errorf("unknown target shell %s", name) } exportStr := s.Export(exportEnvs) str, err := s.Activate() diff --git a/cmd/commands/env.go b/cmd/commands/env.go index 9962919a..2920e95a 100644 --- a/cmd/commands/env.go +++ b/cmd/commands/env.go @@ -116,7 +116,7 @@ func envFlag(ctx *cli.Context) error { } s := shell.NewShell(shellName) if s == nil { - return fmt.Errorf("unknow target shell %s", shellName) + return fmt.Errorf("unknown target shell %s", shellName) } manager := internal.NewSdkManager() defer manager.Close() @@ -181,7 +181,7 @@ func aggregateEnvKeys(manager *internal.Manager) (internal.SdkEnvs, error) { if lookupSdk, err := manager.LookupSdk(name); err == nil { vv, ok := flushCache.Get(name) if ok && string(vv) == version { - logger.Debugf("Hit cache, skip flush envrionment, %s@%s\n", name, version) + logger.Debugf("Hit cache, skip flush environment, %s@%s\n", name, version) return true } else { logger.Debugf("No hit cache, name: %s cache: %s, expected: %s \n", name, string(vv), version) diff --git a/docs/guides/faq.md b/docs/guides/faq.md index 6dc76128..4c25eef8 100644 --- a/docs/guides/faq.md +++ b/docs/guides/faq.md @@ -13,7 +13,7 @@ Only one situation will cause this, that is, you have used the SDK globally (`vf operate the registry and write the SDK's `PATH` into the user environment variable (for the purpose of, **Shell that does not support Hook function** can also use SDK, such as `CMD`). -But because of the existence of the `.tool-versions` mechanism, the `PATH` becomes the sum of `.tool-verions` and the user +But because of the existence of the `.tool-versions` mechanism, the `PATH` becomes the sum of `.tool-versions` and the user environment variable `PATH`. ::: warning diff --git a/docs/guides/intro.md b/docs/guides/intro.md index bd5c06e7..73f512ec 100644 --- a/docs/guides/intro.md +++ b/docs/guides/intro.md @@ -49,8 +49,8 @@ through a simple plugin interface. #### [vfox](https://github.com/version-fox/vfox) -![pluigns](https://contrib.rocks/image?repo=version-fox/vfox) +![plugins](https://contrib.rocks/image?repo=version-fox/vfox) #### [Public Registry](https://github.com/version-fox/vfox-plugins) -![pluigns](https://contrib.rocks/image?repo=version-fox/vfox-plugins)) +![plugins](https://contrib.rocks/image?repo=version-fox/vfox-plugins)) diff --git a/docs/misc/vs-asdf.md b/docs/misc/vs-asdf.md index 17ed9d9f..ce41455e 100644 --- a/docs/misc/vs-asdf.md +++ b/docs/misc/vs-asdf.md @@ -18,7 +18,7 @@ But `vfox` has the following advantages: ## Performance comparison -![performence.png](/performence.png) +![performance.png](/performance.png) The above figure is a benchmark test of the two tools' most core functions. It will be found that `vfox` is about **5 times** faster than `asdf-vm`! diff --git a/docs/plugins/create/howto_registry.md b/docs/plugins/create/howto_registry.md index efa0b292..3765d0f2 100644 --- a/docs/plugins/create/howto_registry.md +++ b/docs/plugins/create/howto_registry.md @@ -24,7 +24,7 @@ The registry is mainly divided into two parts: The repository will automatically retrieve the latest version information of the plugin and verify the availability of the plugin through the information in `sources` at regular intervals (every hour), -and store the obtained `manfiest` information in the `plugins` directory. +and store the obtained `manifest` information in the `plugins` directory. ::: tip Registry address `vfox` will default to retrieve plugins from [vfox-plugins.lhan.me](https://vfox-plugins.lhan.me). diff --git a/docs/public/performence.png b/docs/public/performance.png similarity index 100% rename from docs/public/performence.png rename to docs/public/performance.png diff --git a/docs/usage/all-commands.md b/docs/usage/all-commands.md index 2259dfb9..284824f6 100644 --- a/docs/usage/all-commands.md +++ b/docs/usage/all-commands.md @@ -3,7 +3,7 @@ ```shell vfox - vfox is a tool for runtime version management. vfox available List all available plugins -vfox add [--alias --source ] Add a plugin or plugins from offical repository or custom source, --alias` and `--source` are not supported when adding multiple plugins. +vfox add [--alias --source ] Add a plugin or plugins from official repository or custom source, --alias` and `--source` are not supported when adding multiple plugins. vfox remove Remove a plugin vfox update [ | --all] Update a specified or all plugin(s) vfox info Show plugin info diff --git a/docs/zh-hans/guides/faq.md b/docs/zh-hans/guides/faq.md index f61d30e2..3b946ea5 100644 --- a/docs/zh-hans/guides/faq.md +++ b/docs/zh-hans/guides/faq.md @@ -13,7 +13,7 @@ 只有一种情况下会出现这种情况, 就是你全局(`vfox use -g`)使用过SDK, 这个时候`vfox`会操作注册表,将SDK的`PATH`写入用户环境变量当中(为的是, **不支持Hook功能**的Shell也能使用SDK, 例如`CMD`)。 -但是因为`.tool-versions`机制的存在, 所以`PATH`就变成了`.tool-verions` + 用户环境变量`PATH`两部分组成。 +但是因为`.tool-versions`机制的存在, 所以`PATH`就变成了`.tool-versions` + 用户环境变量`PATH`两部分组成。 ::: warning 同一个SDK**最多重复两条**, 不会无限重复。如果>2次, 请反馈给我们。 diff --git a/docs/zh-hans/guides/intro.md b/docs/zh-hans/guides/intro.md index 742cfca6..dea29a59 100644 --- a/docs/zh-hans/guides/intro.md +++ b/docs/zh-hans/guides/intro.md @@ -44,8 +44,8 @@ API、配置文件和实现方式(比如,`$PATH` #### [核心仓库](https://github.com/version-fox/vfox) -![pluigns](https://contrib.rocks/image?repo=version-fox/vfox) +![plugins](https://contrib.rocks/image?repo=version-fox/vfox) #### [插件仓库](https://github.com/version-fox/vfox-plugins) -![pluigns](https://contrib.rocks/image?repo=version-fox/vfox-plugins)) +![plugins](https://contrib.rocks/image?repo=version-fox/vfox-plugins)) diff --git a/docs/zh-hans/misc/vs-asdf.md b/docs/zh-hans/misc/vs-asdf.md index 6e377e1c..7dfce488 100644 --- a/docs/zh-hans/misc/vs-asdf.md +++ b/docs/zh-hans/misc/vs-asdf.md @@ -19,7 +19,7 @@ ## 性能对比 -![performence.png](/performence.png) +![performance.png](/performance.png) 上图是对两个工具最核心的功能进行基准测试, 会发现[vfox](https://github.com/version-fox/vfox)大约比`asdf-vm`快**5倍**! diff --git a/docs/zh-hans/plugins/create/howto_registry.md b/docs/zh-hans/plugins/create/howto_registry.md index f6429481..047f0c3d 100644 --- a/docs/zh-hans/plugins/create/howto_registry.md +++ b/docs/zh-hans/plugins/create/howto_registry.md @@ -17,7 +17,7 @@ - `plugins`: 用于存放插件的`manifest.json`文件, 以插件短名为文件名。例如`nodejs.json` - `sources`: 用于存放插件的数据源信息, 以插件短名为文件名。例如`nodejs.json` -仓库将会自动定时(间隔一小时)通过`sources`中的信息检索插件的最新版本信息以及校验插件可用性, 并将获取的`manfiest`信息存放在`plugins`目录下。 +仓库将会自动定时(间隔一小时)通过`sources`中的信息检索插件的最新版本信息以及校验插件可用性, 并将获取的`manifest`信息存放在`plugins`目录下。 ::: tip 仓库地址 diff --git a/docs/zh-hans/usage/all-commands.md b/docs/zh-hans/usage/all-commands.md index c8a80f81..1fb0ddd7 100644 --- a/docs/zh-hans/usage/all-commands.md +++ b/docs/zh-hans/usage/all-commands.md @@ -3,7 +3,7 @@ ```shell vfox - vfox is a tool for runtime version management. vfox available List all available plugins -vfox add [--alias --source ] Add a plugin or plugins from offical repository or custom source, `--alias` and `--source` are not supported when adding multiple plugins. +vfox add [--alias --source ] Add a plugin or plugins from official repository or custom source, `--alias` and `--source` are not supported when adding multiple plugins. vfox remove Remove a plugin vfox update [ | --all] Update a specified or all plugin(s) vfox info Show plugin info diff --git a/internal/manager.go b/internal/manager.go index 6d4e9e05..269ce4bf 100644 --- a/internal/manager.go +++ b/internal/manager.go @@ -345,7 +345,7 @@ func (m *Manager) fetchPluginManifest(url string) (*RegistryPluginManifest, erro } body, err := io.ReadAll(resp.Body) if err != nil { - return nil, fmt.Errorf("fetch manfiest error: %w", err) + return nil, fmt.Errorf("fetch manifest error: %w", err) } var plugin RegistryPluginManifest if err = json.Unmarshal(body, &plugin); err != nil { @@ -492,7 +492,7 @@ func (m *Manager) Add(pluginName, url, alias string) error { func (m *Manager) installPluginToTemp(path string) (*LuaPlugin, error) { ext := filepath.Ext(path) if ext != ".lua" && ext != ".zip" { - return nil, fmt.Errorf("unsupported %s type plugin to install, only supoort .lua or .zip", ext) + return nil, fmt.Errorf("unsupported %s type plugin to install, only support .lua or .zip", ext) } localPath := path // remote file, download it first to local file. diff --git a/internal/plugin.go b/internal/plugin.go index 55b02c83..e10ad4d9 100644 --- a/internal/plugin.go +++ b/internal/plugin.go @@ -471,7 +471,7 @@ func NewLuaPlugin(pluginDirPath string, manager *Manager) (*LuaPlugin, error) { } if err := vm.Instance.DoFile(metadataPath); err != nil { - return nil, fmt.Errorf("failed to load meatadata file, %w", err) + return nil, fmt.Errorf("failed to load metadata file, %w", err) } // load hook func files diff --git a/internal/shim/shim_windows.go b/internal/shim/shim_windows.go index 90b5f180..bb51067c 100644 --- a/internal/shim/shim_windows.go +++ b/internal/shim/shim_windows.go @@ -84,24 +84,24 @@ func (s *Shim) Generate() error { ext := filepath.Ext(filename) if ext == ".cmd" { if err = os.WriteFile(targetPath, []byte(fmt.Sprintf(cmdShimContent, s.BinaryPath)), stat.Mode()); err != nil { - return fmt.Errorf("failed to gnerate shim: %w", err) + return fmt.Errorf("failed to generate shim: %w", err) } return nil } else if ext == ".ps1" { if err = os.WriteFile(targetPath, []byte(fmt.Sprintf(ps1ShimContent, s.BinaryPath)), stat.Mode()); err != nil { - return fmt.Errorf("failed to gnerate shim: %w", err) + return fmt.Errorf("failed to generate shim: %w", err) } return nil } logger.Debugf("Write shim binary to %s", targetPath) if err = os.WriteFile(targetPath, shim, stat.Mode()); err != nil { - return fmt.Errorf("failed to gnerate shim: %w", err) + return fmt.Errorf("failed to generate shim: %w", err) } shimName := filename[:len(filename)-len(ext)] + ".shim" shimFile := filepath.Join(s.OutputPath, shimName) logger.Debugf("Write shim file to %s", shimFile) if err = os.WriteFile(shimFile, []byte(fmt.Sprintf(shimFileContent, s.BinaryPath)), stat.Mode()); err != nil { - return fmt.Errorf("failed to gnerate shim: %w", err) + return fmt.Errorf("failed to generate shim: %w", err) } return nil } diff --git a/internal/util/verison.go b/internal/util/version.go similarity index 100% rename from internal/util/verison.go rename to internal/util/version.go