easy-command 2.0.2 → 2.0.5
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 +22 -12
- package/README_CN.md +22 -12
- package/install.sh +76 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,10 +10,18 @@ Configure a polished Zsh terminal in one command.
|
|
|
10
10
|
|
|
11
11
|
## INSTALL
|
|
12
12
|
|
|
13
|
-
### npm
|
|
13
|
+
### npm (recommended)
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
16
|
+
npm i -g easy-command
|
|
17
|
+
easy-command -y
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or install globally and configure your terminal in one command:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx easy-command -y --global
|
|
24
|
+
exec zsh -l
|
|
17
25
|
```
|
|
18
26
|
|
|
19
27
|
### GitHub
|
|
@@ -34,19 +42,19 @@ exec zsh -l
|
|
|
34
42
|
|
|
35
43
|
```bash
|
|
36
44
|
# Preview installation without changing your machine
|
|
37
|
-
|
|
45
|
+
easy-command --dry-run
|
|
38
46
|
|
|
39
47
|
# Check Shell, dependencies, managed repositories, and .zshrc configuration
|
|
40
|
-
|
|
48
|
+
easy-command doctor
|
|
41
49
|
|
|
42
50
|
# Restore missing managed files and configuration
|
|
43
|
-
|
|
51
|
+
easy-command repair -y
|
|
44
52
|
|
|
45
53
|
# Safely update Oh My Zsh and managed plugins
|
|
46
|
-
|
|
54
|
+
easy-command update -y
|
|
47
55
|
```
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
If you do not want a global npm installation, replace `easy-command` in the examples with `npx easy-command`.
|
|
50
58
|
|
|
51
59
|
## What you get
|
|
52
60
|
|
|
@@ -83,11 +91,13 @@ bash install.sh -y --no-chsh
|
|
|
83
91
|
# Remove only the configuration block managed by easy-command
|
|
84
92
|
bash install.sh --uninstall
|
|
85
93
|
|
|
86
|
-
# Enable optional
|
|
87
|
-
bash install.sh -y --with-
|
|
94
|
+
# Enable optional fuzzy search and Git aliases
|
|
95
|
+
bash install.sh -y --with-fzf --with-git-aliases
|
|
88
96
|
```
|
|
89
97
|
|
|
90
|
-
`zoxide` enables `z <keyword>` directory jumping. `fzf` adds fuzzy history and file searching. Git aliases use the non-conflicting `ec-` prefix, such as `git ec-status`; existing aliases are never overwritten.
|
|
98
|
+
`zoxide` is installed by default. It enables `z <keyword>` directory jumping and `z add <directory>` (or `z a <directory>`) for manually recording a directory. Use `--without-zoxide` to disable it. `fzf` adds fuzzy history and file searching. Git aliases use the non-conflicting `ec-` prefix, such as `git ec-status`; existing aliases are never overwritten.
|
|
99
|
+
|
|
100
|
+
For a unified interface, use `ec <keyword>` to jump, `ec add <directory>` (or `ec a <directory>`) to record a directory, `ec list` (or `ec l`) to view entries, and `ec del <directory>` (or `ec remove <directory>`) to remove one. `ec doctor`, `ec repair`, `ec update`, `ec install`, `ec uninstall`, and `ec --dry-run` run the matching easy-command maintenance operation. `z` remains available for zoxide compatibility.
|
|
91
101
|
|
|
92
102
|
## Requirements
|
|
93
103
|
|
|
@@ -121,13 +131,13 @@ bash install.sh -y
|
|
|
121
131
|
For production, pin a release tag instead of running `main` directly:
|
|
122
132
|
|
|
123
133
|
```bash
|
|
124
|
-
npx easy-command@2.0.
|
|
134
|
+
npx easy-command@2.0.5 -y
|
|
125
135
|
```
|
|
126
136
|
|
|
127
137
|
Or, without npm:
|
|
128
138
|
|
|
129
139
|
```bash
|
|
130
|
-
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.
|
|
140
|
+
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.5/install.sh | bash -s -- -y
|
|
131
141
|
```
|
|
132
142
|
|
|
133
143
|
## License
|
package/README_CN.md
CHANGED
|
@@ -10,10 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
## 安装
|
|
12
12
|
|
|
13
|
-
### npm
|
|
13
|
+
### npm 安装(推荐)
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
16
|
+
npm i -g easy-command
|
|
17
|
+
easy-command -y
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
也可以一条命令完成全局安装和终端配置:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx easy-command -y --global
|
|
24
|
+
exec zsh -l
|
|
17
25
|
```
|
|
18
26
|
|
|
19
27
|
### GitHub 安装
|
|
@@ -34,19 +42,19 @@ exec zsh -l
|
|
|
34
42
|
|
|
35
43
|
```bash
|
|
36
44
|
# 预览安装过程,不修改本机环境
|
|
37
|
-
|
|
45
|
+
easy-command --dry-run
|
|
38
46
|
|
|
39
47
|
# 检查 Shell、依赖、托管仓库和 .zshrc 配置
|
|
40
|
-
|
|
48
|
+
easy-command doctor
|
|
41
49
|
|
|
42
50
|
# 恢复缺失的托管文件和配置
|
|
43
|
-
|
|
51
|
+
easy-command repair -y
|
|
44
52
|
|
|
45
53
|
# 安全更新 Oh My Zsh 和托管插件
|
|
46
|
-
|
|
54
|
+
easy-command update -y
|
|
47
55
|
```
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
如不希望全局安装 npm 包,将示例中的 `easy-command` 替换为 `npx easy-command` 即可。
|
|
50
58
|
|
|
51
59
|
## 安装后即可使用
|
|
52
60
|
|
|
@@ -83,11 +91,13 @@ bash install.sh -y --no-chsh
|
|
|
83
91
|
# 仅删除 easy-command 管理的 .zshrc 配置区块
|
|
84
92
|
bash install.sh --uninstall
|
|
85
93
|
|
|
86
|
-
#
|
|
87
|
-
bash install.sh -y --with-
|
|
94
|
+
# 启用可选的模糊搜索和 Git 快捷操作
|
|
95
|
+
bash install.sh -y --with-fzf --with-git-aliases
|
|
88
96
|
```
|
|
89
97
|
|
|
90
|
-
`zoxide`
|
|
98
|
+
默认安装 `zoxide`,可使用 `z <关键词>` 跳转目录,也支持 `z add <目录>` 或 `z a <目录>` 手动记录目录;使用 `--without-zoxide` 可关闭。`fzf` 提供历史命令和文件的模糊搜索;Git 快捷操作使用 `ec-` 前缀,例如 `git ec-status`,不会覆盖已有别名。
|
|
99
|
+
|
|
100
|
+
统一入口使用 `ec`:`ec <关键词>` 跳转目录,`ec add <目录>` 或 `ec a <目录>` 记录目录,`ec list` 或 `ec l` 查看记录,`ec del <目录>` 或 `ec remove <目录>` 删除记录;`ec doctor`、`ec repair`、`ec update`、`ec install`、`ec uninstall` 和 `ec --dry-run` 执行对应的 easy-command 维护操作。为兼容 zoxide,原有 `z` 命令仍可使用。
|
|
91
101
|
|
|
92
102
|
## 系统要求
|
|
93
103
|
|
|
@@ -121,13 +131,13 @@ bash install.sh -y
|
|
|
121
131
|
生产环境建议固定到发布标签,而不是直接使用 `main`:
|
|
122
132
|
|
|
123
133
|
```bash
|
|
124
|
-
npx easy-command@2.0.
|
|
134
|
+
npx easy-command@2.0.5 -y
|
|
125
135
|
```
|
|
126
136
|
|
|
127
137
|
或者不使用 npm:
|
|
128
138
|
|
|
129
139
|
```bash
|
|
130
|
-
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.
|
|
140
|
+
curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.5/install.sh | bash -s -- -y
|
|
131
141
|
```
|
|
132
142
|
|
|
133
143
|
## 许可
|
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.5'
|
|
6
6
|
readonly BEGIN_MARKER='# >>> easy-command zsh >>>'
|
|
7
7
|
readonly END_MARKER='# <<< easy-command zsh <<<'
|
|
8
8
|
readonly BASE_DIR_NAME='.easy-command'
|
|
@@ -11,9 +11,10 @@ ACTION='install'
|
|
|
11
11
|
ASSUME_YES=false
|
|
12
12
|
CHANGE_LOGIN_SHELL=true
|
|
13
13
|
DRY_RUN=false
|
|
14
|
-
ENABLE_ZOXIDE=
|
|
14
|
+
ENABLE_ZOXIDE=true
|
|
15
15
|
ENABLE_FZF='auto'
|
|
16
16
|
ENABLE_GIT_ALIASES='auto'
|
|
17
|
+
GLOBAL_INSTALL=false
|
|
17
18
|
TARGET_USER="${SUDO_USER:-${USER}}"
|
|
18
19
|
TARGET_HOME=''
|
|
19
20
|
|
|
@@ -39,8 +40,9 @@ Options:
|
|
|
39
40
|
--user USER Configure this user. Defaults to the invoking user.
|
|
40
41
|
--no-chsh Do not change the user's default login shell to zsh.
|
|
41
42
|
--dry-run Preview changes without installing, writing files, or using sudo.
|
|
42
|
-
--
|
|
43
|
-
--
|
|
43
|
+
--global Install this easy-command version globally with npm first.
|
|
44
|
+
--with-zoxide Enable zoxide directory jumping (enabled by default).
|
|
45
|
+
--without-zoxide Do not install or enable zoxide.
|
|
44
46
|
--with-fzf Enable optional fzf history and file searching.
|
|
45
47
|
--without-fzf Disable fzf in the managed configuration.
|
|
46
48
|
--with-git-aliases Add non-conflicting global Git aliases prefixed with ec-.
|
|
@@ -189,6 +191,17 @@ install_packages() {
|
|
|
189
191
|
esac
|
|
190
192
|
}
|
|
191
193
|
|
|
194
|
+
install_global_package() {
|
|
195
|
+
"$GLOBAL_INSTALL" || return 0
|
|
196
|
+
command -v npm >/dev/null 2>&1 || fail 'npm is required for --global. Install Node.js/npm first.'
|
|
197
|
+
|
|
198
|
+
if "$DRY_RUN"; then
|
|
199
|
+
command_preview npm install -g "easy-command@$VERSION"
|
|
200
|
+
else
|
|
201
|
+
npm install -g "easy-command@$VERSION"
|
|
202
|
+
fi
|
|
203
|
+
}
|
|
204
|
+
|
|
192
205
|
ensure_repository() {
|
|
193
206
|
local repository="$1"
|
|
194
207
|
local destination="$2"
|
|
@@ -303,6 +316,60 @@ EOF
|
|
|
303
316
|
# easy-command: zoxide
|
|
304
317
|
if command -v zoxide >/dev/null 2>&1; then
|
|
305
318
|
eval "$(zoxide init zsh)"
|
|
319
|
+
|
|
320
|
+
# Keep zoxide's normal jump behavior and add a short command for recording paths.
|
|
321
|
+
function z() {
|
|
322
|
+
if [[ "$1" == 'add' || "$1" == 'a' ]]; then
|
|
323
|
+
shift
|
|
324
|
+
command zoxide add "$@"
|
|
325
|
+
else
|
|
326
|
+
__zoxide_z "$@"
|
|
327
|
+
fi
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
# Unified easy-command directory interface. Keep z for zoxide compatibility.
|
|
331
|
+
function ec() {
|
|
332
|
+
case "$1" in
|
|
333
|
+
doctor|repair|update|install|uninstall)
|
|
334
|
+
if (( $+commands[easy-command] )); then
|
|
335
|
+
command easy-command "$@"
|
|
336
|
+
else
|
|
337
|
+
command npx easy-command "$@"
|
|
338
|
+
fi
|
|
339
|
+
;;
|
|
340
|
+
--dry-run)
|
|
341
|
+
if (( $+commands[easy-command] )); then
|
|
342
|
+
command easy-command "$@"
|
|
343
|
+
else
|
|
344
|
+
command npx easy-command "$@"
|
|
345
|
+
fi
|
|
346
|
+
;;
|
|
347
|
+
add|a)
|
|
348
|
+
shift
|
|
349
|
+
command zoxide add "$@"
|
|
350
|
+
;;
|
|
351
|
+
list|ls|l)
|
|
352
|
+
shift
|
|
353
|
+
command zoxide query --list "$@"
|
|
354
|
+
;;
|
|
355
|
+
del|remove)
|
|
356
|
+
shift
|
|
357
|
+
command zoxide remove "$@"
|
|
358
|
+
;;
|
|
359
|
+
help|--help|-h)
|
|
360
|
+
printf '%s\n' \
|
|
361
|
+
'Usage: ec <keyword>' \
|
|
362
|
+
' ec add|a <directory>' \
|
|
363
|
+
' ec list|ls|l [keyword]' \
|
|
364
|
+
' ec del|remove <directory>' \
|
|
365
|
+
' ec doctor|repair|update|install|uninstall' \
|
|
366
|
+
' ec --dry-run'
|
|
367
|
+
;;
|
|
368
|
+
*)
|
|
369
|
+
__zoxide_z "$@"
|
|
370
|
+
;;
|
|
371
|
+
esac
|
|
372
|
+
}
|
|
306
373
|
fi
|
|
307
374
|
EOF
|
|
308
375
|
fi
|
|
@@ -465,6 +532,7 @@ parse_args() {
|
|
|
465
532
|
;;
|
|
466
533
|
--no-chsh) CHANGE_LOGIN_SHELL=false ;;
|
|
467
534
|
--dry-run) DRY_RUN=true ;;
|
|
535
|
+
--global) GLOBAL_INSTALL=true ;;
|
|
468
536
|
--with-zoxide) ENABLE_ZOXIDE=true ;;
|
|
469
537
|
--without-zoxide) ENABLE_ZOXIDE=false ;;
|
|
470
538
|
--with-fzf) ENABLE_FZF=true ;;
|
|
@@ -498,12 +566,16 @@ main() {
|
|
|
498
566
|
;;
|
|
499
567
|
install)
|
|
500
568
|
confirm "Install easy-command $VERSION for $TARGET_USER?"
|
|
569
|
+
install_global_package
|
|
501
570
|
install_packages
|
|
502
571
|
ensure_repositories
|
|
503
572
|
change_login_shell
|
|
504
573
|
write_zshrc_block
|
|
505
574
|
configure_git_aliases
|
|
506
575
|
info "Installed easy-command $VERSION for $TARGET_USER. Reconnect or run: exec zsh -l"
|
|
576
|
+
if "$GLOBAL_INSTALL"; then
|
|
577
|
+
info "Global CLI installed. After exec zsh -l, try: ec --help"
|
|
578
|
+
fi
|
|
507
579
|
;;
|
|
508
580
|
repair)
|
|
509
581
|
CHANGE_LOGIN_SHELL=false
|