1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2025-12-12 15:34:50 +08:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Arvin Verain
3bb37ccdb6
Merge 23648ca17b into 92aed2e936 2025-12-10 07:35:18 +00:00
Arvin Verain
23648ca17b
docs(git): Unlist long-removed aliases
There are some aliases, whose functionality has long been reassigned to
different aliases, but have not been reused for new commands, yet are
still documented in the README. Remove them.
2025-12-10 15:35:10 +08:00
Arvin Verain
9af4d9b4ed
docs(git): Clean up alias and function tables 2025-12-10 15:35:10 +08:00
Arvin Verain
6bd04ab375
refactor(git)!: Start deprecating current_branch function 2025-12-10 15:35:10 +08:00
Arvin Verain
630dd5d223
refactor(git)!: Start deprecating ggpull/ggpur/ggpush for their alternative functions 2025-12-10 15:35:09 +08:00
Arvin Verain
a09fb023c4
refactor(git)!: Remove deprecated git pull --rebase aliases 2025-12-10 15:35:08 +08:00
Tanzim Hossain Romel
92aed2e936
feat(extract): add unar as fallback for RAR extraction (#13472)
Add unar as a fallback when unrar is not available for extracting
RAR files. This addresses the issue where unrar has been removed
from Homebrew due to licensing issues.

The extraction now:
- Prefers unrar if available (backward compatible)
- Falls back to unar if unrar is not found
- Shows helpful error message if neither tool is installed
2025-12-09 20:14:31 +01:00
3 changed files with 38 additions and 56 deletions

View File

@ -77,7 +77,15 @@ EOF
(*.lzma) unlzma "$full_path" ;;
(*.z) uncompress "$full_path" ;;
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
(*.rar) unrar x -ad "$full_path" ;;
(*.rar)
if (( $+commands[unrar] )); then
unrar x -ad "$full_path"
elif (( $+commands[unar] )); then
unar -o . "$full_path"
else
echo "extract: cannot extract RAR files: install unrar or unar" >&2
success=1
fi ;;
(*.rpm)
rpm2cpio "$full_path" | cpio --quiet -id ;;
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;

View File

@ -234,40 +234,29 @@ branch exists. We do this via the function `git_main_branch`.
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not,
receive further support.
| Alias | Command | Modification |
| :------- | :-------------------------------------------------------- | :-------------------------------------------------------- |
| `gap` | `git add --patch` | New alias: `gapa`. |
| `gcl` | `git config --list` | New alias: `gcf`. |
| `gdc` | `git diff --cached` | New alias: `gdca`. |
| `gdt` | `git difftool` | No replacement. |
| `ggpull` | `git pull origin $(current_branch)` | New alias: `ggl`. (`ggpull` still exists for now though.) |
| `ggpur` | `git pull --rebase origin $(current_branch)` | New alias: `ggu`. (`ggpur` still exists for now though.) |
| `ggpush` | `git push origin $(current_branch)` | New alias: `ggp`. (`ggpush` still exists for now though.) |
| `gk` | `gitk --all --branches` | Now aliased to `gitk --all --branches`. |
| `glg` | `git log --stat --max-count=10` | Now aliased to `git log --stat --color`. |
| `glgg` | `git log --graph --max-count=10` | Now aliased to `git log --graph --color`. |
| `gwc` | `git whatchanged -p --abbrev-commit --pretty = medium` | New alias: `gwch`. |
| `gup` | `git pull --rebase` | now alias `gpr` |
| `gupv` | `git pull --rebase -v` | now alias `gprv` |
| `gupa` | `git pull --rebase --autostash` | now alias `gpra` |
| `gupav` | `git pull --rebase --autostash -v` | now alias `gprav` |
| `gupom` | `git pull --rebase origin $(git_main_branch)` | now alias `gprom` |
| `gupomi` | `git pull --rebase=interactive origin $(git_main_branch)` | now alias `gpromi` |
| Alias | Command | Modification |
| :------- | :-------------------------------------------------------- | :-----------------------------------------------------|
| `gap` | `git add --patch` | New alias: `gapa` |
| `gcl` | `git config --list` | New alias: `gcf` |
| `gdt` | `git difftool` | No replacement |
| `ggpull` | `git pull origin $(git_current_branch)` | New function: `ggl` (`ggpull` is now aliased to this) |
| `ggpur` | `git pull --rebase origin $(git_current_branch)` | New function: `ggu` (`ggpur` is now aliased to this) |
| `ggpush` | `git push origin $(git_current_branch)` | New function: `ggp` (`ggpush` is now aliased to this) |
## Functions
### Current
| Command | Description |
| :----------------------- | :-------------------------------------------------------------------------------------------------------------- |
| `current_branch` | Returns the name of the current branch. |
| `git_current_user_email` | Returns the `user.email` config value. (Lives in `lib/git.zsh`.) |
| `git_current_user_name` | Returns the `user.name` config value. (Lives in `lib/git.zsh`.) |
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. |
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise. |
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
| `gbda` | Deletes all merged branches |
| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
| Command | Description |
| :----------------------- | :------------------------------------------------------------------------------------------------------------- |
| `git_current_branch` | Returns the name of the current branch (Lives in `lib/git.zsh`) |
| `git_current_user_email` | Returns the `user.email` config value (Lives in `lib/git.zsh`) |
| `git_current_user_name` | Returns the `user.name` config value (Lives in `lib/git.zsh`) |
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise |
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise |
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote |
| `gbda` | Deletes all merged branches |
| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
### Work in Progress (WIP)
@ -287,4 +276,3 @@ Note that `gwip` and `gunwip` are aliases, but are also documented here to group
| Command | Description | Reason |
| :------------------- | :-------------------------------------- | :--------------------------------------------------------------- |
| `current_repository` | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias). |

