easy-command 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/README_CN.md +8 -6
- package/install.sh +16 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,18 +34,20 @@ exec zsh -l
|
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
# Preview installation without changing your machine
|
|
37
|
-
easy-command --dry-run
|
|
37
|
+
npx easy-command --dry-run
|
|
38
38
|
|
|
39
39
|
# Check Shell, dependencies, managed repositories, and .zshrc configuration
|
|
40
|
-
easy-command doctor
|
|
40
|
+
npx easy-command doctor
|
|
41
41
|
|
|
42
42
|
# Restore missing managed files and configuration
|
|
43
|
-
easy-command repair -y
|
|
43
|
+
npx easy-command repair -y
|
|
44
44
|
|
|
45
45
|
# Safely update Oh My Zsh and managed plugins
|
|
46
|
-
easy-command update -y
|
|
46
|
+
npx easy-command update -y
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
`npx` runs the command without a global npm installation. If you prefer the shorter `easy-command` command, install it globally with `npm install -g easy-command`.
|
|
50
|
+
|
|
49
51
|
## What you get
|
|
50
52
|
|
|
51
53
|
- A clean `agnoster` prompt with your user, path, Git branch, and working-tree status.
|
|
@@ -119,13 +121,13 @@ bash install.sh -y
|
|
|
119
121
|
For production, pin a release tag instead of running `main` directly:
|
|
120
122
|
|
|
121
123
|
```bash
|
|
122
|
-
npx easy-command@2.0.
|
|
124
|
+
npx easy-command@2.0.2 -y
|
|
123
125
|
```
|
|
124
126
|
|
|
125
127
|
Or, without npm:
|
|
126
128
|
|
|
127
129
|
```bash
|
|
128
|
-
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.
|
|
130
|
+
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.2/install.sh | bash -s -- -y
|
|
129
131
|
```
|
|
130
132
|
|
|
131
133
|
## License
|
package/README_CN.md
CHANGED
|
@@ -34,18 +34,20 @@ exec zsh -l
|
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
# 预览安装过程,不修改本机环境
|
|
37
|
-
easy-command --dry-run
|
|
37
|
+
npx easy-command --dry-run
|
|
38
38
|
|
|
39
39
|
# 检查 Shell、依赖、托管仓库和 .zshrc 配置
|
|
40
|
-
easy-command doctor
|
|
40
|
+
npx easy-command doctor
|
|
41
41
|
|
|
42
42
|
# 恢复缺失的托管文件和配置
|
|
43
|
-
easy-command repair -y
|
|
43
|
+
npx easy-command repair -y
|
|
44
44
|
|
|
45
45
|
# 安全更新 Oh My Zsh 和托管插件
|
|
46
|
-
easy-command update -y
|
|
46
|
+
npx easy-command update -y
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
`npx` 无需全局安装即可运行命令。若希望直接使用更短的 `easy-command` 命令,可执行 `npm install -g easy-command`。
|
|
50
|
+
|
|
49
51
|
## 安装后即可使用
|
|
50
52
|
|
|
51
53
|
- `agnoster` 提示符:显示用户名、当前路径、Git 分支和工作区状态。
|
|
@@ -119,13 +121,13 @@ bash install.sh -y
|
|
|
119
121
|
生产环境建议固定到发布标签,而不是直接使用 `main`:
|
|
120
122
|
|
|
121
123
|
```bash
|
|
122
|
-
npx easy-command@2.0.
|
|
124
|
+
npx easy-command@2.0.2 -y
|
|
123
125
|
```
|
|
124
126
|
|
|
125
127
|
或者不使用 npm:
|
|
126
128
|
|
|
127
129
|
```bash
|
|
128
|
-
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.
|
|
130
|
+
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.2/install.sh | bash -s -- -y
|
|
129
131
|
```
|
|
130
132
|
|
|
131
133
|
## 许可
|
package/install.sh
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
set -Eeuo pipefail
|
|
4
4
|
|
|
5
|
-
readonly VERSION='2.0.
|
|
5
|
+
readonly VERSION='2.0.2'
|
|
6
6
|
readonly BEGIN_MARKER='# >>> easy-command zsh >>>'
|
|
7
7
|
readonly END_MARKER='# <<< easy-command zsh <<<'
|
|
8
8
|
readonly BASE_DIR_NAME='.easy-command'
|
|
@@ -110,7 +110,9 @@ write_file() {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
determine_target_home() {
|
|
113
|
-
|
|
113
|
+
if command -v getent >/dev/null 2>&1; then
|
|
114
|
+
TARGET_HOME="$(getent passwd "$TARGET_USER" | cut -d: -f6 2>/dev/null || true)"
|
|
115
|
+
fi
|
|
114
116
|
if [[ -z "$TARGET_HOME" && "$(uname -s)" == 'Darwin' ]]; then
|
|
115
117
|
TARGET_HOME="$(dscl . -read "/Users/$TARGET_USER" NFSHomeDirectory | awk '{print $2}')"
|
|
116
118
|
fi
|
|
@@ -364,7 +366,14 @@ change_login_shell() {
|
|
|
364
366
|
|
|
365
367
|
local zsh_path
|
|
366
368
|
zsh_path="$(command -v zsh)"
|
|
367
|
-
grep -qx "$zsh_path" /etc/shells
|
|
369
|
+
if ! grep -qx "$zsh_path" /etc/shells; then
|
|
370
|
+
if [[ -x /bin/zsh ]] && grep -qx '/bin/zsh' /etc/shells; then
|
|
371
|
+
warn "$zsh_path is not listed in /etc/shells; using /bin/zsh as the login shell."
|
|
372
|
+
zsh_path='/bin/zsh'
|
|
373
|
+
else
|
|
374
|
+
fail "$zsh_path is not listed in /etc/shells. Use --no-chsh or add the path to /etc/shells first."
|
|
375
|
+
fi
|
|
376
|
+
fi
|
|
368
377
|
run_as_root chsh -s "$zsh_path" "$TARGET_USER"
|
|
369
378
|
}
|
|
370
379
|
|
|
@@ -384,7 +393,9 @@ doctor() {
|
|
|
384
393
|
local configured_shell=''
|
|
385
394
|
|
|
386
395
|
info "Checking easy-command for $TARGET_USER"
|
|
387
|
-
|
|
396
|
+
if command -v getent >/dev/null 2>&1; then
|
|
397
|
+
configured_shell="$(getent passwd "$TARGET_USER" | cut -d: -f7 2>/dev/null || true)"
|
|
398
|
+
fi
|
|
388
399
|
if [[ -z "$configured_shell" && "$(uname -s)" == 'Darwin' ]]; then
|
|
389
400
|
configured_shell="$(dscl . -read "/Users/$TARGET_USER" UserShell | awk '{print $2}')"
|
|
390
401
|
fi
|
|
@@ -489,9 +500,9 @@ main() {
|
|
|
489
500
|
confirm "Install easy-command $VERSION for $TARGET_USER?"
|
|
490
501
|
install_packages
|
|
491
502
|
ensure_repositories
|
|
503
|
+
change_login_shell
|
|
492
504
|
write_zshrc_block
|
|
493
505
|
configure_git_aliases
|
|
494
|
-
change_login_shell
|
|
495
506
|
info "Installed easy-command $VERSION for $TARGET_USER. Reconnect or run: exec zsh -l"
|
|
496
507
|
;;
|
|
497
508
|
repair)
|