mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-10-20 12:32:10 +08:00
Compare commits
43
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0650a25040 | ||
|
|
741642d7a9 | ||
|
|
84038f144d | ||
|
|
a208c3a27a | ||
|
|
b056a436fe | ||
|
|
964ddf789b | ||
|
|
fab613bd93 | ||
|
|
1e3960e6f9 | ||
|
|
cbf4a572ef | ||
|
|
55c9071ee7 | ||
|
|
083c339e06 | ||
|
|
417c814e2e | ||
|
|
7d34868725 | ||
|
|
106f9874a2 | ||
|
|
eb29cdb33a | ||
|
|
535aaaf924 | ||
|
|
05c2cb0b2b | ||
|
|
bd9fb5231b | ||
|
|
48feb570f7 | ||
|
|
42a4ccb1b1 | ||
|
|
2d833b453d | ||
|
|
d7aca552b3 | ||
|
|
9f9b28a13d | ||
|
|
361fb5c1ac | ||
|
|
3d9b557be3 | ||
|
|
60c9a7a839 | ||
|
|
d745fbf3bd | ||
|
|
277993de0a | ||
|
|
4d4cfc287e | ||
|
|
92bf53f1ae | ||
|
|
5c4bb4aec5 | ||
|
|
868da9cfd5 | ||
|
|
83a0ec79ee | ||
|
|
c5852b1101 | ||
|
|
68795c2170 | ||
|
|
f809d46c10 | ||
|
|
0431f1c33d | ||
|
|
a3c88eba72 | ||
|
|
6881f37316 | ||
|
|
1d66682636 | ||
|
|
ce7f8c3224 | ||
|
|
f8e13d714e | ||
|
|
95ba6ae764 |
@@ -12,7 +12,7 @@ dependencies:
|
||||
plugins/gradle:
|
||||
repo: gradle/gradle-completion
|
||||
branch: master
|
||||
version: e7c881dbef7462bc35ad05328397e1582fe25cb8
|
||||
version: 05693a01fcb246bc4e8fc32a8d561dc537aaedf2
|
||||
precopy: |
|
||||
set -e
|
||||
find . ! -name _gradle ! -name LICENSE -delete
|
||||
@@ -30,7 +30,7 @@ dependencies:
|
||||
plugins/kube-ps1:
|
||||
repo: jonmosco/kube-ps1
|
||||
branch: master
|
||||
version: b4cd09ec8d4dc007173e28da40aeebf8eff8c87f
|
||||
version: 7aaaeee5eaa29f920acd850ea63839d9f87b8ac5
|
||||
precopy: |
|
||||
set -e
|
||||
find . ! -name kube-ps1.sh ! -name LICENSE ! -name README.md -delete
|
||||
@@ -46,7 +46,7 @@ dependencies:
|
||||
plugins/z:
|
||||
branch: master
|
||||
repo: agkozak/zsh-z
|
||||
version: 102fb78036ed76feedf623907483691777a1d510
|
||||
version: 7f8ff4df11b50a14e3666c7cd212baa399c9b92a
|
||||
precopy: |
|
||||
set -e
|
||||
rm -r tests
|
||||
@@ -75,7 +75,7 @@ dependencies:
|
||||
plugins/zsh-syntax-highlighting:
|
||||
repo: zsh-users/zsh-syntax-highlighting
|
||||
branch: master
|
||||
version: 2fc57d63067c18b1100ecdbf684fa5baf49459d1
|
||||
version: e6683f20e5c38d3e5447f45845d04ddda75d0f23
|
||||
precopy: |
|
||||
set -e
|
||||
version=$(<.version)
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
contents: write # this is needed to push commits and branches
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
certifi==2026.7.22
|
||||
charset-normalizer==3.5.1
|
||||
idna==3.19
|
||||
charset-normalizer==3.5.2
|
||||
idna==3.20
|
||||
PyYAML==6.0.3
|
||||
requests==2.34.2
|
||||
semver==3.1.0
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- macos-latest
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
- test
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
- name: Authenticate as @ohmyzsh
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
|
||||
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@@ -53,13 +53,13 @@ jobs:
|
||||
publish_results: true
|
||||
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
|
||||
uses: github/codeql-action/upload-sarif@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
@@ -45,6 +45,7 @@ Twitter), and join us on [Discord](https://discord.gg/ohmyzsh).
|
||||
- [Using Plugins](#using-plugins)
|
||||
- [Themes](#themes)
|
||||
- [Selecting A Theme](#selecting-a-theme)
|
||||
- [Shellsavers](#shellsavers)
|
||||
- [FAQ](#faq)
|
||||
- [Advanced Topics](#advanced-topics)
|
||||
- [Advanced Installation](#advanced-installation)
|
||||
@@ -241,6 +242,33 @@ If you only know which themes you don't like, you can add them similarly to an i
|
||||
ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
|
||||
```
|
||||
|
||||
### Shellsavers
|
||||
|
||||
Give your terminal a little downtime with `omz shellsaver`—our playful name for
|
||||
terminal screensavers. The aquarium is the default; choose another scene to change the mood:
|
||||
|
||||
```zsh
|
||||
omz shellsaver # A quiet aquarium full of sea shells
|
||||
omz shellsaver logo # The updater's rainbow logo, bouncing around
|
||||
omz shellsaver hermit # A slightly lost hermit crab
|
||||
omz shellsaver party # A rainbow stage and a dancing crowd
|
||||
```
|
||||
|
||||
Press any key or Ctrl-C to return to your shell. Screensavers run only when invoked
|
||||
and restore the terminal when they exit. No plugin or configuration change is needed.
|
||||
Use `omz help` to discover the command, and Tab to complete scene names and options.
|
||||
|
||||
```zsh
|
||||
omz shellsaver aquarium --seconds 30 # Stop automatically after 30 seconds
|
||||
omz shellsaver logo --mono # Use the terminal's foreground color
|
||||
omz shellsaver --list # List scenes (aquarium is the default)
|
||||
omz shellsaver --help # Show all scenes and options
|
||||
```
|
||||
|
||||
Requires Zsh 5.8 or newer, `stty`, and an xterm-compatible terminal with alternate-screen
|
||||
support. No additional animation package is required. `NO_COLOR` is respected.
|
||||
A window of at least 49 columns by 18 rows is recommended.
|
||||
|
||||
### FAQ
|
||||
|
||||
If you have some more questions or issues, you might find a solution in our
|
||||
|
||||
+23
@@ -28,12 +28,25 @@ function _omz {
|
||||
'plugin:Manage plugins'
|
||||
'pr:Manage Oh My Zsh Pull Requests'
|
||||
'reload:Reload the current zsh session'
|
||||
'shellsaver:Launch a whimsical terminal screensaver'
|
||||
'shop:Open the Oh My Zsh shop'
|
||||
'theme:Manage themes'
|
||||
'update:Update Oh My Zsh'
|
||||
'version:Show the version'
|
||||
)
|
||||
|
||||
if [[ "$words[2]" == (screensaver|shellsaver) ]] && (( CURRENT > 2 )); then
|
||||
_arguments \
|
||||
'1:command:' \
|
||||
'2::scene:(aquarium logo hermit party)' \
|
||||
'--list[List available scenes]' \
|
||||
'--mono[Use the default foreground color]' \
|
||||
'--seconds[Exit after a number of seconds]:seconds:' \
|
||||
'--snapshot[Print a plain-text still]::frame:' \
|
||||
'--help[Show Shellsaver help]'
|
||||
return
|
||||
fi
|
||||
|
||||
if (( CURRENT == 2 )); then
|
||||
_describe 'command' cmds
|
||||
elif (( CURRENT == 3 )); then
|
||||
@@ -174,6 +187,7 @@ Available commands:
|
||||
plugin <command> Manage plugins
|
||||
pr <command> Manage Oh My Zsh Pull Requests
|
||||
reload Reload the current zsh session
|
||||
shellsaver [scene] Launch a Shellsaver (aquarium by default)
|
||||
shop Open the Oh My Zsh shop
|
||||
theme <command> Manage themes
|
||||
update Update Oh My Zsh
|
||||
@@ -182,6 +196,15 @@ Available commands:
|
||||
EOF
|
||||
}
|
||||
|
||||
function _omz::shellsaver {
|
||||
command zsh -f "$ZSH/tools/shellsaver.zsh" "$@"
|
||||
}
|
||||
|
||||
# Hidden alias; only shellsaver is advertised in help and command completion.
|
||||
function _omz::screensaver {
|
||||
_omz::shellsaver "$@"
|
||||
}
|
||||
|
||||
function _omz::changelog {
|
||||
local version=${1:-HEAD} format=${3:-"--text"}
|
||||
|
||||
|
||||
+2
-1
@@ -178,7 +178,8 @@ function omz_urlencode() {
|
||||
setopt norematchpcre
|
||||
|
||||
local -a opts
|
||||
zparseopts -D -E -a opts r m P
|
||||
# Quote the specs so global aliases (e.g. common-aliases' P) don't expand here
|
||||
zparseopts -D -E -a opts 'r' 'm' 'P'
|
||||
|
||||
local in_str="$@"
|
||||
local url_str=""
|
||||
|
||||
+7
-5
@@ -5,7 +5,6 @@
|
||||
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
|
||||
# Fully supports screen, iterm, and probably most modern xterm and rxvt
|
||||
# (In screen, only short_tab_title is used)
|
||||
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
|
||||
function title {
|
||||
setopt localoptions nopromptsubst
|
||||
|
||||
@@ -17,7 +16,7 @@ function title {
|
||||
: ${2=$1}
|
||||
|
||||
case "$TERM" in
|
||||
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*|wezterm*)
|
||||
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*|wezterm*|nsterm*)
|
||||
print -Pn "\e]2;${2:q}\a" # set window name
|
||||
print -Pn "\e]1;${1:q}\a" # set tab name
|
||||
;;
|
||||
@@ -26,10 +25,12 @@ function title {
|
||||
print -Pn "\ek${1:q}\e\\" # set screen hardstatus/tmux window name if `allow-rename` is on
|
||||
;;
|
||||
*)
|
||||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
case "$TERM_PROGRAM" in
|
||||
"iTerm.app"|"Apple_Terminal")
|
||||
print -Pn "\e]2;${2:q}\a" # set window name
|
||||
print -Pn "\e]1;${1:q}\a" # set tab name
|
||||
else
|
||||
;;
|
||||
*)
|
||||
# Try to use terminfo to set the title if the feature is available
|
||||
if (( ${+terminfo[fsl]} && ${+terminfo[tsl]} )); then
|
||||
# Emit the capabilities with echoti so terminfo does its own parameter
|
||||
@@ -39,7 +40,8 @@ function title {
|
||||
print -Pn "$1"
|
||||
echoti fsl
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_op"
|
||||
zf_mv -f -- =( op completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._op"
|
||||
zf_mv -f -- =( op completion zsh ) "$ZSH_CACHE_DIR/completions/_op"
|
||||
} &|
|
||||
|
||||
# Load opswd function
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
# Generate and load arduino-cli completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_arduino-cli"
|
||||
zf_mv -f -- =( arduino-cli completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._arduino-cli"
|
||||
zf_mv -f -- =( arduino-cli completion zsh ) "$ZSH_CACHE_DIR/completions/_arduino-cli"
|
||||
} &|
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_argocd"
|
||||
zf_mv -f -- =( argocd completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._argocd"
|
||||
zf_mv -f -- =( argocd completion zsh ) "$ZSH_CACHE_DIR/completions/_argocd"
|
||||
} &|
|
||||
|
||||
@@ -14,6 +14,6 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
|
||||
fi
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_asdf"
|
||||
zf_mv -f -- =( asdf completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._asdf"
|
||||
zf_mv -f -- =( asdf completion zsh ) "$ZSH_CACHE_DIR/completions/_asdf"
|
||||
} &|
|
||||
|
||||
@@ -25,10 +25,10 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
||||
echo "$(ioreg -rc AppleSmartBattery | grep -o '"Watts"=[0-9]\+' | head -1 | grep -o '[0-9]\+')W "
|
||||
}
|
||||
function battery_is_charging() {
|
||||
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
|
||||
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected" = Yes'
|
||||
}
|
||||
function battery_pct() {
|
||||
pmset -g batt | grep -Eo "\d+%" | cut -d% -f1
|
||||
pmset -g batt | grep -Eo "[0-9]+%" | cut -d% -f1
|
||||
}
|
||||
function battery_pct_remaining() {
|
||||
if battery_is_charging; then
|
||||
@@ -39,8 +39,8 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
||||
}
|
||||
function battery_time_remaining() {
|
||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||
if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then
|
||||
timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
|
||||
if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected" = No') -eq 1 ]]; then
|
||||
timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty" = ' | sed -e 's/^.*"AvgTimeToEmpty" = //')
|
||||
if [ $timeremaining -gt 720 ]; then
|
||||
echo "::"
|
||||
else
|
||||
@@ -52,7 +52,7 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
||||
}
|
||||
function battery_pct_prompt () {
|
||||
local battery_pct color
|
||||
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then
|
||||
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected" = No'; then
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
# Generate and load buf completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_buf"
|
||||
zf_mv -f -- =( buf completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._buf"
|
||||
zf_mv -f -- =( buf completion zsh ) "$ZSH_CACHE_DIR/completions/_buf"
|
||||
} &|
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_bun"
|
||||
zf_mv -f -- =( SHELL=zsh bun completions ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._bun"
|
||||
zf_mv -f -- =( SHELL=zsh bun completions ) "$ZSH_CACHE_DIR/completions/_bun"
|
||||
} &|
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_charm"
|
||||
zf_mv -f -- =( charm completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._charm"
|
||||
zf_mv -f -- =( charm completion zsh ) "$ZSH_CACHE_DIR/completions/_charm"
|
||||
} &|
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_chezmoi"
|
||||
zf_mv -f -- =( chezmoi completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._chezmoi"
|
||||
zf_mv -f -- =( chezmoi completion zsh ) "$ZSH_CACHE_DIR/completions/_chezmoi"
|
||||
} &|
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_codex"
|
||||
zf_mv -f -- =( codex completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._codex"
|
||||
zf_mv -f -- =( codex completion zsh < /dev/null 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_codex"
|
||||
} &|
|
||||
|
||||
@@ -14,6 +14,6 @@ function copyfile {
|
||||
return 1
|
||||
fi
|
||||
|
||||
clipcopy $1
|
||||
clipcopy $1 || return 1
|
||||
echo ${(%):-"%B$1%b copied to clipboard."}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
emulate -LR zsh
|
||||
|
||||
source "${1:-${0:A:h:h}/copyfile.plugin.zsh}"
|
||||
|
||||
test_dir=$(mktemp -d) || exit 1
|
||||
trap 'command rm -rf -- "$test_dir"' EXIT
|
||||
|
||||
typeset -i clipboard_status=0 failures=0 tests=0
|
||||
typeset output expected_output
|
||||
|
||||
clipcopy() {
|
||||
print -r -- "$#" "$1" >| "$test_dir/call"
|
||||
if (( clipboard_status )); then
|
||||
print -u2 -r -- "clipboard backend failed"
|
||||
return $clipboard_status
|
||||
fi
|
||||
command cat -- "$1" >| "$test_dir/clipboard"
|
||||
}
|
||||
|
||||
check_copyfile() {
|
||||
local description="$1" expected_status="$2" expected_stdout="$3" expected_stderr="$4"
|
||||
shift 4
|
||||
|
||||
output=$(copyfile "$@" 2> "$test_dir/stderr")
|
||||
local actual_status=$?
|
||||
(( tests++ ))
|
||||
|
||||
if [[ $actual_status == $expected_status && $output == "$expected_stdout" && $(<"$test_dir/stderr") == "$expected_stderr" ]]; then
|
||||
print -r -- "PASS: $description"
|
||||
else
|
||||
print -u2 -r -- "FAIL: $description"
|
||||
print -u2 -r -- " status: $actual_status (expected $expected_status)"
|
||||
print -u2 -r -- " stdout: ${(qqq)output} (expected ${(qqq)expected_stdout})"
|
||||
print -u2 -r -- " stderr: $(<"$test_dir/stderr") (expected $expected_stderr)"
|
||||
(( failures++ ))
|
||||
fi
|
||||
}
|
||||
|
||||
for filename in plain.txt 'file with spaces.txt' 'unicode-ą.txt' empty.txt; do
|
||||
if [[ $filename == empty.txt ]]; then
|
||||
: >| "$test_dir/$filename"
|
||||
else
|
||||
print -r -- "contents of $filename" >| "$test_dir/$filename"
|
||||
fi
|
||||
|
||||
expected_output=${(%):-"%B$test_dir/$filename%b copied to clipboard."}
|
||||
clipboard_status=0
|
||||
check_copyfile "successful copy of $filename" 0 "$expected_output" '' "$test_dir/$filename"
|
||||
|
||||
if [[ $(<"$test_dir/call") != "1 $test_dir/$filename" ]] || ! command cmp -s -- "$test_dir/$filename" "$test_dir/clipboard"; then
|
||||
print -u2 -r -- "FAIL: clipboard received a different argument or contents for $filename"
|
||||
(( failures++ ))
|
||||
fi
|
||||
|
||||
for clipboard_status in 1 42 127; do
|
||||
check_copyfile "clipboard exit $clipboard_status for $filename" 1 '' 'clipboard backend failed' "$test_dir/$filename"
|
||||
done
|
||||
done
|
||||
|
||||
command rm -f -- "$test_dir/call"
|
||||
check_copyfile 'missing argument' 1 'Usage: copyfile <file>' ''
|
||||
check_copyfile 'empty argument' 1 'Usage: copyfile <file>' '' ''
|
||||
check_copyfile 'nonexistent file' 1 "Error: '$test_dir/missing.txt' is not a valid file." '' "$test_dir/missing.txt"
|
||||
check_copyfile 'directory argument' 1 "Error: '$test_dir' is not a valid file." '' "$test_dir"
|
||||
|
||||
if [[ -e "$test_dir/call" ]]; then
|
||||
print -u2 -r -- 'FAIL: invalid input invoked the clipboard backend'
|
||||
(( failures++ ))
|
||||
fi
|
||||
|
||||
print -r -- "$tests tests, $failures failures"
|
||||
(( failures == 0 ))
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_deno"
|
||||
zf_mv -f -- =( deno completions zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._deno"
|
||||
zf_mv -f -- =( deno completions zsh ) "$ZSH_CACHE_DIR/completions/_deno"
|
||||
} &|
|
||||
|
||||
@@ -13,28 +13,32 @@ plugins=(... docker-compose)
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-----------|----------------------------------|----------------------------------------------------------------------------------|
|
||||
| dco | `docker-compose` | Docker-compose main command |
|
||||
| dcb | `docker-compose build` | Build containers |
|
||||
| dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format |
|
||||
| dce | `docker-compose exec` | Execute command inside a container |
|
||||
| dcps | `docker-compose ps` | List containers |
|
||||
| dcrestart | `docker-compose restart` | Restart container |
|
||||
| dcrm | `docker-compose rm` | Remove container |
|
||||
| dcr | `docker-compose run` | Run a command in container |
|
||||
| dcstop | `docker-compose stop` | Stop a container |
|
||||
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
|
||||
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
|
||||
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
|
||||
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
|
||||
| dcdn | `docker-compose down` | Stop and remove containers |
|
||||
| dcl | `docker-compose logs` | Show logs of container |
|
||||
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
||||
| dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
|
||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||
| dcstart | `docker-compose start` | Start a container |
|
||||
| dck | `docker-compose kill` | Kills containers |
|
||||
| dcv | `docker-compose version` | Show version information |
|
||||
| dcsts | `docker-compose stats` | Show stats of containers |
|
||||
| dci | `docker-compose images` | List images |
|
||||
| Alias | Command | Description |
|
||||
|-----------|-------------------------------------|----------------------------------------------------------------------------------------------|
|
||||
| dco | `docker-compose` | Docker-compose main command |
|
||||
| dcb | `docker-compose build` | Build containers |
|
||||
| dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format |
|
||||
| dce | `docker-compose exec` | Execute command inside a container |
|
||||
| dcps | `docker-compose ps` | List containers |
|
||||
| dcrestart | `docker-compose restart` | Restart container |
|
||||
| dcrm | `docker-compose rm` | Remove container |
|
||||
| dcr | `docker-compose run` | Run a command in container |
|
||||
| dcstop | `docker-compose stop` | Stop a container |
|
||||
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
|
||||
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
|
||||
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
|
||||
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
|
||||
| dcupw | `docker-compose up --watch` | Watch changes in service and rebuild/restart accordingly (see [Use Compose Watch] for usage) |
|
||||
| dcupwb | `docker-compose up --watch --build` | Same as `dcupw`, but build images before starting containers |
|
||||
| dcdn | `docker-compose down` | Stop and remove containers |
|
||||
| dcl | `docker-compose logs` | Show logs of container |
|
||||
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
||||
| dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
|
||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||
| dcstart | `docker-compose start` | Start a container |
|
||||
| dck | `docker-compose kill` | Kills containers |
|
||||
| dcv | `docker-compose version` | Show version information |
|
||||
| dcsts | `docker-compose stats` | Show stats of containers |
|
||||
| dci | `docker-compose images` | List images |
|
||||
|
||||
[Use Compose Watch]: https://docs.docker.com/compose/how-tos/file-watch/
|
||||
|
||||
@@ -17,6 +17,8 @@ alias dcup="$dccmd up"
|
||||
alias dcupb="$dccmd up --build"
|
||||
alias dcupd="$dccmd up -d"
|
||||
alias dcupdb="$dccmd up -d --build"
|
||||
alias dcupw="$dccmd up --watch"
|
||||
alias dcupwb="$dccmd up --watch --build"
|
||||
alias dcdn="$dccmd down"
|
||||
alias dcl="$dccmd logs"
|
||||
alias dclf="$dccmd logs -f"
|
||||
|
||||
@@ -48,6 +48,11 @@ fi
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
||||
# Make sure the cache directory exists; when the plugin is loaded by a
|
||||
# standalone plugin manager (e.g. antigen) the core is not sourced, so
|
||||
# $ZSH_CACHE_DIR/completions may not have been created yet (#13679).
|
||||
[[ -d "$ZSH_CACHE_DIR/completions" ]] || mkdir -p "$ZSH_CACHE_DIR/completions"
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `docker`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
|
||||
@@ -68,7 +73,7 @@ zmodload -F zsh/files b:zf_mv
|
||||
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
|
||||
command cp "${plugin_dir}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
|
||||
else
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_docker"
|
||||
zf_mv -f -- =( command docker completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._docker"
|
||||
zf_mv -f -- =( command docker completion zsh ) "$ZSH_CACHE_DIR/completions/_docker"
|
||||
fi
|
||||
} "${0:A:h}" &|
|
||||
|
||||
@@ -16,6 +16,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_doctl"
|
||||
zf_mv -f -- =( doctl completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._doctl"
|
||||
zf_mv -f -- =( doctl completion zsh ) "$ZSH_CACHE_DIR/completions/_doctl"
|
||||
} &|
|
||||
|
||||
@@ -35,7 +35,9 @@ alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
||||
alias eframe='emacsclient --alternate-editor="" --create-frame'
|
||||
|
||||
# Emacs ANSI Term tracking
|
||||
if [[ -n "$INSIDE_EMACS" ]] && [[ "$INSIDE_EMACS" != "vterm" ]]; then
|
||||
local excluded_terms=(vterm ghostel)
|
||||
local current_term="${INSIDE_EMACS%%,*}"
|
||||
if [[ -n "$INSIDE_EMACS" ]] && (( ! ${excluded_terms[(Ie)$current_term]} )); then
|
||||
chpwd_emacs() { print -P "\033AnSiTc %d"; }
|
||||
print -P "\033AnSiTc %d" # Track current working directory
|
||||
print -P "\033AnSiTu %n" # Track username
|
||||
|
||||
@@ -32,8 +32,9 @@ emacsfun() {
|
||||
# Check if there are suitable frames
|
||||
frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null |sed 's/.*\x07//g' )"
|
||||
|
||||
# Only create another X frame if there isn't one present
|
||||
if [ -z "$frames" -o "$frames" = nil ]; then
|
||||
# A bare emacs/e passes only --no-wait, so it still needs --create-frame.
|
||||
if [ -z "$frames" ] || [ "$frames" = nil ] || [ "$#" -eq 0 ] \
|
||||
|| { [ "$#" -eq 1 ] && [ "$1" = --no-wait ]; }; then
|
||||
emacsclient --alternate-editor="" --create-frame "$@"
|
||||
return $?
|
||||
fi
|
||||
|
||||
@@ -101,12 +101,14 @@ EOF
|
||||
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
|
||||
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
|
||||
(*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
|
||||
(*.bz2)
|
||||
(( $+commands[pbzip2] )) && pbzip2 -cd "$full_path" > "${file:t:r}" \
|
||||
|| bunzip2 -c "$full_path" > "${file:t:r}" ;;
|
||||
(*.xz) xzcat "$full_path" > "${file:t:r}" ;;
|
||||
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
|
||||
(*.lz4) lz4 -d "$full_path" ;;
|
||||
(*.lzma) unlzma "$full_path" ;;
|
||||
(*.z) uncompress "$full_path" ;;
|
||||
(*.lzma) unlzma -c "$full_path" > "${file:t:r}" ;;
|
||||
(*.z) uncompress -c "$full_path" > "${file:t:r}" ;;
|
||||
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
|
||||
(*.rar)
|
||||
if (( $+commands[unrar] )); then
|
||||
@@ -119,7 +121,17 @@ EOF
|
||||
fi ;;
|
||||
(*.rpm)
|
||||
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
||||
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
|
||||
(*.7z | *.7z.[0-9]* | *.pk7)
|
||||
if (( $+commands[7zz] )); then
|
||||
7zz x "$full_path"
|
||||
elif (( $+commands[7z] )); then
|
||||
7z x "$full_path"
|
||||
elif (( $+commands[7za] )); then
|
||||
7za x "$full_path"
|
||||
else
|
||||
echo "extract: cannot extract 7z files: install 7zz, 7z or 7za" >&2
|
||||
success=1
|
||||
fi ;;
|
||||
(*.deb)
|
||||
command mkdir -p "control" "data"
|
||||
ar vx "$full_path" > /dev/null
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Run with: zsh -df plugins/extract/tests/extract.test.zsh
|
||||
emulate -L zsh
|
||||
setopt err_return
|
||||
|
||||
for tool in lzma unlzma uncompress; do
|
||||
(( $+commands[$tool] )) || {
|
||||
print -u2 -r -- "These tests require $tool."
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
source "${0:A:h:h}/extract.plugin.zsh"
|
||||
local test_dir=$(mktemp -d) original_dir=$PWD
|
||||
|
||||
check_extract() {
|
||||
local extension=$1 mode=$2
|
||||
local case_dir="$test_dir/$extension-$mode"
|
||||
mkdir -p "$case_dir/source files" "$case_dir/work/target dir"
|
||||
local archive="$case_dir/source files/sample.txt.$extension"
|
||||
cp "$test_dir/fixture.$extension" "$archive"
|
||||
builtin cd "$case_dir/work"
|
||||
|
||||
local output="$PWD/sample.txt"
|
||||
local -a args
|
||||
case "$mode" in
|
||||
target)
|
||||
args=(-t 'target dir')
|
||||
output="$PWD/target dir/sample.txt"
|
||||
;;
|
||||
remove) args=(-r) ;;
|
||||
esac
|
||||
|
||||
# Run the plugin without the test's ERR_RETURN option.
|
||||
() {
|
||||
emulate -L zsh
|
||||
extract "${args[@]}" "$archive"
|
||||
} || return 1
|
||||
cmp "$test_dir/plain" "$output"
|
||||
if [[ $mode == remove ]]; then
|
||||
[[ ! -e $archive ]]
|
||||
else
|
||||
[[ -f $archive ]]
|
||||
fi
|
||||
print -r -- "PASS: $extension ($mode)"
|
||||
}
|
||||
|
||||
{
|
||||
print -r -- hello > "$test_dir/plain"
|
||||
lzma -c "$test_dir/plain" > "$test_dir/fixture.lzma"
|
||||
# "hello\n" as a .Z stream, since many systems only ship uncompress.
|
||||
printf '\037\235\220\150\312\260\141\363\106\001' \
|
||||
> "$test_dir/fixture.Z"
|
||||
|
||||
for extension in lzma Z; do
|
||||
for mode in default target remove; do
|
||||
check_extract "$extension" "$mode"
|
||||
done
|
||||
done
|
||||
print 'All extract compressed-file tests passed.'
|
||||
} always {
|
||||
builtin cd "$original_dir"
|
||||
rm -rf -- "$test_dir"
|
||||
}
|
||||
@@ -32,6 +32,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flutter"
|
||||
zf_mv -f -- =( flutter zsh-completion < /dev/null ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._flutter"
|
||||
zf_mv -f -- =( flutter zsh-completion < /dev/null ) "$ZSH_CACHE_DIR/completions/_flutter"
|
||||
} &|
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flux"
|
||||
zf_mv -f -- =( flux completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._flux"
|
||||
zf_mv -f -- =( flux completion zsh ) "$ZSH_CACHE_DIR/completions/_flux"
|
||||
} &|
|
||||
|
||||
@@ -12,8 +12,8 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_fnm"
|
||||
zf_mv -f -- =( fnm completions --shell=zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._fnm"
|
||||
zf_mv -f -- =( fnm completions --shell=zsh ) "$ZSH_CACHE_DIR/completions/_fnm"
|
||||
} &|
|
||||
|
||||
if zstyle -t ':omz:plugins:fnm' autostart; then
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_gcx"
|
||||
zf_mv -f -- =( gcx completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gcx"
|
||||
zf_mv -f -- =( gcx completion zsh ) "$ZSH_CACHE_DIR/completions/_gcx"
|
||||
} &|
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_gh"
|
||||
zf_mv -f -- =( gh completion --shell zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gh"
|
||||
zf_mv -f -- =( gh completion --shell zsh ) "$ZSH_CACHE_DIR/completions/_gh"
|
||||
} &|
|
||||
|
||||
@@ -108,6 +108,7 @@ plugins=(... git)
|
||||
| `glo` | `git log --oneline --decorate` |
|
||||
| `glog` | `git log --oneline --decorate --graph` |
|
||||
| `gloga` | `git log --oneline --decorate --graph --all` |
|
||||
| `glom` | `git log --oneline --decorate --color $(git_main_branch)..` |
|
||||
| `glp` | `git log --pretty=<format>` |
|
||||
| `glg` | `git log --stat` |
|
||||
| `glgp` | `git log --stat --patch` |
|
||||
@@ -155,6 +156,8 @@ plugins=(... git)
|
||||
| `grba` | `git rebase --abort` |
|
||||
| `grbc` | `git rebase --continue` |
|
||||
| `grbi` | `git rebase --interactive` |
|
||||
| `grbmi` | `git rebase $(git_main_branch) --interactive` |
|
||||
| `grbmia` | `git rebase $(git_main_branch) --interactive --autosquash` |
|
||||
| `grbo` | `git rebase --onto` |
|
||||
| `grbs` | `git rebase --skip` |
|
||||
| `grbd` | `git rebase $(git_develop_branch)` |
|
||||
@@ -188,6 +191,7 @@ plugins=(... git)
|
||||
| `grmc` | `git rm --cached` |
|
||||
| `gcount` | `git shortlog --summary -n` |
|
||||
| `gsh` | `git show` |
|
||||
| `gshs` | `git show --stat` |
|
||||
| `gsps` | `git show --pretty=short --show-signature` |
|
||||
| `gstall` | `git stash --all` |
|
||||
| `gstu` | `git stash --include-untracked` |
|
||||
@@ -202,8 +206,10 @@ plugins=(... git)
|
||||
| `gst` | `git status` |
|
||||
| `gss` | `git status --short` |
|
||||
| `gsb` | `git status --short -b` |
|
||||
| `gsnut` | `git status --untracked-files=no` |
|
||||
| `gsi` | `git submodule init` |
|
||||
| `gsu` | `git submodule update` |
|
||||
| `gsuri` | `git submodule update --recursive --init` |
|
||||
| `gsd` | `git svn dcommit` |
|
||||
| `git-svn-dcommit-push` | `git svn dcommit && git push github $(git_main_branch):svntrunk` |
|
||||
| `gsr` | `git svn rebase` |
|
||||
|
||||
@@ -253,6 +253,7 @@ alias glolm='git log $(git_main_branch) --graph --pretty="%Cred%h%Creset -%C(aut
|
||||
alias glo='git log --oneline --decorate'
|
||||
alias glog='git log --oneline --decorate --graph'
|
||||
alias gloga='git log --oneline --decorate --graph --all'
|
||||
alias glom='git log --oneline --decorate --color $(git_main_branch)..'
|
||||
|
||||
# Pretty log messages
|
||||
function _git_log_prettily(){
|
||||
@@ -362,6 +363,8 @@ alias grbd='git rebase $(git_develop_branch)'
|
||||
alias grbm='git rebase $(git_main_branch)'
|
||||
alias grbom='git rebase origin/$(git_main_branch)'
|
||||
alias grbum='git rebase upstream/$(git_main_branch)'
|
||||
alias grbmi='git rebase $(git_main_branch) --interactive'
|
||||
alias grbmia='git rebase $(git_main_branch) --interactive --autosquash'
|
||||
alias grf='git reflog'
|
||||
alias gr='git remote'
|
||||
alias grv='git remote --verbose'
|
||||
@@ -389,6 +392,7 @@ alias grm='git rm'
|
||||
alias grmc='git rm --cached'
|
||||
alias gcount='git shortlog --summary --numbered'
|
||||
alias gsh='git show'
|
||||
alias gshs='git show --stat'
|
||||
alias gsps='git show --pretty=short --show-signature'
|
||||
alias gstall='git stash --all'
|
||||
alias gstaa='git stash apply'
|
||||
@@ -404,8 +408,10 @@ alias gsts='git stash show --patch'
|
||||
alias gst='git status'
|
||||
alias gss='git status --short'
|
||||
alias gsb='git status --short --branch'
|
||||
alias gsnut='git status --untracked-files=no'
|
||||
alias gsi='git submodule init'
|
||||
alias gsu='git submodule update'
|
||||
alias gsuri='git submodule update --recursive --init'
|
||||
alias gsd='git svn dcommit'
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
|
||||
alias gsr='git svn rebase'
|
||||
|
||||
+34
-36
@@ -1,45 +1,43 @@
|
||||
# github plugin
|
||||
|
||||
This plugin supports working with GitHub from the command line. It provides a few things:
|
||||
> [!WARNING]
|
||||
> This plugin is deprecated and will be removed in a future release. It supports
|
||||
> the legacy [`hub`](https://github.com/mislav/hub) CLI, not the current GitHub
|
||||
> CLI. For `gh` completion, use the [`gh` plugin](../gh) instead.
|
||||
|
||||
* Sets up the `hub` wrapper and completions for the `git` command if you have [`hub`](https://github.com/github/hub) installed.
|
||||
* Completion for the [`github` Ruby gem](https://github.com/defunkt/github-gem).
|
||||
* Convenience functions for working with repos and URLs.
|
||||
The plugin provides compatibility for existing `hub` users by:
|
||||
|
||||
### Functions
|
||||
- aliasing `git` to `hub` when `hub` is installed;
|
||||
- adding completion for `hub`; and
|
||||
- defining convenience functions for creating repositories.
|
||||
|
||||
* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub
|
||||
* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
|
||||
* `exist_gh` - Takes an existing repo and pushes it to GitHub
|
||||
## Migrating to GitHub CLI
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
[Hub](https://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ.
|
||||
|
||||
The [`github` Ruby gem](https://github.com/defunkt/github-gem) needs to be installed if you want to use it.
|
||||
|
||||
### Configuration
|
||||
|
||||
These settings affect `github`'s behavior.
|
||||
|
||||
#### Environment variables
|
||||
|
||||
* `$GITHUB_USER`
|
||||
* `$GITHUB_PASSWORD`
|
||||
|
||||
#### Git configuration options
|
||||
|
||||
* `github.user` - GitHub username for repo operations
|
||||
|
||||
See `man hub` for more details.
|
||||
|
||||
### Homebrew installation note
|
||||
|
||||
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
|
||||
Install [GitHub CLI](https://cli.github.com/), replace `github` with `gh` in
|
||||
your plugin list, and restart your shell:
|
||||
|
||||
```zsh
|
||||
if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then
|
||||
FPATH=/usr/local/share/zsh/site-functions:$FPATH
|
||||
fi
|
||||
plugins=(... gh)
|
||||
```
|
||||
|
||||
The `gh` plugin supplies completion for the installed GitHub CLI. It does not
|
||||
alias `git`, because `gh` is not a Git wrapper.
|
||||
|
||||
The closest replacement for creating a GitHub repository from an existing
|
||||
local repository is:
|
||||
|
||||
```zsh
|
||||
gh repo create --source=. --push
|
||||
```
|
||||
|
||||
## Deprecated functions
|
||||
|
||||
- `empty_gh` - creates a new repository with a `README.md` and pushes it to GitHub
|
||||
- `new_gh` - initializes an existing directory and pushes it to GitHub
|
||||
- `exist_gh` - pushes an existing Git repository to GitHub
|
||||
|
||||
These functions remain available during the deprecation period and require
|
||||
`hub`. They will be removed with the plugin.
|
||||
|
||||
If you continue using `hub`, see its documentation for authentication and
|
||||
configuration details.
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
print -Pru2 -- '%F{yellow}[oh-my-zsh] The %Bgithub%b plugin is deprecated and will be removed in a future release.'
|
||||
print -Pru2 -- 'It supports the legacy %Bhub%b CLI. Use the %Bgh%b plugin for GitHub CLI completion.%f'
|
||||
|
||||
# Set up hub wrapper for git, if it is available; https://github.com/github/hub
|
||||
if (( $+commands[hub] )); then
|
||||
alias git=hub
|
||||
@@ -26,7 +29,7 @@ empty_gh() { # [NAME_OF_REPO]
|
||||
# This function will add all non-hidden files to git.
|
||||
new_gh() { # [DIRECTORY]
|
||||
emulate -L zsh
|
||||
local repo="$1"
|
||||
local repo="${1-.}"
|
||||
cd "$repo" \
|
||||
|| return
|
||||
|
||||
@@ -42,7 +45,7 @@ new_gh() { # [DIRECTORY]
|
||||
|| return
|
||||
hub create \
|
||||
|| return
|
||||
git push -u origin master \
|
||||
git push -u origin HEAD \
|
||||
|| return
|
||||
}
|
||||
|
||||
@@ -52,18 +55,19 @@ new_gh() { # [DIRECTORY]
|
||||
# to your GitHub.
|
||||
exist_gh() { # [DIRECTORY]
|
||||
emulate -L zsh
|
||||
local repo=$1
|
||||
cd "$repo"
|
||||
local repo="${1:-.}"
|
||||
cd "$repo" \
|
||||
|| return
|
||||
|
||||
hub create \
|
||||
|| return
|
||||
git push -u origin master
|
||||
git push -u origin HEAD
|
||||
}
|
||||
|
||||
# git.io "GitHub URL"
|
||||
#
|
||||
# Shorten GitHub url, example:
|
||||
# https://github.com/nvogel/dotzsh > https://git.io/8nU25w
|
||||
# https://github.com/nvogel/dotzsh > https://git.io/8nU25w
|
||||
# source: https://github.com/nvogel/dotzsh
|
||||
# documentation: https://github.com/blog/985-git-io-github-url-shortener
|
||||
#
|
||||
@@ -74,4 +78,3 @@ git.io() {
|
||||
}
|
||||
|
||||
# End Functions #############################################################
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_glab"
|
||||
zf_mv -f -- =( glab completion -s zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._glab"
|
||||
zf_mv -f -- =( glab completion -s zsh ) "$ZSH_CACHE_DIR/completions/_glab"
|
||||
} &|
|
||||
|
||||
@@ -4,7 +4,11 @@ globalias() {
|
||||
# (A) makes it an array even if there's only one element
|
||||
local word=${${(Az)LBUFFER}[-1]}
|
||||
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
|
||||
zle _expand_alias
|
||||
# Completion also considers quoted strings and assignment values as aliases.
|
||||
# Only expand when the complete shell word is an alias name.
|
||||
if (( ${+aliases[$word]} || ${+galiases[$word]} )); then
|
||||
zle _expand_alias
|
||||
fi
|
||||
zle expand-word
|
||||
fi
|
||||
zle self-insert
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Exercise the actual ZLE widgets in an isolated interactive shell.
|
||||
emulate -L zsh
|
||||
setopt err_return
|
||||
zmodload zsh/zpty
|
||||
zmodload zsh/zselect
|
||||
|
||||
local test_dir=$(mktemp -d)
|
||||
export GLOBALIAS_TEST_PLUGIN=${0:A:h:h}/globalias.plugin.zsh
|
||||
export GLOBALIAS_TEST_RESULT=$test_dir/result
|
||||
|
||||
wait_for_marker() {
|
||||
local marker=$1 output received
|
||||
local -i deadline=$(( SECONDS + 5 ))
|
||||
while (( SECONDS < deadline )); do
|
||||
if zpty -r globalias-test output; then
|
||||
received+=$output
|
||||
[[ $received == *$marker* ]] && return 0
|
||||
else
|
||||
zselect -t 1 || true
|
||||
fi
|
||||
done
|
||||
print -u2 -r -- "Timed out waiting for ZLE: $received"
|
||||
return 1
|
||||
}
|
||||
|
||||
check_expansion() {
|
||||
local input=$1 expected=$2 actual
|
||||
zpty -w -n globalias-test "$input"$' \x18'
|
||||
wait_for_marker GLOBALIAS_TEST_CAPTURED
|
||||
actual=$(< "$GLOBALIAS_TEST_RESULT")
|
||||
if [[ $actual != "$expected" ]]; then
|
||||
print -u2 -r -- "Input: ${(qqq)input}"
|
||||
print -u2 -r -- "Expected: ${(qqq)expected}; got: ${(qqq)actual}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
{
|
||||
cat > "$test_dir/setup.zsh" <<'SETUP'
|
||||
autoload -Uz compinit
|
||||
compinit -D
|
||||
source "$GLOBALIAS_TEST_PLUGIN"
|
||||
alias 1='cd -1'
|
||||
alias ll='ls -l'
|
||||
alias -g G='| grep'
|
||||
GLOBALIAS_FILTER_VALUES=(ll)
|
||||
_globalias_test_capture() {
|
||||
print -rn -- "$BUFFER" > "$GLOBALIAS_TEST_RESULT"
|
||||
print -r -- $'\nGLOBALIAS_TEST_CAPTURED'
|
||||
BUFFER=
|
||||
zle .accept-line
|
||||
}
|
||||
zle -N _globalias_test_capture
|
||||
bindkey '^X' _globalias_test_capture
|
||||
PS1='GLOBALIAS_TEST_READY> '
|
||||
RPROMPT=
|
||||
SETUP
|
||||
zpty -b globalias-test zsh -dfi
|
||||
zpty -w globalias-test "source ${(q)test_dir}/setup.zsh"
|
||||
wait_for_marker GLOBALIAS_TEST_READY
|
||||
|
||||
check_expansion 'DEBUG=1' 'DEBUG=1 '
|
||||
check_expansion 'DEBUG="1"' 'DEBUG="1" '
|
||||
check_expansion "DEBUG='1'" "DEBUG='1' "
|
||||
check_expansion '1' 'cd -1 '
|
||||
check_expansion '"1"' '"1" '
|
||||
check_expansion "'1'" "'1' "
|
||||
check_expansion '\1' '\1 '
|
||||
check_expansion 'echo G' 'echo | grep '
|
||||
check_expansion 'DEBUG=1 1' 'DEBUG=1 cd -1 '
|
||||
check_expansion 'll' 'll '
|
||||
check_expansion 'echo $((1+2))' 'echo 3 '
|
||||
check_expansion 'echo {a,b}' 'echo a b '
|
||||
check_expansion '' ' '
|
||||
print 'All globalias expansion tests passed.'
|
||||
} always {
|
||||
zpty -d globalias-test 2>/dev/null || true
|
||||
rm -rf -- "$test_dir"
|
||||
}
|
||||
@@ -5,10 +5,40 @@ Applies some fixes for some common issues encountered with [GPG's gpg-agent](htt
|
||||
More specifically, this plugin:
|
||||
|
||||
- Updates the `GPG_TTY` environment variable before each shell execution.
|
||||
- Updates the `SSH_AUTH_SOCK` environment variable if `enable-ssh-support` is turned on.
|
||||
- Updates the `SSH_AUTH_SOCK` environment variable if `gpg-agent` is your SSH
|
||||
agent. By default the plugin checks whether `enable-ssh-support` is turned
|
||||
on. The [`ssh-support` setting](#settings) lets you say so yourself.
|
||||
|
||||
To use it, add `gpg-agent` to the plugins array of your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... gpg-agent)
|
||||
```
|
||||
|
||||
## Settings
|
||||
|
||||
Every time a shell starts, the plugin runs `gpgconf --list-options gpg-agent` to
|
||||
find out whether `enable-ssh-support` is turned on. That check can be slow. If
|
||||
you already know the answer, state it with the `ssh-support` style and the
|
||||
plugin skips the check. Set it in your zshrc, before Oh My Zsh is sourced.
|
||||
|
||||
If you don't use `gpg-agent` as your SSH agent:
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:gpg-agent' ssh-support no
|
||||
```
|
||||
|
||||
The plugin then only sets `GPG_TTY`. It leaves `SSH_AUTH_SOCK` alone, and it
|
||||
doesn't update the agent's tty before each command, which only SSH support
|
||||
needs.
|
||||
|
||||
If you do use `gpg-agent` as your SSH agent:
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:gpg-agent' ssh-support yes
|
||||
```
|
||||
|
||||
The plugin then sets `SSH_AUTH_SOCK` without checking. `enable-ssh-support`
|
||||
still has to be set in your `gpg-agent.conf` for SSH to work.
|
||||
|
||||
Leave the style unset to keep the automatic check.
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
export GPG_TTY=$TTY
|
||||
|
||||
# The ssh-support style says whether gpg-agent is used as the ssh agent.
|
||||
# Setting it saves asking gpgconf, which can be slow.
|
||||
zstyle -t ':omz:plugins:gpg-agent' ssh-support
|
||||
_gpg_agent_ssh_support=$? # 0 if yes, 1 if no, 2 if not set
|
||||
|
||||
# Everything below is only needed for ssh support
|
||||
if (( _gpg_agent_ssh_support == 1 )); then
|
||||
unset _gpg_agent_ssh_support
|
||||
return
|
||||
fi
|
||||
|
||||
# Fix for passphrase prompt on the correct tty
|
||||
# See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport
|
||||
function _gpg-agent_update-tty_preexec {
|
||||
@@ -9,9 +20,13 @@ autoload -U add-zsh-hook
|
||||
add-zsh-hook preexec _gpg-agent_update-tty_preexec
|
||||
|
||||
# If enable-ssh-support is set, fix ssh agent integration
|
||||
if [[ $(gpgconf --list-options gpg-agent 2>/dev/null | awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
|
||||
if (( _gpg_agent_ssh_support == 0 )) \
|
||||
|| [[ $(gpgconf --list-options gpg-agent 2>/dev/null \
|
||||
| awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
|
||||
unset SSH_AGENT_PID
|
||||
if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then
|
||||
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||
fi
|
||||
fi
|
||||
|
||||
unset _gpg_agent_ssh_support
|
||||
|
||||
@@ -267,6 +267,7 @@ __gradle_subcommand() {
|
||||
'-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn)' \
|
||||
'-Dorg.gradle.configuration-cache.read-only=[]' \
|
||||
'-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]' \
|
||||
'-Dorg.gradle.configuration-cache.unsafe.skip-task-logging-listeners-serialization=[]' \
|
||||
'-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
|
||||
'-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]' \
|
||||
'-Dorg.gradle.console.interactive=[]' \
|
||||
@@ -296,6 +297,7 @@ __gradle_subcommand() {
|
||||
'-Dorg.gradle.jvmargs=[]' \
|
||||
'-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug)' \
|
||||
'-Dorg.gradle.logging.stacktrace=[]' \
|
||||
'-Dorg.gradle.mirror.maven.settings=[]' \
|
||||
'-Dorg.gradle.native=[]' \
|
||||
'-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false)' \
|
||||
'-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low)' \
|
||||
@@ -407,6 +409,7 @@ _gradle() {
|
||||
'-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn):->argument-expected' \
|
||||
'-Dorg.gradle.configuration-cache.read-only=[]:->argument-expected' \
|
||||
'-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]:->argument-expected' \
|
||||
'-Dorg.gradle.configuration-cache.unsafe.skip-task-logging-listeners-serialization=[]:->argument-expected' \
|
||||
'-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]:->argument-expected' \
|
||||
'-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]:->argument-expected' \
|
||||
'-Dorg.gradle.console.interactive=[]:->argument-expected' \
|
||||
@@ -436,6 +439,7 @@ _gradle() {
|
||||
'-Dorg.gradle.jvmargs=[]:->argument-expected' \
|
||||
'-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug):->argument-expected' \
|
||||
'-Dorg.gradle.logging.stacktrace=[]:->argument-expected' \
|
||||
'-Dorg.gradle.mirror.maven.settings=[]:->argument-expected' \
|
||||
'-Dorg.gradle.native=[]:->argument-expected' \
|
||||
'-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false):->argument-expected' \
|
||||
'-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low):->argument-expected' \
|
||||
|
||||
@@ -11,7 +11,7 @@ else
|
||||
source "$ZSH_CACHE_DIR/completions/_hasura"
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hasura"
|
||||
zf_mv -f -- =( hasura completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._hasura"
|
||||
zf_mv -f -- =( hasura completion zsh ) "$ZSH_CACHE_DIR/completions/_hasura"
|
||||
} &|
|
||||
fi
|
||||
|
||||
@@ -15,8 +15,8 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hcloud"
|
||||
zf_mv -f -- =( hcloud completion zsh 2> /dev/null ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._hcloud"
|
||||
zf_mv -f -- =( hcloud completion zsh 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_hcloud"
|
||||
} &|
|
||||
|
||||
# Main alias
|
||||
|
||||
@@ -11,8 +11,8 @@ else
|
||||
source "$ZSH_CACHE_DIR/completions/_helm"
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_helm"
|
||||
zf_mv -f -- =( helm completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._helm"
|
||||
zf_mv -f -- =( helm completion zsh ) "$ZSH_CACHE_DIR/completions/_helm"
|
||||
} &|
|
||||
fi
|
||||
|
||||
|
||||
@@ -63,6 +63,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_herdr"
|
||||
zf_mv -f -- =( herdr completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._herdr"
|
||||
zf_mv -f -- =( herdr completion zsh < /dev/null 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_herdr"
|
||||
} &|
|
||||
|
||||
@@ -10,6 +10,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hermes"
|
||||
zf_mv -f -- =( hermes completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._hermes"
|
||||
zf_mv -f -- =( hermes completion zsh < /dev/null 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_hermes"
|
||||
} &|
|
||||
|
||||
@@ -13,8 +13,8 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_jj"
|
||||
zf_mv -f -- =( COMPLETE=zsh jj ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._jj"
|
||||
zf_mv -f -- =( COMPLETE=zsh jj ) "$ZSH_CACHE_DIR/completions/_jj"
|
||||
} &|
|
||||
|
||||
function __jj_prompt_jj() {
|
||||
|
||||
@@ -22,14 +22,17 @@ fi
|
||||
# Define json tools for each method
|
||||
case "$JSONTOOLS_METHOD" in
|
||||
node)
|
||||
# node doesn't make it easy to deal with stdin, so we pass it as an argument with xargs -0
|
||||
# Read stdin directly so input is not limited by command-line argument size.
|
||||
function pp_json() {
|
||||
xargs -0 node -e 'console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 4));'
|
||||
node -e '
|
||||
const input = require("fs").readFileSync(0, "utf8");
|
||||
console.log(JSON.stringify(JSON.parse(input), null, 4));
|
||||
'
|
||||
}
|
||||
function is_json() {
|
||||
xargs -0 node -e '
|
||||
node -e '
|
||||
try {
|
||||
json = JSON.parse(process.argv[1]);
|
||||
JSON.parse(require("fs").readFileSync(0, "utf8"));
|
||||
console.log("true");
|
||||
process.exit(0);
|
||||
} catch (e) {
|
||||
@@ -39,10 +42,14 @@ case "$JSONTOOLS_METHOD" in
|
||||
'
|
||||
}
|
||||
function urlencode_json() {
|
||||
xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"
|
||||
node -e '
|
||||
console.log(encodeURIComponent(require("fs").readFileSync(0, "utf8")));
|
||||
'
|
||||
}
|
||||
function urldecode_json() {
|
||||
xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"
|
||||
node -e '
|
||||
console.log(decodeURIComponent(require("fs").readFileSync(0, "utf8")));
|
||||
'
|
||||
}
|
||||
;;
|
||||
python3)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Run with: zsh -df plugins/jsontools/tests/jsontools.test.zsh
|
||||
emulate -L zsh
|
||||
setopt err_return
|
||||
|
||||
(( $+commands[node] )) || {
|
||||
print -u2 'These tests require Node.js.'
|
||||
exit 1
|
||||
}
|
||||
|
||||
JSONTOOLS_METHOD=node
|
||||
source "${0:A:h:h}/jsontools.plugin.zsh"
|
||||
local test_dir=$(mktemp -d)
|
||||
|
||||
check_output() {
|
||||
local tool=$1 description=$2 expected_status=${3:-0}
|
||||
local -i result=0
|
||||
$tool < "$test_dir/input" > "$test_dir/actual" || result=$?
|
||||
if (( result != expected_status )) \
|
||||
|| ! cmp -s "$test_dir/expected" "$test_dir/actual"; then
|
||||
print -u2 -r -- "FAIL: $description ($tool exited $result)"
|
||||
return 1
|
||||
fi
|
||||
print -r -- "PASS: $description"
|
||||
}
|
||||
|
||||
{
|
||||
print -rn -- '{"value":42}' > "$test_dir/input"
|
||||
printf '{\n "value": 42\n}\n' > "$test_dir/expected"
|
||||
check_output pp_json 'pretty-print a small document'
|
||||
|
||||
# Larger than the 128 KiB limit for a single command-line argument.
|
||||
local large_value=${(l:262144::x:):-}
|
||||
print -rn -- '{"value":"'"$large_value"'"}' > "$test_dir/input"
|
||||
printf '{\n "value": "%s"\n}\n' "$large_value" > "$test_dir/expected"
|
||||
check_output pp_json 'pretty-print a large document'
|
||||
print -r -- true > "$test_dir/expected"
|
||||
check_output is_json 'validate a large document'
|
||||
|
||||
print -r -- '%7B%22value%22%3A%22'"$large_value"'%22%7D' \
|
||||
> "$test_dir/expected"
|
||||
check_output urlencode_json 'encode a large document'
|
||||
local encoded=$(< "$test_dir/expected")
|
||||
print -rn -- "$encoded" > "$test_dir/input"
|
||||
print -r -- '{"value":"'"$large_value"'"}' > "$test_dir/expected"
|
||||
check_output urldecode_json 'decode a large document'
|
||||
|
||||
# Passed as an argument, node used to parse this as its own option.
|
||||
print -rn -- '--version' > "$test_dir/input"
|
||||
print -r -- '--version' > "$test_dir/expected"
|
||||
check_output urlencode_json 'encode input that starts with --'
|
||||
|
||||
print -rn -- '{invalid}' > "$test_dir/input"
|
||||
print -r -- false > "$test_dir/expected"
|
||||
check_output is_json 'reject invalid JSON' 1
|
||||
|
||||
printf '1\0002' > "$test_dir/input"
|
||||
check_output is_json 'reject input with NUL bytes' 1
|
||||
|
||||
print 'All jsontools Node.js tests passed.'
|
||||
} always {
|
||||
rm -rf -- "$test_dir"
|
||||
}
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
# the actual completion file will be loaded.
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_k9s"
|
||||
zf_mv -f -- =( k9s completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._k9s"
|
||||
zf_mv -f -- =( k9s completion zsh ) "$ZSH_CACHE_DIR/completions/_k9s"
|
||||
} &|
|
||||
|
||||
@@ -13,8 +13,8 @@ fi
|
||||
# Generate and load kind completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_kind"
|
||||
zf_mv -f -- =( kind completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kind"
|
||||
zf_mv -f -- =( kind completion zsh ) "$ZSH_CACHE_DIR/completions/_kind"
|
||||
} &|
|
||||
|
||||
# Register aliases
|
||||
|
||||
@@ -39,6 +39,7 @@ KUBE_PS1_HIDE_IF_NOCONTEXT="${KUBE_PS1_HIDE_IF_NOCONTEXT:-false}"
|
||||
_KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
|
||||
_KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
|
||||
_KUBE_PS1_LAST_TIME=0
|
||||
_KUBE_PS1_HAS_CONTEXT=false
|
||||
|
||||
# Determine our shell
|
||||
_kube_ps1_shell_type() {
|
||||
@@ -264,15 +265,21 @@ _kube_ps1_prompt_update() {
|
||||
[[ "${KUBE_PS1_ENABLED}" == "off" ]] && return $return_code
|
||||
|
||||
if ! _kube_ps1_binary_check "${KUBE_PS1_BINARY}"; then
|
||||
# No ability to fetch context/namespace; display N/A.
|
||||
# Unable to determine context availability; preserve the existing
|
||||
# BINARY-N/A prompt instead of treating it as no context.
|
||||
KUBE_PS1_CONTEXT="BINARY-N/A"
|
||||
KUBE_PS1_NAMESPACE="N/A"
|
||||
unset _KUBE_PS1_HAS_CONTEXT
|
||||
# Refresh when the binary becomes available again.
|
||||
_KUBE_PS1_LAST_TIME=0
|
||||
return $return_code
|
||||
fi
|
||||
|
||||
if [[ "${KUBECONFIG}" != "${_KUBE_PS1_KUBECONFIG_CACHE}" ]]; then
|
||||
# User changed KUBECONFIG; unconditionally refetch.
|
||||
_KUBE_PS1_KUBECONFIG_CACHE=${KUBECONFIG}
|
||||
if [[ "${_KUBE_PS1_LAST_TIME}" == 0 ]] ||
|
||||
[[ "${KUBECONFIG}" != "${_KUBE_PS1_KUBECONFIG_CACHE}" ]]; then
|
||||
# Fetch initially, even if no config file exists, and whenever the
|
||||
# user changes KUBECONFIG.
|
||||
_KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
|
||||
_kube_ps1_get_context_ns
|
||||
return $return_code
|
||||
fi
|
||||
@@ -300,13 +307,30 @@ _kube_ps1_prompt_update() {
|
||||
}
|
||||
|
||||
_kube_ps1_get_context() {
|
||||
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
|
||||
KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
|
||||
KUBE_PS1_CONTEXT="${KUBE_PS1_CONTEXT:-N/A}"
|
||||
local context
|
||||
|
||||
if [[ -n "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
|
||||
KUBE_PS1_CONTEXT="$("${KUBE_PS1_CLUSTER_FUNCTION}" "${KUBE_PS1_CONTEXT}")"
|
||||
fi
|
||||
# Context availability must be detected even when context display is
|
||||
# disabled but KUBE_PS1_HIDE_IF_NOCONTEXT is enabled.
|
||||
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" != true ]] &&
|
||||
[[ "${KUBE_PS1_HIDE_IF_NOCONTEXT}" != true ]]; then
|
||||
KUBE_PS1_CONTEXT=
|
||||
return
|
||||
fi
|
||||
|
||||
context="$("${KUBE_PS1_BINARY}" config current-context 2>/dev/null)"
|
||||
|
||||
_KUBE_PS1_HAS_CONTEXT=false
|
||||
[[ -n "${context}" ]] && _KUBE_PS1_HAS_CONTEXT=true
|
||||
|
||||
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" != true ]]; then
|
||||
KUBE_PS1_CONTEXT=
|
||||
return
|
||||
fi
|
||||
|
||||
KUBE_PS1_CONTEXT="${context:-N/A}"
|
||||
|
||||
if [[ -n "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
|
||||
KUBE_PS1_CONTEXT="$("${KUBE_PS1_CLUSTER_FUNCTION}" "${KUBE_PS1_CONTEXT}")"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -325,7 +349,7 @@ _kube_ps1_get_context_ns() {
|
||||
# Set the command time
|
||||
if [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
|
||||
if ((BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 2))); then
|
||||
_KUBE_PS1_LAST_TIME=$(printf '%(%s)T')
|
||||
printf -v _KUBE_PS1_LAST_TIME '%(%s)T' -1
|
||||
else
|
||||
_KUBE_PS1_LAST_TIME=$(date +%s)
|
||||
fi
|
||||
@@ -407,8 +431,11 @@ kubeoff() {
|
||||
# Build our prompt
|
||||
kube_ps1() {
|
||||
[[ "${KUBE_PS1_ENABLED}" == "off" ]] && return
|
||||
|
||||
[[ "${KUBE_PS1_HIDE_IF_NOCONTEXT}" == true ]] &&
|
||||
[[ "${_KUBE_PS1_HAS_CONTEXT}" == false ]] && return
|
||||
|
||||
[[ -z "${KUBE_PS1_CONTEXT}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]] && return
|
||||
[[ "${KUBE_PS1_CONTEXT}" == "N/A" ]] && [[ ${KUBE_PS1_HIDE_IF_NOCONTEXT} == true ]] && return
|
||||
|
||||
local KUBE_PS1
|
||||
local KUBE_PS1_RESET_COLOR="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_CLOSE_ESC}"
|
||||
|
||||
@@ -12,8 +12,8 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_kubectl"
|
||||
zf_mv -f -- =( kubectl completion zsh 2> /dev/null ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kubectl"
|
||||
zf_mv -f -- =( kubectl completion zsh 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_kubectl"
|
||||
} &|
|
||||
|
||||
# This command is used a LOT both below and in daily life
|
||||
|
||||
@@ -6,6 +6,21 @@ This plugin adds aliases and autocompletion for Laravel [Artisan](https://larave
|
||||
plugins=(... laravel)
|
||||
```
|
||||
|
||||
## Settings
|
||||
|
||||
By default the aliases run `php artisan`. To use a different PHP command, such as
|
||||
`herd php` (which runs the PHP version the [Laravel Herd](https://herd.laravel.com) site
|
||||
is isolated to, instead of Herd's global version) or a specific version like `php8.4`,
|
||||
set this before Oh My Zsh is sourced:
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:laravel' php 'herd php'
|
||||
```
|
||||
|
||||
`php` in the aliases below is then replaced with that command.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Description |
|
||||
|:-:|:-:|
|
||||
| `artisan` | `php artisan` |
|
||||
|
||||
@@ -1,51 +1,56 @@
|
||||
#!zsh
|
||||
alias artisan='php artisan'
|
||||
alias bob='php artisan bob::build'
|
||||
# Command used to run artisan, e.g. `herd php` or `php8.4` (default: `php`)
|
||||
zstyle -s ':omz:plugins:laravel' php _omz_laravel_php || _omz_laravel_php=php
|
||||
|
||||
alias artisan="$_omz_laravel_php artisan"
|
||||
alias bob="$_omz_laravel_php artisan bob::build"
|
||||
|
||||
# Development
|
||||
alias pas='php artisan serve'
|
||||
alias pad='php artisan dev'
|
||||
alias pats='php artisan test'
|
||||
alias pas="$_omz_laravel_php artisan serve"
|
||||
alias pad="$_omz_laravel_php artisan dev"
|
||||
alias pats="$_omz_laravel_php artisan test"
|
||||
|
||||
# Database
|
||||
alias pam='php artisan migrate'
|
||||
alias pamf='php artisan migrate:fresh'
|
||||
alias pamfs='php artisan migrate:fresh --seed'
|
||||
alias pamr='php artisan migrate:rollback'
|
||||
alias pads='php artisan db:seed'
|
||||
alias padw='php artisan db:wipe'
|
||||
alias pam="$_omz_laravel_php artisan migrate"
|
||||
alias pamf="$_omz_laravel_php artisan migrate:fresh"
|
||||
alias pamfs="$_omz_laravel_php artisan migrate:fresh --seed"
|
||||
alias pamr="$_omz_laravel_php artisan migrate:rollback"
|
||||
alias pads="$_omz_laravel_php artisan db:seed"
|
||||
alias padw="$_omz_laravel_php artisan db:wipe"
|
||||
|
||||
# Makers
|
||||
alias pamm='php artisan make:model'
|
||||
alias pamc='php artisan make:controller'
|
||||
alias pams='php artisan make:seeder'
|
||||
alias pamt='php artisan make:test'
|
||||
alias pamfa='php artisan make:factory'
|
||||
alias pamp='php artisan make:policy'
|
||||
alias pame='php artisan make:event'
|
||||
alias pamj='php artisan make:job'
|
||||
alias paml='php artisan make:listener'
|
||||
alias pamn='php artisan make:notification'
|
||||
alias pampp='php artisan make:provider'
|
||||
alias pamcl='php artisan make:class'
|
||||
alias pamen='php artisan make:enum'
|
||||
alias pami='php artisan make:interface'
|
||||
alias pamtr='php artisan make:trait'
|
||||
alias pamv='php artisan make:view'
|
||||
alias pammig='php artisan make:migration'
|
||||
alias pamm="$_omz_laravel_php artisan make:model"
|
||||
alias pamc="$_omz_laravel_php artisan make:controller"
|
||||
alias pams="$_omz_laravel_php artisan make:seeder"
|
||||
alias pamt="$_omz_laravel_php artisan make:test"
|
||||
alias pamfa="$_omz_laravel_php artisan make:factory"
|
||||
alias pamp="$_omz_laravel_php artisan make:policy"
|
||||
alias pame="$_omz_laravel_php artisan make:event"
|
||||
alias pamj="$_omz_laravel_php artisan make:job"
|
||||
alias paml="$_omz_laravel_php artisan make:listener"
|
||||
alias pamn="$_omz_laravel_php artisan make:notification"
|
||||
alias pampp="$_omz_laravel_php artisan make:provider"
|
||||
alias pamcl="$_omz_laravel_php artisan make:class"
|
||||
alias pamen="$_omz_laravel_php artisan make:enum"
|
||||
alias pami="$_omz_laravel_php artisan make:interface"
|
||||
alias pamtr="$_omz_laravel_php artisan make:trait"
|
||||
alias pamv="$_omz_laravel_php artisan make:view"
|
||||
alias pammig="$_omz_laravel_php artisan make:migration"
|
||||
|
||||
|
||||
# Clears
|
||||
alias pacac='php artisan cache:clear'
|
||||
alias pacoc='php artisan config:clear'
|
||||
alias pavic='php artisan view:clear'
|
||||
alias paroc='php artisan route:clear'
|
||||
alias paopc='php artisan optimize:clear'
|
||||
alias pacac="$_omz_laravel_php artisan cache:clear"
|
||||
alias pacoc="$_omz_laravel_php artisan config:clear"
|
||||
alias pavic="$_omz_laravel_php artisan view:clear"
|
||||
alias paroc="$_omz_laravel_php artisan route:clear"
|
||||
alias paopc="$_omz_laravel_php artisan optimize:clear"
|
||||
|
||||
# queues
|
||||
alias paqf='php artisan queue:failed'
|
||||
alias paqft='php artisan queue:failed-table'
|
||||
alias paql='php artisan queue:listen'
|
||||
alias paqr='php artisan queue:retry'
|
||||
alias paqt='php artisan queue:table'
|
||||
alias paqw='php artisan queue:work'
|
||||
alias paqf="$_omz_laravel_php artisan queue:failed"
|
||||
alias paqft="$_omz_laravel_php artisan queue:failed-table"
|
||||
alias paql="$_omz_laravel_php artisan queue:listen"
|
||||
alias paqr="$_omz_laravel_php artisan queue:retry"
|
||||
alias paqt="$_omz_laravel_php artisan queue:table"
|
||||
alias paqw="$_omz_laravel_php artisan queue:work"
|
||||
|
||||
unset _omz_laravel_php
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# logcli plugin
|
||||
|
||||
This plugin adds completion for [Grafana Loki's logcli](https://grafana.com/docs/loki/latest/query/logcli/).
|
||||
|
||||
To use it, add `logcli` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... logcli)
|
||||
```
|
||||
|
||||
This plugin does not add any aliases.
|
||||
|
||||
## Cache
|
||||
|
||||
This plugin caches the completion script and automatically updates it when the
|
||||
plugin is loaded, which is usually when you start a new terminal emulator.
|
||||
|
||||
The cache is stored at `$ZSH_CACHE_DIR/completions/_logcli`.
|
||||
@@ -0,0 +1,18 @@
|
||||
# Autocompletion for Grafana Loki's CLI (logcli).
|
||||
if (( ! $+commands[logcli] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `logcli`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_logcli" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _logcli
|
||||
_comps[logcli]=_logcli
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._logcli"
|
||||
zf_mv -f -- =( logcli --completion-script-zsh ) "$ZSH_CACHE_DIR/completions/_logcli"
|
||||
} &|
|
||||
@@ -12,6 +12,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_minikube"
|
||||
zf_mv -f -- =( minikube completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._minikube"
|
||||
zf_mv -f -- =( minikube completion zsh ) "$ZSH_CACHE_DIR/completions/_minikube"
|
||||
} &|
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if (( $+commands[mise] )); then
|
||||
_mise_bin=mise
|
||||
_mise_bin=$commands[mise]
|
||||
elif [[ -x ~/.local/bin/mise ]]; then
|
||||
_mise_bin=~/.local/bin/mise
|
||||
else
|
||||
@@ -8,7 +8,6 @@ fi
|
||||
|
||||
# Load mise hooks
|
||||
eval "$($_mise_bin activate zsh)"
|
||||
unset _mise_bin
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `mise`. Otherwise, compinit will have already done that.
|
||||
@@ -18,9 +17,13 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_mise" ]]; then
|
||||
_comps[mise]=_mise
|
||||
fi
|
||||
|
||||
# Generate and load mise completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_mise"
|
||||
zf_mv -f -- =( mise completion zsh ) "$TMPPREFIX"
|
||||
} &|
|
||||
# Generate completion only when missing/empty or stale relative to the mise binary.
|
||||
if [[ ! -s "$ZSH_CACHE_DIR/completions/_mise" || "$_mise_bin" -nt "$ZSH_CACHE_DIR/completions/_mise" ]]; then
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._mise"
|
||||
zf_mv -f -- =( "$_mise_bin" completion zsh ) "$ZSH_CACHE_DIR/completions/_mise"
|
||||
} &|
|
||||
fi
|
||||
|
||||
unset _mise_bin
|
||||
|
||||
@@ -13,8 +13,8 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_molecule"
|
||||
zf_mv -f -- =( _MOLECULE_COMPLETE=zsh_source molecule ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._molecule"
|
||||
zf_mv -f -- =( _MOLECULE_COMPLETE=zsh_source molecule ) "$ZSH_CACHE_DIR/completions/_molecule"
|
||||
} &|
|
||||
|
||||
# Alias
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_atlas"
|
||||
zf_mv -f -- =( atlas completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._atlas"
|
||||
zf_mv -f -- =( atlas completion zsh ) "$ZSH_CACHE_DIR/completions/_atlas"
|
||||
} &|
|
||||
|
||||
@@ -9,8 +9,8 @@ if (( $+commands[nsc] )); then
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_nsc"
|
||||
zf_mv -f -- =( nsc completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._nsc"
|
||||
zf_mv -f -- =( nsc completion zsh ) "$ZSH_CACHE_DIR/completions/_nsc"
|
||||
} &|
|
||||
fi
|
||||
|
||||
@@ -25,7 +25,7 @@ if (( $+commands[nats] )); then
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_nats"
|
||||
zf_mv -f -- =( nats --completion-script-zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._nats"
|
||||
zf_mv -f -- =( nats --completion-script-zsh ) "$ZSH_CACHE_DIR/completions/_nats"
|
||||
} &|
|
||||
fi
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_ngrok"
|
||||
zf_mv -f -- =( ngrok completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._ngrok"
|
||||
zf_mv -f -- =( ngrok completion zsh ) "$ZSH_CACHE_DIR/completions/_ngrok"
|
||||
} &|
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
# opencode plugin
|
||||
|
||||
This plugin adds completion and aliases for the [OpenCode](https://opencode.ai) CLI.
|
||||
Install OpenCode using its [installation instructions](https://opencode.ai/docs/#install),
|
||||
and make sure `opencode` is available on your `$PATH`.
|
||||
|
||||
To enable it, add `opencode` to the plugins array in your `.zshrc`:
|
||||
|
||||
```zsh
|
||||
plugins=(... opencode)
|
||||
```
|
||||
|
||||
## Learning OpenCode from the terminal
|
||||
|
||||
Use tab completion to explore commands and their descriptions without leaving the
|
||||
shell. For example, these are some of the candidates shown by the CLI:
|
||||
|
||||
```text
|
||||
$ opencode <TAB>
|
||||
agent -- manage agents
|
||||
models -- list all available models
|
||||
run -- run opencode with a message
|
||||
session -- manage sessions
|
||||
stats -- show token usage and cost statistics
|
||||
...
|
||||
|
||||
$ opencode session <TAB>
|
||||
delete -- delete a session
|
||||
list -- list sessions
|
||||
|
||||
$ opencode run --<TAB>
|
||||
--agent -- agent to use
|
||||
--continue -- continue the last session
|
||||
--file -- file(s) to attach to message
|
||||
--model -- model to use in the format of provider/model
|
||||
...
|
||||
```
|
||||
|
||||
Completion works through the aliases too. Type a partial command or option and
|
||||
press Tab to finish it:
|
||||
|
||||
```text
|
||||
$ opc session li<TAB>
|
||||
$ opc session list
|
||||
|
||||
$ opcr --att<TAB>
|
||||
$ opcr --attach
|
||||
|
||||
$ opcc --log-l<TAB>
|
||||
$ opcc --log-level
|
||||
```
|
||||
|
||||
Candidates depend on your installed OpenCode version. In OpenCode 1.18.29, the
|
||||
CLI's completion output omits top-level TUI flags such as `--model` and `--fork`,
|
||||
even though those flags work when typed. Use `opencode --help` or
|
||||
`opencode run --help` for the full options, and see the
|
||||
[CLI reference](https://opencode.ai/docs/cli/) for more workflows.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------ | --------------------- | ----------------------------------- |
|
||||
| `opc` | `opencode` | Launch the terminal UI |
|
||||
| `opcc` | `opencode --continue` | Continue the last session |
|
||||
| `opcr` | `opencode run` | Run a prompt without opening the UI |
|
||||
|
||||
To keep completion but skip the aliases, set this in your `.zshrc`, above the line
|
||||
that sources Oh My Zsh:
|
||||
|
||||
```zsh
|
||||
# ~/.zshrc
|
||||
zstyle ':omz:plugins:opencode' aliases no
|
||||
|
||||
plugins=(... opencode)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
```
|
||||
|
||||
## Common workflows
|
||||
|
||||
All aliases accept additional arguments:
|
||||
|
||||
```zsh
|
||||
# Open a project
|
||||
opc ~/projects/my-app
|
||||
|
||||
# Explore a different approach by forking the last session
|
||||
opcc --fork
|
||||
|
||||
# Ask a question without entering the terminal UI
|
||||
opcr "Explain the test setup in this project"
|
||||
|
||||
# Reuse an already running backend to avoid MCP server cold starts
|
||||
opcr --attach http://localhost:4096 "Explain this project's architecture"
|
||||
```
|
||||
|
||||
## Completion
|
||||
|
||||
Completion queries the installed OpenCode CLI on demand for commands and options,
|
||||
including through the aliases above. It falls back to Zsh's default completion when
|
||||
the CLI returns no candidates. No OpenCode process is started at shell startup,
|
||||
and no generated completion cache is needed.
|
||||
|
||||
## Credits
|
||||
|
||||
Based on the OpenCode plugin proposals by
|
||||
[pranavavva](https://github.com/pranavavva) in
|
||||
[#13545](https://github.com/ohmyzsh/ohmyzsh/pull/13545) and
|
||||
[mskadu](https://github.com/mskadu) in
|
||||
[#13794](https://github.com/ohmyzsh/ohmyzsh/pull/13794).
|
||||
The completion adapter is derived from OpenCode's `opencode completion` output.
|
||||
@@ -0,0 +1,12 @@
|
||||
#compdef opencode
|
||||
|
||||
# Adapted from `opencode completion`, using the CLI's live Yargs completions.
|
||||
local -a reply
|
||||
reply=("${(@f)$(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" \
|
||||
command opencode --get-yargs-completions "${words[@]}" < /dev/null 2> /dev/null)}")
|
||||
|
||||
if [[ -n "${reply[1]}" ]]; then
|
||||
_describe 'values' reply
|
||||
else
|
||||
_default
|
||||
fi
|
||||
@@ -0,0 +1,7 @@
|
||||
if (( ! $+commands[opencode] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
alias opc='opencode'
|
||||
alias opcc='opencode --continue'
|
||||
alias opcr='opencode run'
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pass-cli"
|
||||
zf_mv -f -- =( pass-cli completions zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._pass-cli"
|
||||
zf_mv -f -- =( pass-cli completions zsh ) "$ZSH_CACHE_DIR/completions/_pass-cli"
|
||||
} &|
|
||||
|
||||
@@ -45,8 +45,8 @@ else
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pipenv"
|
||||
zf_mv -f -- =( _PIPENV_COMPLETE=zsh_source pipenv ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._pipenv"
|
||||
zf_mv -f -- =( _PIPENV_COMPLETE=zsh_source pipenv ) "$ZSH_CACHE_DIR/completions/_pipenv"
|
||||
} &|
|
||||
fi
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_podman"
|
||||
zf_mv -f -- =( podman completion zsh 2> /dev/null ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._podman"
|
||||
zf_mv -f -- =( podman completion zsh 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_podman"
|
||||
} &|
|
||||
|
||||
alias pbl='podman build'
|
||||
|
||||
@@ -41,6 +41,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_poetry"
|
||||
zf_mv -f -- =( poetry completions zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._poetry"
|
||||
zf_mv -f -- =( poetry completions zsh ) "$ZSH_CACHE_DIR/completions/_poetry"
|
||||
} &|
|
||||
|
||||
@@ -12,7 +12,7 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_procs"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._procs"
|
||||
autoload -Uz is-at-least
|
||||
local _version=$(procs --version)
|
||||
zf_mv -f -- =(
|
||||
@@ -21,5 +21,5 @@ zmodload -F zsh/files b:zf_mv
|
||||
else
|
||||
procs --completion-out zsh
|
||||
fi
|
||||
) "$TMPPREFIX"
|
||||
) "$ZSH_CACHE_DIR/completions/_procs"
|
||||
} &|
|
||||
|
||||
@@ -12,8 +12,8 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pulumi"
|
||||
zf_mv -f -- =( pulumi gen-completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._pulumi"
|
||||
zf_mv -f -- =( pulumi gen-completion zsh ) "$ZSH_CACHE_DIR/completions/_pulumi"
|
||||
} &|
|
||||
|
||||
# Aliases
|
||||
|
||||
@@ -29,7 +29,7 @@ function pyuserpaths() {
|
||||
|
||||
# Get minor release version.
|
||||
# The patch version is variable length, truncate it.
|
||||
version=${(M)${"$($python -V 2>&1)":7}#[^.]##.[^.]##}
|
||||
version=${(M)${"$($python -V 2>&1)":7}##[^.]##.[^.]##}
|
||||
|
||||
# Add version specific path, if:
|
||||
# - it exists in the filesystem
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_qodana"
|
||||
zf_mv -f -- =( qodana completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._qodana"
|
||||
zf_mv -f -- =( qodana completion zsh ) "$ZSH_CACHE_DIR/completions/_qodana"
|
||||
} &|
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby
|
||||
version and gemset information into your prompt.
|
||||
|
||||
Additionally, this plugin provides completion for the `rbenv` command. See also <https://github.com/rbenv/rbenv/#shell-completions>.
|
||||
|
||||
Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed.
|
||||
https://github.com/jf/rbenv-gemset
|
||||
|
||||
|
||||
@@ -24,6 +24,13 @@ if [[ $FOUND_RBENV -ne 1 ]]; then
|
||||
fi
|
||||
|
||||
if [[ $FOUND_RBENV -eq 1 ]]; then
|
||||
rbenv_completions="${commands[rbenv]:A:h:h}/completions"
|
||||
if [[ -f "$rbenv_completions/_rbenv" ]]; then
|
||||
fpath+=("$rbenv_completions")
|
||||
autoload -Uz _rbenv
|
||||
compdef _rbenv rbenv
|
||||
fi
|
||||
|
||||
eval "$(rbenv init --no-rehash - zsh)"
|
||||
|
||||
alias rubies="rbenv versions"
|
||||
@@ -65,4 +72,4 @@ else
|
||||
}
|
||||
fi
|
||||
|
||||
unset FOUND_RBENV rbenvdirs dir
|
||||
unset FOUND_RBENV rbenvdirs dir rbenv_completions
|
||||
|
||||
@@ -12,8 +12,8 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rbw"
|
||||
zf_mv -f -- =( rbw gen-completions zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._rbw"
|
||||
zf_mv -f -- =( rbw gen-completions zsh ) "$ZSH_CACHE_DIR/completions/_rbw"
|
||||
} &|
|
||||
|
||||
# rbwpw function copies the password of a service to the clipboard
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rclone"
|
||||
zf_mv -f -- =( rclone completion zsh - ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._rclone"
|
||||
zf_mv -f -- =( rclone completion zsh - ) "$ZSH_CACHE_DIR/completions/_rclone"
|
||||
} &|
|
||||
|
||||
@@ -14,9 +14,9 @@ plugins=(... ruby)
|
||||
| ------- | -------------------------------------- | ---------------------------------------------------- |
|
||||
| rb | `ruby` | The Ruby command |
|
||||
| sgem | `sudo gem` | Run sudo gem on the system ruby, not the active ruby |
|
||||
| rfind | `find . -name "*.rb" \| xargs grep -n` | Find ruby file |
|
||||
| rfind | `find . -name "*.rb" -print0 \| xargs -0 grep -n` | Find ruby file |
|
||||
| rrun | `ruby -e` | Execute some code: E.g: `rrun "puts 'Hello world!'"` |
|
||||
| rserver | `ruby -e httpd . -p 8080` | Start HTTP Webrick serving local directory/files |
|
||||
| rserver | `ruby -run -e httpd . -p 8080` | Start HTTP Webrick serving local directory/files |
|
||||
| gein | `gem install` | Install a gem into the local repository |
|
||||
| geun | `gem uninstall` | Uninstall gems from the local repository |
|
||||
| geli | `gem list` | Display gems installed locally |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
alias sgem='sudo gem'
|
||||
|
||||
# Find ruby file
|
||||
alias rfind='find . -name "*.rb" | xargs grep -n'
|
||||
alias rfind='find . -name "*.rb" -print0 | xargs -0 grep -n'
|
||||
|
||||
# Shorthand Ruby
|
||||
alias rb="ruby"
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
emulate -LR zsh
|
||||
|
||||
source "${1:-${0:A:h:h}/ruby.plugin.zsh}"
|
||||
|
||||
test_dir=$(mktemp -d) || exit 1
|
||||
trap 'command rm -rf -- "$test_dir"' EXIT
|
||||
|
||||
typeset -i failures=0 tests=0
|
||||
typeset filename output
|
||||
|
||||
for filename in plain.rb 'file with spaces.rb' "single'quote.rb" 'double"quote.rb' $'line\nbreak.rb' 'unicode-ą.rb'; do
|
||||
print -r -- 'needle' >| "$test_dir/$filename"
|
||||
output=$(cd "$test_dir" && rfind needle 2> "$test_dir/stderr")
|
||||
actual_status=$?
|
||||
(( tests++ ))
|
||||
|
||||
if [[ $actual_status == 0 && $output == '1:needle' && ! -s "$test_dir/stderr" ]]; then
|
||||
print -r -- "PASS: ${(qqq)filename}"
|
||||
else
|
||||
print -u2 -r -- "FAIL: ${(qqq)filename} (status $actual_status)"
|
||||
print -u2 -r -- " stdout: ${(qqq)output}"
|
||||
print -u2 -r -- " stderr: $(<"$test_dir/stderr")"
|
||||
(( failures++ ))
|
||||
fi
|
||||
|
||||
command rm -- "$test_dir/$filename"
|
||||
done
|
||||
|
||||
print -r -- "$tests tests, $failures failures"
|
||||
(( failures == 0 ))
|
||||
@@ -22,6 +22,6 @@ fi
|
||||
# Overwrites the file each time as completions might change with ruff versions.
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_ruff"
|
||||
zf_mv -f -- =( ruff generate-shell-completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._ruff"
|
||||
zf_mv -f -- =( ruff generate-shell-completion zsh ) "$ZSH_CACHE_DIR/completions/_ruff"
|
||||
} &|
|
||||
|
||||
@@ -21,8 +21,8 @@ fi
|
||||
# Generate completion files in the background
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rustup"
|
||||
zf_mv -f -- =( rustup completions zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._rustup"
|
||||
zf_mv -f -- =( rustup completions zsh ) "$ZSH_CACHE_DIR/completions/_rustup"
|
||||
} &|
|
||||
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
|
||||
#compdef cargo
|
||||
|
||||
+1
-1
@@ -237,7 +237,7 @@ case "$words[1]" in
|
||||
'(-c|--noancestors)'{-c,--noancestors}'[do not include second-generation package ancestors in the scratch org]' \
|
||||
'(-i|--clientid)'{-i,--clientid}'[connected app consumer key]' \
|
||||
'(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the created org as the default username]' \
|
||||
'(-a|--setalias)'{-a,--setalias}'[set an alias for for the created scratch org]' \
|
||||
'(-a|--setalias)'{-a,--setalias}'[set an alias for the created scratch org]' \
|
||||
'(-e|--env)'{-e,--env}'[environment where the scratch org is created: \[sandbox*,virtual,prototype\] (sandbox*,virtual,prototype)]' \
|
||||
'(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \
|
||||
'(-d|--durationdays)'{-d,--durationdays}'[duration of the scratch org (in days) (default:7, min:1, max:30)]' \
|
||||
|
||||
@@ -14,8 +14,8 @@ function install_autocompletion {
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_$1"
|
||||
zf_mv -f -- =( $1 completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._$1"
|
||||
zf_mv -f -- =( $1 completion zsh ) "$ZSH_CACHE_DIR/completions/_$1"
|
||||
} "$1" &|
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_skaffold"
|
||||
zf_mv -f -- =( skaffold completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._skaffold"
|
||||
zf_mv -f -- =( skaffold completion zsh ) "$ZSH_CACHE_DIR/completions/_skaffold"
|
||||
} &|
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
## Sops Plugin
|
||||
|
||||
This plugin sets up completion for [sops](https://getsops.io).
|
||||
@@ -0,0 +1,18 @@
|
||||
# COMPLETION FUNCTION
|
||||
if (( ! $+commands[sops] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `sops`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_sops" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _sops
|
||||
_comps[sops]=_sops
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._sops"
|
||||
zf_mv -f -- =( sops completion zsh ) "$ZSH_CACHE_DIR/completions/_sops"
|
||||
} &|
|
||||
@@ -12,6 +12,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_stripe"
|
||||
zf_mv -f -- =( stripe completion --shell zsh --write-to-stdout ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._stripe"
|
||||
zf_mv -f -- =( stripe completion --shell zsh --write-to-stdout ) "$ZSH_CACHE_DIR/completions/_stripe"
|
||||
} &|
|
||||
|
||||
@@ -24,6 +24,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_tailscale"
|
||||
zf_mv -f -- =( tailscale completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._tailscale"
|
||||
zf_mv -f -- =( tailscale completion zsh ) "$ZSH_CACHE_DIR/completions/_tailscale"
|
||||
} &|
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
# Generate and load task completion
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_task"
|
||||
zf_mv -f -- =( task --completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._task"
|
||||
zf_mv -f -- =( task --completion zsh ) "$ZSH_CACHE_DIR/completions/_task"
|
||||
} &|
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_timoni"
|
||||
zf_mv -f -- =( timoni completion zsh ) "$TMPPREFIX"
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._timoni"
|
||||
zf_mv -f -- =( timoni completion zsh ) "$ZSH_CACHE_DIR/completions/_timoni"
|
||||
} &|
|
||||
|
||||
@@ -52,7 +52,7 @@ The plugin will generate a default archive filename based on the input:
|
||||
|
||||
| Format | Description | Tool Used |
|
||||
|:-----------------|:-------------------------------|:-----------------|
|
||||
| `7z` | 7zip archive | `7z` |
|
||||
| `7z` | 7zip archive | `7zz`,`7z`,`7za` |
|
||||
| `bz2` | Bzip2-compressed file | `bzip2` |
|
||||
| `gz` | Gzip-compressed file | `gzip` |
|
||||
| `lzma` | LZMA-compressed file | `lzma` |
|
||||
|
||||
@@ -49,7 +49,17 @@ tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst."
|
||||
fi
|
||||
|
||||
case "$ext" in
|
||||
7z) 7z u "${output}" "${@}" ;;
|
||||
7z)
|
||||
if (( $+commands[7zz] )); then
|
||||
7zz u "${output}" "${@}"
|
||||
elif (( $+commands[7z] )); then
|
||||
7z u "${output}" "${@}"
|
||||
elif (( $+commands[7za] )); then
|
||||
7za u "${output}" "${@}"
|
||||
else
|
||||
echo "ua: cannot create 7z files: install 7zz, 7z or 7za" >&2
|
||||
return 1
|
||||
fi ;;
|
||||
bz2) bzip2 -vcf "${@}" > "${output}" ;;
|
||||
gz) gzip -vcf "${@}" > "${output}" ;;
|
||||
lzma) lzma -vc -T0 "${@}" > "${output}" ;;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user