View File

@ -8,14 +8,6 @@ git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
# (order should follow README)
#
# The name of the current branch
# Back-compatibility wrapper for when this function was defined here in
# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
# to fix the core -> git plugin dependency.
function current_branch() {
git_current_branch
}
# Check for develop and similarly named branches
function git_develop_branch() {
command git rev-parse --git-dir &>/dev/null || return
@ -110,7 +102,6 @@ function ggpnp() {
}
compdef _git ggpnp=git-checkout
alias ggpur='ggu'
alias g='git'
alias ga='git add'
alias gaa='git add --all'
@ -290,7 +281,6 @@ alias gprom='git pull --rebase origin $(git_main_branch)'
alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
alias gprum='git pull --rebase upstream $(git_main_branch)'
alias gprumi='git pull --rebase=interactive upstream $(git_main_branch)'
alias ggpull='git pull origin "$(git_current_branch)"'
function ggl() {
if [[ $# != 0 ]] && [[ $# != 1 ]]; then
@ -334,7 +324,6 @@ is-at-least 2.30 "$git_version" \
alias gpv='git push --verbose'
alias gpoat='git push origin --all && git push origin --tags'
alias gpod='git push origin --delete'
alias ggpush='git push origin "$(git_current_branch)"'
function ggp() {
if [[ $# != 0 ]] && [[ $# != 1 ]]; then
@ -427,19 +416,16 @@ alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
unset git_version
# Logic for adding warnings on deprecated aliases
local old_alias new_alias
for old_alias new_alias (
# TODO(2023-10-19): remove deprecated `git pull --rebase` aliases
gup gpr
gupv gprv
gupa gpra
gupav gprav
gupom gprom
gupomi gpromi
# Logic for adding warnings on deprecated aliases or functions
local old_name new_name
for old_name new_name (
current_branch git_current_branch
ggpull ggl
ggpur ggu
ggpush ggp
); do
aliases[$old_alias]="
print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_alias}%F{yellow}' is a deprecated alias, using '%F{green}${new_alias}%F{yellow}' instead.%f\"
$new_alias"
aliases[$old_name]="
print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_name}%F{yellow}' is deprecated, using '%F{green}${new_name}%F{yellow}' instead.%f\"
$new_name"
done
unset old_alias new_alias
unset old_name new_name