easy-command 2.0.5 → 2.0.7

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 CHANGED
@@ -91,11 +91,11 @@ bash install.sh -y --no-chsh
91
91
  # Remove only the configuration block managed by easy-command
92
92
  bash install.sh --uninstall
93
93
 
94
- # Enable optional fuzzy search and Git aliases
95
- bash install.sh -y --with-fzf --with-git-aliases
94
+ # Enable optional fuzzy search
95
+ bash install.sh -y --with-fzf
96
96
  ```
97
97
 
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.
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. Directories are recorded only through `z add`, `z a`, `ec add`, or `ec a`; normal jumps never add a directory automatically. Use `--without-zoxide` to disable it. `fzf` adds fuzzy history and file searching. Git aliases are added by default, including `git st`, `git br`, `git sw`, `git ci`, `git cam`, `git lg`, `git la`, `git lb`, and `git ec-status`; existing aliases are never overwritten. Use `--without-git-aliases` to skip or remove aliases managed by easy-command.
99
99
 
100
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.
101
101
 
@@ -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.5 -y
134
+ npx easy-command@2.0.7 -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.5/install.sh | bash -s -- -y
140
+ curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.7/install.sh | bash -s -- -y
141
141
  ```
142
142
 
143
143
  ## License
package/README_CN.md CHANGED
@@ -91,11 +91,11 @@ bash install.sh -y --no-chsh
91
91
  # 仅删除 easy-command 管理的 .zshrc 配置区块
92
92
  bash install.sh --uninstall
93
93
 
94
- # 启用可选的模糊搜索和 Git 快捷操作
95
- bash install.sh -y --with-fzf --with-git-aliases
94
+ # 启用可选的模糊搜索
95
+ bash install.sh -y --with-fzf
96
96
  ```
97
97
 
98
- 默认安装 `zoxide`,可使用 `z <关键词>` 跳转目录,也支持 `z add <目录>` 或 `z a <目录>` 手动记录目录;使用 `--without-zoxide` 可关闭。`fzf` 提供历史命令和文件的模糊搜索;Git 快捷操作使用 `ec-` 前缀,例如 `git ec-status`,不会覆盖已有别名。
98
+ 默认安装 `zoxide`,可使用 `z <关键词>` 跳转目录,也支持 `z add <目录>` 或 `z a <目录>` 手动记录目录;目录仅会通过 `z add`、`z a`、`ec add` 或 `ec a` 显式记录,普通跳转不会自动添加目录。使用 `--without-zoxide` 可关闭。`fzf` 提供历史命令和文件的模糊搜索;默认添加 Git 快捷操作,包括 `git st`、`git br`、`git sw`、`git ci`、`git cam`、`git lg`、`git la`、`git lb` 和 `git ec-status` 等,不会覆盖已有同名别名。使用 `--without-git-aliases` 可跳过或移除项目管理的快捷方式。
99
99
 
100
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` 命令仍可使用。
101
101
 
@@ -131,13 +131,13 @@ bash install.sh -y
131
131
  生产环境建议固定到发布标签,而不是直接使用 `main`:
132
132
 
133
133
  ```bash
134
- npx easy-command@2.0.5 -y
134
+ npx easy-command@2.0.7 -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.5/install.sh | bash -s -- -y
140
+ curl -fsSL https://raw.githubusercontent.com/UnionSchool/easy-command/v2.0.7/install.sh | bash -s -- -y
141
141
  ```
142
142
 
143
143
  ## 许可
package/install.sh CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  set -Eeuo pipefail
4
4
 
5
- readonly VERSION='2.0.5'
5
+ readonly VERSION='2.0.7'
6
6
  readonly BEGIN_MARKER='# >>> easy-command zsh >>>'
7
7
  readonly END_MARKER='# <<< easy-command zsh <<<'
8
8
  readonly BASE_DIR_NAME='.easy-command'
@@ -13,7 +13,7 @@ CHANGE_LOGIN_SHELL=true
13
13
  DRY_RUN=false
14
14
  ENABLE_ZOXIDE=true
15
15
  ENABLE_FZF='auto'
16
- ENABLE_GIT_ALIASES='auto'
16
+ ENABLE_GIT_ALIASES=true
17
17
  GLOBAL_INSTALL=false
18
18
  TARGET_USER="${SUDO_USER:-${USER}}"
19
19
  TARGET_HOME=''
@@ -45,7 +45,7 @@ Options:
45
45
  --without-zoxide Do not install or enable zoxide.
46
46
  --with-fzf Enable optional fzf history and file searching.
47
47
  --without-fzf Disable fzf in the managed configuration.
48
- --with-git-aliases Add non-conflicting global Git aliases prefixed with ec-.
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
51
  --uninstall Remove only the easy-command managed .zshrc block.
@@ -315,15 +315,22 @@ EOF
315
315
 
316
316
  # easy-command: zoxide
317
317
  if command -v zoxide >/dev/null 2>&1; then
318
- eval "$(zoxide init zsh)"
318
+ # Paths are recorded only through `ec add` / `ec a`; never implicitly after cd.
319
+ eval "$(zoxide init zsh --no-cmd --hook none)"
319
320
 
320
- # Keep zoxide's normal jump behavior and add a short command for recording paths.
321
+ function __easy_command_jump() {
322
+ local target
323
+ target="$(command zoxide query --exclude "$PWD" -- "$@")" || return 1
324
+ builtin cd -- "$target"
325
+ }
326
+
327
+ # Keep z for zoxide compatibility, but record paths only when explicitly requested.
321
328
  function z() {
322
329
  if [[ "$1" == 'add' || "$1" == 'a' ]]; then
323
330
  shift
324
331
  command zoxide add "$@"
325
332
  else
326
- __zoxide_z "$@"
333
+ __easy_command_jump "$@"
327
334
  fi
328
335
  }
329
336
 
@@ -366,7 +373,7 @@ if command -v zoxide >/dev/null 2>&1; then
366
373
  ' ec --dry-run'
367
374
  ;;
368
375
  *)
369
- __zoxide_z "$@"
376
+ __easy_command_jump "$@"
370
377
  ;;
371
378
  esac
372
379
  }
@@ -397,9 +404,29 @@ EOF
397
404
 
398
405
  configure_git_aliases() {
399
406
  local enabled
400
- enabled="$(resolve_option "$ENABLE_GIT_ALIASES" 'git-aliases')"
407
+ enabled="$ENABLE_GIT_ALIASES"
401
408
 
402
409
  local aliases=(
410
+ 'st=status'
411
+ 'br=branch'
412
+ 'bc=branch'
413
+ 'sw=switch'
414
+ 'cd=switch'
415
+ 'ch=checkout'
416
+ 'ck=checkout'
417
+ 'ci=commit'
418
+ 'ca=commit -a'
419
+ 'cam=commit -a -m'
420
+ 'co=commit'
421
+ 'rb=rebase'
422
+ 'rs=restore'
423
+ 'rt=remote'
424
+ 'mg=merge'
425
+ 'rh=reset HEAD'
426
+ 'last=log -1'
427
+ "lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
428
+ 'la=log --pretty=oneline --abbrev-commit'
429
+ 'lb=log --graph --pretty=oneline --abbrev-commit'
403
430
  'ec-status=status --short --branch'
404
431
  'ec-log=log --oneline --graph --decorate -12'
405
432
  'ec-last=log -1 --stat'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-command",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "Configure a polished Zsh terminal with one command.",
5
5
  "license": "MIT",
6
6
  "bin": {