Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
moqsien committed Jun 15, 2024
1 parent 4306fbd commit b058b02
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 34 deletions.
48 changes: 33 additions & 15 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,64 @@

### 1. How to use?

See help inof with **vmr -h**.
See help info for subcommand with **vmr subcommand -h**.
- Open TUI for VMR with **vmr**.
- See help inof with **vmr -h**.
- See help info for subcommand with **vmr subcommand -h**.

### 2. How to change installation path for SDKs after installation?

You can edit the config file **$HOME/.vmr/config.toml**.

### 3. Why download SDK fails?
### 3. Where are the envs restored for Unix-like systems?

Try to set the **reverse proxy**.
```bash
$HOME/.vmr/vmr.sh or $HOME/.vmr/vmr.fish
```

### 4. Is it safe to use **VMR**?
### 4. Why download SDK fails? Why No SDK Found?

Of course. All the SDKs are downloaded from the official websites or github releases. You can check the version info [here](https://github.com/gvcgo/vsources).
Lots of resources required by VMR are from github, which seems to be blocked in China. Solutions are:

- Set your own proxy with command **vmr sp "http://localhost:xxx or socks5://localhost:xxx"**.
- Set reverse proxy provided by VMR with command **vmr sr "https://gvc.1710717.xyz/proxy/"**.
- For SDKs using conda, you can set other mirrors instead of the official one, such as [tsinghua](https://mirror.tuna.tsinghua.edu.cn/help/anaconda/?eqid=b45767b90013072c00000005649051db).

### 5. Where does **VMR** store the envs for SDKs?
if a proxy or reverse proxy is added, and VMR still respond slowly, you can try to modify the **VersionHostUrl** as **https://gitee.com/moqsien/vsources/raw/main** in config file of VMR.

In **$HOME/.vm/vmr.sh** or **$HOME/.vmr/vmr.fish**.

### 6. What is reverse proxy?
### 5. What is reverse proxy?

**https://gvc.1710717.xyz/proxy/** is deployed on CloudFlare for github accelerations. It's totally free.

You can also deploy your own reverse proxy according to this [repo](https://github.com/gaboolic/cloudflare-reverse-proxy).

### 6. What are Session Mode and Global Mode?

They are the ways how an SDK is installed or used.

- For Session Mode, a new terminal session is opened, and envs are added to this session without saving to any files. When the session is closed, these envs become invalid.
- For Global Mode, envs are added to related files and will take effect for all new terminal sessions.

You need to keep an eye on the **key map** hints in TUI of VMR for these modes.

### 7. How to lock the SDK version for a project? And how is it implemented?

In the **TUI** of VMR, there is a region for showing key bindings, you'll find somthing like **lock version** there.

Press the key that binds to version-locking, and you'll find a file named **.vmr.lock** is generated for current project.
**VMR** hooks the **cd** command for bash/zsh/fish/powershell. When using **cd** in terminal, the hook will be executed, and the command **vmr use -E** is called.

### 8. After the installation of an SDK,how should I found the related command?

**VMR** do not open new terminal session by default, so, you need to use **source** command to refresh the envs for current terminal. On windows, **VMR** also customized the **source** command for users. It is integrated to the powershell config file during the installation process of **VMR**. And you can use **source** to refresh **PATH** env in any powershell session.
**VMR** do not open new terminal session by default, so, you need to use **source** command to refresh the envs for current terminal.

On windows, **VMR** also customized the **source** command for users. It is integrated to the powershell config file during the installation process of **VMR**. And you can use **source** to refresh **PATH** env in any powershell session.

### 9. Why some of the SDKs on Windows can not run properly?

For example, agg, php, etc. It may be caused by lacking of **Microsoft Visual C++ Redistributable**. You can download it from [here](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170).

### 10. What are Session Mode or Global Mode?

![session_mode](https://cdn.jsdelivr.net/gh/moqsien/conf_backup@main/session_mode.png
)
1. Global Mode: Add envs to **$HOME/.vmr/vmr.sh** or **$HOME/.vmr/vmr.fish**.
2. Session Mode: Add envs only to current new session, **no persistent storage**.
### 10. Is it safe to use **VMR**?

Of course. All the SDKs are downloaded from the official websites or github releases. You can check the version info [here](https://github.com/gvcgo/vsources).
16 changes: 16 additions & 0 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,28 @@ Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
$HOME/.vmr/
```

### Where are envs restored on Unix-like systems?

```bash
$HOME/.vmr/vmr.sh 或 $HOME/.vmr/vmr.fish
```

### Can I customize the installation Dir for SDKs?

Of course. When you are installing VMR for the first time, a hint will prompt asking for customizing your **SDK Installation Dir**, you can just enter the path you want. If you've just input a wrong path, you can manually modify it in **$HOME/.vmr/config.toml**.

![installation](https://cdn.jsdelivr.net/gh/moqsien/img_repo@main/vmr_install_dir.png)

### How to use TUI?

```bash
vmr
```

### Why "No SDK Found"?

You need to set a proxy or reverse proxy, see [here](https://gvcgo.github.io/vdocs/#/usage?id=set-a-proxy).

## Update VMR
### Method 1

Expand Down
53 changes: 34 additions & 19 deletions docs/zh-cn/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,63 @@

### 1. 如何使用?

使用**vmr -h**查看帮助信息。
使用**vmr subcommand -h**查看子命令帮助信息。
- 使用**vmr**命令打开TUI,TUI界面有丰富的按键提示(key map),很简单的英文,注意查看。
- 使用**vmr -h**命令查看帮助信息。
- 使用**vmr subcommand -h**命令查看子命令帮助信息。

### 2. 安装之后如何设置SDK安装目录?

编辑配置文件$HOME/.vmr/config.toml。

### 3. 为什么下载失败?

- 请检查是否设置了反向代理(reverse proxy)。如果添加了反向代理,获取**SDK列表**时仍然比较慢,你也可以在vmr的配置文件中设置**VersionHostUrl****https://gitee.com/moqsien/vsources/raw/main**。
### 3. Unix-like操作系统下,环境变量存放在什么地方?

```bash
$HOME/.vmr/vmr.sh 或者 $HOME/.vmr/vmr.fish
```

### 4. 为什么下载失败?为什么不显示SDK列表?

VMR的很多资源,包括版本信息仓库和VMR安装包,都来自github,而国内github访问受限,导致下载速度慢。解决方法如下:

- 使用**vmr sp "http://localhost:xxx or socks5://localhost:xxx"** 设置你自己的代理。
- 使用**vmr sr "https://gvc.1710717.xyz/proxy/"** 设置VMR提供的反向代理,加速github相关的下载。
- 对于依赖于conda的SDK,为了加速安装,可以配置国内的conda源,例如[清华源](https://mirror.tuna.tsinghua.edu.cn/help/anaconda/?eqid=b45767b90013072c00000005649051db)

### 4. 下载源安全吗?
如果添加了代理,获取**SDK列表**时仍然比较慢,你也可以在vmr的配置文件中设置**VersionHostUrl****https://gitee.com/moqsien/vsources/raw/main**。

安全。所有资源均来自各种SDK的官方下载链接或者github仓库的release。
你可以在 [这里](https://github.com/gvcgo/vsources) 查看所有的版本SDK信息,包括具体SDK的下载地址。
### 5. 什么是反向代理?

### 5. MacOS/Linux下,环境变量放在什么地方?
**https://gvc.1710717.xyz/proxy/** 是一个部署在CloudFlare上的反向转发代理,主要用于加速github的国内访问。但是限制了只能访问VMR相关的内容。完全免费。

在$HOME/.vmr/vmr.sh或$HOME/.vmr/vmr.fish者中,然后在.bashrc或者.zshrc中进行引用。这样可以保证.bashrc或者.zshrc的整洁
你也可以参考[这个项目](https://github.com/gaboolic/cloudflare-reverse-proxy)来部署自己的反向代理,然后给到VMR使用,这样可以大大降低公用反向代理的压力

### 6. 什么是反向代理?

**https://gvc.1710717.xyz/proxy/** 是一个部署在CloudFlare上的反向转发代理,主要用于加速github的国内访问。但是限制了只能访问VMR相关的内容。完全免费。你也可以参考[这个项目](https://github.com/gaboolic/cloudflare-reverse-proxy)来部署自己的反向代理,然后给到VMR使用,这样可以大大降低公用反向代理的压力。
### 6. 什么是Session模式和Global模式?

指的是安装或者使用某个SDK的方式。
- Session模式下,VMR不会自动持久化相关环境变量到文件中,而是打开一个新的终端Session,将相关SDK的环境变量临时添加到这个Session中,当Session关闭之后,环境变量会自动失效。
- Global模式下,VMR会自动持久化环境变量到文件中,这样的环境变量才是永久有效的。

**在安装、切换SDK版本时,注意key map中的提示,根据自己的需要,选择Session或者Global模式**

### 7. 如何针对项目锁定SDK版本?实现原理是什么?

在VMR的**TUI**中,区域2是按键功能提示区,留意看一下,会发现有提示lock version的按键,即可针对当前项目锁定选择的SDK版本,锁定版本之后,会在当前项目下生成一个叫做 **.vmr.lock** 的文件。该文件支持对同一个项目,锁定多个SDK的版本。比如,你可以同时锁定python和node的版本等等。
在VMR的**TUI**中,key map按键功能提示区,留意看一下,会发现有提示lock version的按键,即可针对当前项目锁定选择的SDK版本,锁定版本之后,会在当前项目下生成一个叫做 **.vmr.lock** 的文件。该文件支持对同一个项目,锁定多个SDK的版本。比如,你可以同时锁定python和node的版本等等。

锁定版本的原理是,在bash/zsh/fish/powershell中,VMR分别配置了cd命令的hook,当在终端使用cd命令切换目录时,就会执行到该hook,该hook又会调用**vmr use -E**命令,从而检查当前目录是否在某个锁定版本的项目之中,然后打开新的终端session,临时切换版本。至于**vmr use -E**命令,用户无需关心。

### 8. 安装一个SDK之后,当前终端没有找到相关命令?

**VMR**默认不打开新的终端session,所以你需要使用source命令刷新一下环境变量。另外,**VMR**也为Windows用户贴心地提供了**source**命令,在**VMR**安装过程中就已经集成到系统powershell配置文件中,所以Windows用户也能愉快地使用source命令刷新PATH环境变量了。
**VMR**默认不打开新的终端session,所以你需要使用source命令刷新一下环境变量。

另外,**VMR**也为Windows用户贴心地提供了**source**命令,在**VMR**安装过程中就已经集成到系统powershell配置文件中,所以Windows用户也能愉快地使用source命令刷新PATH环境变量了。

### 9. 为啥部分Windows下的SDK无法运行
### 9. 为什么Windows下的一部分SDK无法运行

例如,Windows下的agg, php等等。可能是缺少**Microsoft Visual C++ Redistributable**,可以到官网[下载](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170)安装。

### 10. 什么是Session模式和Global模式?
### 10. 下载源安全吗?

![session_mode](https://cdn.jsdelivr.net/gh/moqsien/conf_backup@main/session_mode.png
)
1. Global模式: 会自动持久化环境变量到**$HOME/.vmr/vmr.sh** 或者 **$HOME/.vmr/vmr.fish**.
2. Session模式: 不会持久化环境变量,只会新开一个终端session,然后向新的session中临时添加环境变量,session关闭之后失效。
安全。所有资源均来自各种SDK的官方下载链接或者github仓库的release。
你可以在 [这里](https://github.com/gvcgo/vsources) 查看所有的版本SDK信息,包括具体SDK的下载地址。
16 changes: 16 additions & 0 deletions docs/zh-cn/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,29 @@ Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
$HOME/.vmr/
```

### Unix-like系统下,环境变量放在哪里?

```bash
$HOME/.vmr/vmr.sh 或 $HOME/.vmr/vmr.fish
```

### 可以指定SDK的安装目录吗?

可以。在首次安装**VMR**的时候,会提示你设置**SDK Installation Dir**,这时候在输入框中输入你想要定制的SDK安装路径即可。
如果你不小心输入错误了,你也可以在 **$HOME/.vmr/config.toml** 配置文件中手动修改。

![installation](https://cdn.jsdelivr.net/gh/moqsien/img_repo@main/vmr_install_dir.png)

### 如何打开TUI?

```bash
vmr
```

### 无法显示SDK列表?

你需要设置代理(http或者socks5);或者你也可以设置由VMR提供的免费反向代理,详见[这里](https://gvcgo.github.io/vdocs/#/zh-cn/usage?id=%e8%ae%be%e7%bd%ae%e4%bb%a3%e7%90%86)

## 更新
### 方法一

Expand Down

0 comments on commit b058b02

Please sign in to comment.