Răsfoiți Sursa

update get started

ruki 3 ani în urmă
părinte
comite
ea75ff6ccd
2 a modificat fișierele cu 111 adăugiri și 14 ștergeri
  1. 55 7
      getting_started.md
  2. 56 7
      zh-cn/getting_started.md

+ 55 - 7
getting_started.md

@@ -185,20 +185,68 @@ $ xrepo env --show luajit
 }
 ```
 
-### Load package environment and run commands
+### Package virtual environment
+
+#### Enter the virtual environment
+
+We can customize some package configurations by adding the xmake.lua file in the current directory, and then enter the specific package virtual environment.
+
+```lua
+add_requires("zlib 1.2.11")
+add_requires("python 3.x", "luajit")
+```
+
+```console
+$ xrepo env shell
+> python --version
+> luajit --version
+```
+
+We can also configure and load the corresponding toolchain environment in xmake.lua, for example, load the VS compilation environment.
+
+```lua
+set_toolchains("msvc")
+```
+
+#### Manage virtual environments
+
+We can use the following command to register the specified virtual environment configuration globally to the system for quick switching.
 
 ```console
-$ xrepo env luajit
-LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
-JIT: ON SSE2 SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
->
+$ xrepo env --add /tmp/base.lua
 ```
 
+At this time, we have saved a global virtual environment called base, and we can view it through the list command.
+
+```console
+$ xrepo env --list
+/Users/ruki/.xmake/envs:
+  -base
+envs(1) found!
+```
+
+We can also delete it.
+
+```console
+$ xrepo env --remove base
+```
+
+#### Switch global virtual environment
+
+If we register multiple virtual environments, we can also switch them quickly.
+
+```console
+$ xrepo env -b base shell
+> python --version
+```
+
+Or directly load the specified virtual environment to run specific commands
+
 ```console
-$ xrepo env -b "luajit 2.x" luajit
-$ xrepo env -p iphoneos -b "zlib,libpng,luajit 2.x" cmake ..
+$ xrepo env -b base python --version
 ```
 
+`xrepo env -b/--bind` is to bind the specified virtual environment. For more details, see: [#1762](https://github.com/xmake-io/xmake/issues/1762)
 ### Show the given package information
 
 ```console

+ 56 - 7
zh-cn/getting_started.md

@@ -186,20 +186,69 @@ $ xrepo env --show luajit
 }
 ```
 
-### 加载执行包环境并运行命令
+### 包虚拟环境
+
+#### 进入虚拟环境
+
+我们可以通过在当前目录下,添加 xmake.lua 文件,定制化一些包配置,然后进入特定的包虚拟环境。
+
+```lua
+add_requires("zlib 1.2.11")
+add_requires("python 3.x", "luajit")
+```
 
 ```console
-$ xrepo env luajit
-LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
-JIT: ON SSE2 SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
->
+$ xrepo env shell
+> python --version
+> luajit --version
 ```
 
+我们也可以在 xmake.lua 配置加载对应的工具链环境,比如加载 vs 的编译环境。
+
+```lua
+set_toolchains("msvc")
+```
+
+#### 管理虚拟环境
+
+我们可以使用下面的命令,把指定的虚拟环境配置全局注册到系统中,方便快速切换。
+
+```console
+$ xrepo env --add /tmp/base.lua
+```
+
+这个时候,我们就保存了一个名叫 base 的全局虚拟环境,我们可以通过 list 命令去查看它。
+
 ```console
-$ xrepo env -b "luajit 2.x" luajit
-$ xrepo env -p iphoneos -b "zlib,libpng,luajit 2.x" cmake ..
+$ xrepo env --list
+/Users/ruki/.xmake/envs:
+  - base
+envs(1) found!
 ```
 
+我们也可以删除它。
+
+```console
+$ xrepo env --remove base
+```
+
+#### 切换全局虚拟环境
+
+如果我们注册了多个虚拟环境,我们也可以快速切换它们。
+
+```console
+$ xrepo env -b base shell
+> python --version
+```
+
+或者直接加载指定虚拟环境运行特定命令
+
+```console
+$ xrepo env -b base python --version
+```
+
+`xrepo env -b/--bind` 就是绑定指定的虚拟环境,更多详情见:[#1762](https://github.com/xmake-io/xmake/issues/1762)
+
 ### 查看包信息
 
 ```console