easy-command 2.0.7 → 2.0.8
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 +2 -2
- package/README_CN.md +2 -2
- package/bin/easy-command +1 -1
- package/install.sh +26 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,13 +131,13 @@ bash install.sh -y
|
|
|
131
131
|
For production, pin a release tag instead of running `main` directly:
|
|
132
132
|
|
|
133
133
|
```bash
|
|
134
|
-
npx easy-command@2.0.
|
|
134
|
+
npx easy-command@2.0.8 -y
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
Or, without npm:
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
|
-
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.
|
|
140
|
+
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.8/install.sh | bash -s -- -y
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
## License
|
package/README_CN.md
CHANGED
|
@@ -131,13 +131,13 @@ bash install.sh -y
|
|
|
131
131
|
生产环境建议固定到发布标签,而不是直接使用 `main`:
|
|
132
132
|
|
|
133
133
|
```bash
|
|
134
|
-
npx easy-command@2.0.
|
|
134
|
+
npx easy-command@2.0.8 -y
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
或者不使用 npm:
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
|
-
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.
|
|
140
|
+
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.8/install.sh | bash -s -- -y
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
## 许可
|
package/bin/easy-command
CHANGED
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.8'
|
|
6
6
|
readonly BEGIN_MARKER='# >>> easy-command zsh >>>'
|
|
7
7
|
readonly END_MARKER='# <<< easy-command zsh <<<'
|
|
8
8
|
readonly BASE_DIR_NAME='.easy-command'
|
|
@@ -48,6 +48,7 @@ Options:
|
|
|
48
48
|
--with-git-aliases Add non-conflicting global Git aliases (default).
|
|
49
49
|
--without-git-aliases
|
|
50
50
|
Remove global Git aliases managed by easy-command.
|
|
51
|
+
--version, -v Print the easy-command version.
|
|
51
52
|
--uninstall Remove only the easy-command managed .zshrc block.
|
|
52
53
|
--help, -h Show this help.
|
|
53
54
|
EOF
|
|
@@ -202,6 +203,24 @@ install_global_package() {
|
|
|
202
203
|
fi
|
|
203
204
|
}
|
|
204
205
|
|
|
206
|
+
update_global_package() {
|
|
207
|
+
[[ "${EASY_COMMAND_NPM_CLI:-}" == '1' ]] || return 0
|
|
208
|
+
[[ "${EASY_COMMAND_SELF_UPDATED:-}" != '1' ]] || return 0
|
|
209
|
+
command -v npm >/dev/null 2>&1 || {
|
|
210
|
+
warn 'npm is unavailable; skipped easy-command CLI upgrade.'
|
|
211
|
+
return 0
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if "$DRY_RUN"; then
|
|
215
|
+
command_preview npm install -g easy-command@latest
|
|
216
|
+
return 0
|
|
217
|
+
fi
|
|
218
|
+
|
|
219
|
+
info 'Updating easy-command CLI to the latest npm version...'
|
|
220
|
+
npm install -g easy-command@latest || fail 'Unable to update easy-command CLI. Check npm permissions and registry settings, then retry.'
|
|
221
|
+
exec env EASY_COMMAND_NPM_CLI=1 EASY_COMMAND_SELF_UPDATED=1 easy-command update --yes --user "$TARGET_USER"
|
|
222
|
+
}
|
|
223
|
+
|
|
205
224
|
ensure_repository() {
|
|
206
225
|
local repository="$1"
|
|
207
226
|
local destination="$2"
|
|
@@ -344,7 +363,7 @@ if command -v zoxide >/dev/null 2>&1; then
|
|
|
344
363
|
command npx easy-command "$@"
|
|
345
364
|
fi
|
|
346
365
|
;;
|
|
347
|
-
--dry-run)
|
|
366
|
+
--dry-run|-v|--version)
|
|
348
367
|
if (( $+commands[easy-command] )); then
|
|
349
368
|
command easy-command "$@"
|
|
350
369
|
else
|
|
@@ -567,6 +586,10 @@ parse_args() {
|
|
|
567
586
|
--with-git-aliases) ENABLE_GIT_ALIASES=true ;;
|
|
568
587
|
--without-git-aliases) ENABLE_GIT_ALIASES=false ;;
|
|
569
588
|
--uninstall) ACTION='uninstall' ;;
|
|
589
|
+
--version|-v)
|
|
590
|
+
printf '%s\n' "$VERSION"
|
|
591
|
+
exit 0
|
|
592
|
+
;;
|
|
570
593
|
--help|-h)
|
|
571
594
|
usage
|
|
572
595
|
exit 0
|
|
@@ -616,6 +639,7 @@ main() {
|
|
|
616
639
|
update)
|
|
617
640
|
CHANGE_LOGIN_SHELL=false
|
|
618
641
|
confirm "Update easy-command repositories for $TARGET_USER?"
|
|
642
|
+
update_global_package
|
|
619
643
|
ensure_repositories
|
|
620
644
|
update_repositories
|
|
621
645
|
write_zshrc_block
|