mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-07-03 10:08:25 +00:00
Compare commits
3 Commits
c86ba78e2f
...
70ad5e3df8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70ad5e3df8 | ||
|
|
b86a99da17 | ||
|
|
cfdc4822d4 |
6
.github/workflows/dependencies/updater.py
vendored
6
.github/workflows/dependencies/updater.py
vendored
@@ -348,7 +348,7 @@ class Git:
|
|||||||
default_branch = "master"
|
default_branch = "master"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clone(remote_url: str, branch: str, repo_dir: str, reclone=False):
|
def clone(remote_url: str, ref: str, repo_dir: str, reclone=False):
|
||||||
# If repo needs to be fresh
|
# If repo needs to be fresh
|
||||||
if reclone and os.path.exists(repo_dir):
|
if reclone and os.path.exists(repo_dir):
|
||||||
shutil.rmtree(repo_dir)
|
shutil.rmtree(repo_dir)
|
||||||
@@ -356,11 +356,11 @@ class Git:
|
|||||||
# Clone repo in tmp directory and checkout branch
|
# Clone repo in tmp directory and checkout branch
|
||||||
if not os.path.exists(repo_dir):
|
if not os.path.exists(repo_dir):
|
||||||
print(
|
print(
|
||||||
f"Cloning {remote_url} to {repo_dir} and checking out {branch}",
|
f"Cloning {remote_url} to {repo_dir} and checking out {ref}",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
CommandRunner.run_or_fail(
|
CommandRunner.run_or_fail(
|
||||||
["git", "clone", "--depth=1", "-b", branch, remote_url, repo_dir],
|
["git", "clone", "--depth=1", "--revision", ref, remote_url, repo_dir],
|
||||||
stage="Clone",
|
stage="Clone",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ If `brew` is not found in the PATH, this plugin will attempt to find it in commo
|
|||||||
In case you installed `brew` in a non-common location, you can still set `BREW_LOCATION` variable pointing to
|
In case you installed `brew` in a non-common location, you can still set `BREW_LOCATION` variable pointing to
|
||||||
the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environment.
|
the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environment.
|
||||||
|
|
||||||
|
### sbin directory
|
||||||
|
|
||||||
|
This plugin also adds `$HOMEBREW_PREFIX/sbin` to the PATH if the directory exists and isn't already present.
|
||||||
|
Some Homebrew formulae (e.g. `mtr`) install executables to `sbin`, which `brew doctor` checks for. This
|
||||||
|
ensures the `bdr` alias runs without warnings.
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|
|||||||
@@ -30,6 +30,16 @@ if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
|||||||
export HOMEBREW_PREFIX="$(brew --prefix)"
|
export HOMEBREW_PREFIX="$(brew --prefix)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Add Homebrew sbin to PATH if it exists and is not already in PATH.
|
||||||
|
# Homebrew's shellenv only adds bin directories, not sbin. Some formulae
|
||||||
|
# (e.g. mtr) install executables to sbin, and brew doctor warns if it's
|
||||||
|
# missing from PATH.
|
||||||
|
if [[ -d "$HOMEBREW_PREFIX/sbin" ]]; then
|
||||||
|
if [[ ! "$PATH" == *"$HOMEBREW_PREFIX/sbin"* ]]; then
|
||||||
|
export PATH="$HOMEBREW_PREFIX/sbin:$PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
|
if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
|
||||||
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
|
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -15,6 +15,52 @@ __go_identifiers() {
|
|||||||
compadd $(godoc -templates "$tmpl_path" ${words[-2]} 2> /dev/null)
|
compadd $(godoc -templates "$tmpl_path" ${words[-2]} 2> /dev/null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__go_tool_commands() {
|
||||||
|
local -a tools tool_commands
|
||||||
|
local -A command_seen short_count
|
||||||
|
local tool command
|
||||||
|
|
||||||
|
tools=("${(@f)$(go tool 2>/dev/null)}")
|
||||||
|
|
||||||
|
# Go 1.24+ lists module tools by package path, but also accepts unique
|
||||||
|
# default binary names for those tools.
|
||||||
|
for tool in "${tools[@]}"; do
|
||||||
|
[[ -n $tool ]] || continue
|
||||||
|
|
||||||
|
(( command_seen[$tool]++ ))
|
||||||
|
|
||||||
|
if [[ $tool == */* ]]; then
|
||||||
|
command=${tool:t}
|
||||||
|
|
||||||
|
if [[ $command == v[0-9]* && ${command#v} != *[^0-9]* ]] && (( ${command#v} > 1 )); then
|
||||||
|
command=${${tool%/$command}:t}
|
||||||
|
fi
|
||||||
|
|
||||||
|
(( short_count[$command]++ ))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for tool in "${tools[@]}"; do
|
||||||
|
[[ -n $tool ]] || continue
|
||||||
|
|
||||||
|
tool_commands+=("$tool")
|
||||||
|
|
||||||
|
if [[ $tool == */* ]]; then
|
||||||
|
command=${tool:t}
|
||||||
|
|
||||||
|
if [[ $command == v[0-9]* && ${command#v} != *[^0-9]* ]] && (( ${command#v} > 1 )); then
|
||||||
|
command=${${tool%/$command}:t}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( short_count[$command] == 1 && ! command_seen[$command] )); then
|
||||||
|
tool_commands+=("$command")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
_values "go tool" "${tool_commands[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
_go() {
|
_go() {
|
||||||
typeset -a commands build_flags
|
typeset -a commands build_flags
|
||||||
commands+=(
|
commands+=(
|
||||||
@@ -208,7 +254,7 @@ _go() {
|
|||||||
;;
|
;;
|
||||||
tool)
|
tool)
|
||||||
if (( CURRENT == 3 )); then
|
if (( CURRENT == 3 )); then
|
||||||
_values "go tool" $(go tool)
|
__go_tool_commands
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
case ${words[3]} in
|
case ${words[3]} in
|
||||||
|
|||||||
Reference in New Issue
Block a user