我的 VSCode 终端使用的是 Git Bash, 而我自己同时有一个单独安装的 MSYS2 环境. 假如我需要在Git Bash中使用 MSYS2 下的 tree 工具, 首先在 MSYS2 中安装 tree:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| NEO@i4N-H4CKD3CK UCRT64 ~ $ pacman -S tree resolving dependencies... looking for conflicting packages...
Packages (1) tree-2.2.1-1
Total Download Size: 0.04 MiB Total Installed Size: 0.08 MiB
:: Proceed with installation? [Y/n] :: Retrieving packages... tree-2.2.1-1-x86_64 39.7 KiB 15.1 KiB/s 00:03 [###############################] 100% (1/1) checking keys in keyring [###############################] 100% (1/1) checking package integrity [###############################] 100% (1/1) loading package files [###############################] 100% (1/1) checking for file conflicts [###############################] 100% (1/1) checking available disk space [###############################] 100% :: Processing package changes... (1/1) installing tree
|
1 2 3
| $ where tree D:\Dev.i4N\MSYS2\usr\bin\tree.exe C:\Windows\System32\tree.com
|
Git Bash 使用的是内置的 MSYS2 环境, 这个时候可以考虑共享环境路径.
打开 ~/.bashrc, 写入我自己的 MSYS2 工具路径:
1
| export PATH="/d/Dev.i4N/MSYS2/usr/bin:/d/Dev.i4N/MSYS2/ucrt64/bin:$PATH"
|
保存退出后, >Develops: reload windows 重启,并且在 Git Bash 中测试:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| $ tree -L 2 . ├── CMakeLists.txt ├── README.md ├── build │ ├── CMakeCache.txt │ ├── CMakeFiles │ ├── app-flash_args │ ├── bootloader │ ├── bootloader-flash_args │ ├── bootloader-prefix │ ├── build.ninja │ ├── cmake_install.cmake │ ├── compile_commands.json │ ├── config │ ├── config.env │ ├── esp-idf │ ├── flash_app_args │ ├── flash_args │ ├── flash_args.in │ ├── flash_bootloader_args │ ├── flash_project_args │ ├── flasher_args.json │ ├── gdbinit │ ├── kconfigs.in │ ├── kconfigs_projbuild.in │ ├── ldgen_libraries │ ├── ldgen_libraries.in │ ├── log │ ├── partition-table-flash_args │ └── project_description.json ├── main │ ├── CMakeLists.txt │ └── hello_world_main.c ├── pytest_hello_world.py ├── sdkconfig └── sdkconfig.ci
10 directories, 26 files
|
成功了.