mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
Merge branch 'master' into feature/clear-evicted-pods
This commit is contained in:
commit
3d16546946
190 changed files with 4251 additions and 1369 deletions
|
|
@ -1,9 +1,15 @@
|
|||
# Do nothing if op is not installed
|
||||
(( ${+commands[op]} )) || return
|
||||
|
||||
# Load op completion
|
||||
eval "$(op completion zsh)"
|
||||
compdef _op op
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `op`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_op" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _op
|
||||
_comps[op]=_op
|
||||
fi
|
||||
|
||||
op completion zsh >| "$ZSH_CACHE_DIR/completions/_op" &|
|
||||
|
||||
# Load opswd function
|
||||
autoload -Uz opswd
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function opswd() {
|
|||
|
||||
local password
|
||||
# Copy the password to the clipboard
|
||||
if ! password=$(op item get "$service" --fields password 2>/dev/null); then
|
||||
if ! password=$(op item get "$service" --reveal --fields password 2>/dev/null); then
|
||||
echo "error: could not obtain password for $service"
|
||||
return 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ plugins=(... alias-finder)
|
|||
|
||||
To enable it for every single command, set zstyle in your `~/.zshrc`.
|
||||
|
||||
If the user has installed `rg`([ripgrep](https://github.com/BurntSushi/ripgrep)), it will be used because it's faster. Otherwise, it will use the `grep` command.
|
||||
|
||||
```zsh
|
||||
# ~/.zshrc
|
||||
|
||||
|
|
@ -28,7 +30,7 @@ When you execute a command alias finder will look at your defined aliases and su
|
|||
|
||||
Running the un-aliased `git status` command:
|
||||
```sh
|
||||
╭─tim@fox ~/repo/gitopolis ‹main›
|
||||
╭─tim@fox ~/repo/gitopolis ‹main›
|
||||
╰─$ git status
|
||||
|
||||
gst='git status' # <=== shorter suggestion from alias-finder
|
||||
|
|
@ -40,7 +42,7 @@ nothing to commit, working tree clean
|
|||
|
||||
Running a shorter `git st` alias from `.gitconfig` that it suggested :
|
||||
```sh
|
||||
╭─tim@fox ~/repo/gitopolis ‹main›
|
||||
╭─tim@fox ~/repo/gitopolis ‹main›
|
||||
╰─$ git st
|
||||
gs='git st' # <=== shorter suggestion from alias-finder
|
||||
## main...origin/main
|
||||
|
|
@ -48,7 +50,7 @@ gs='git st' # <=== shorter suggestion from alias-finder
|
|||
|
||||
Running the shortest `gs` shell alias that it found:
|
||||
```sh
|
||||
╭─tim@fox ~/repo/gitopolis ‹main›
|
||||
╭─tim@fox ~/repo/gitopolis ‹main›
|
||||
╰─$ gs
|
||||
# <=== no suggestions alias-finder because this is the shortest
|
||||
## main...origin/main
|
||||
|
|
|
|||
|
|
@ -36,14 +36,22 @@ alias-finder() {
|
|||
# make filter to find only shorter results than current cmd
|
||||
if [[ $cheaper == true ]]; then
|
||||
cmdLen=$(echo -n "$cmd" | wc -c)
|
||||
filter="^'{0,1}.{0,$((cmdLen - 1))}="
|
||||
if [[ $cmdLen -le 1 ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
filter="^'?.{1,$((cmdLen - 1))}'?=" # some aliases is surrounded by single quotes
|
||||
fi
|
||||
|
||||
alias | grep -E "$filter" | grep -E "=$finder"
|
||||
if (( $+commands[rg] )); then
|
||||
alias | rg "$filter" | rg "=$finder"
|
||||
else
|
||||
alias | grep -E "$filter" | grep -E "=$finder"
|
||||
fi
|
||||
|
||||
if [[ $exact == true ]]; then
|
||||
break # because exact case is only one
|
||||
elif [[ $longer = true ]]; then
|
||||
elif [[ $longer == true ]]; then
|
||||
break # because above grep command already found every longer aliases during first cycle
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -178,26 +178,27 @@ fi
|
|||
|
||||
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
||||
function upgrade() {
|
||||
sudo pacman -Sy
|
||||
echo ":: Checking Arch Linux PGP Keyring..."
|
||||
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
if [ $installedver != $currentver ]; then
|
||||
echo " Arch Linux PGP Keyring is out of date."
|
||||
echo " Updating before full system upgrade."
|
||||
sudo pacman -Sy --needed --noconfirm archlinux-keyring
|
||||
sudo pacman -S --needed --noconfirm archlinux-keyring
|
||||
else
|
||||
echo " Arch Linux PGP Keyring is up to date."
|
||||
echo " Proceeding with full system upgrade."
|
||||
fi
|
||||
if (( $+commands[yay] )); then
|
||||
yay -Syu
|
||||
yay -Su
|
||||
elif (( $+commands[trizen] )); then
|
||||
trizen -Syu
|
||||
trizen -Su
|
||||
elif (( $+commands[pacaur] )); then
|
||||
pacaur -Syu
|
||||
pacaur -Su
|
||||
elif (( $+commands[aura] )); then
|
||||
sudo aura -Syu
|
||||
sudo aura -Su
|
||||
else
|
||||
sudo pacman -Syu
|
||||
sudo pacman -Su
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,48 @@
|
|||
## asdf
|
||||
# asdf
|
||||
|
||||
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
|
||||
|
||||
### Installation
|
||||
## Installation
|
||||
|
||||
1. [Download asdf](https://asdf-vm.com/guide/getting-started.html#_2-download-asdf) by running the following:
|
||||
|
||||
```
|
||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
||||
```
|
||||
|
||||
2. [Enable asdf](https://asdf-vm.com/guide/getting-started.html#_3-install-asdf) by adding it to your `plugins` definition in `~/.zshrc`.
|
||||
|
||||
```
|
||||
plugins=(asdf)
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
See the [asdf documentation](https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin) for information on how to use asdf:
|
||||
1. [Install](https://asdf-vm.com/guide/getting-started.html#_1-install-asdf) asdf and ensure that's it's discoverable on `$PATH`;
|
||||
2. Enable it by adding it to your `plugins` definition in `~/.zshrc`:
|
||||
|
||||
```sh
|
||||
plugins=(asdf)
|
||||
```
|
||||
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
|
||||
|
||||
## Usage
|
||||
|
||||
Refer to the [asdf plugin documentation](https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin) for information on how to add a plugin and install the many runtime versions for it.
|
||||
|
||||
Example for installing the nodejs plugin and the many runtimes for it:
|
||||
|
||||
```sh
|
||||
# Add plugin to asdf
|
||||
asdf plugin add nodejs
|
||||
|
||||
# Install the latest available version
|
||||
asdf install nodejs latest
|
||||
asdf global nodejs latest
|
||||
asdf local nodejs latest
|
||||
|
||||
# Uninstall the latest version
|
||||
asdf uninstall nodejs latest
|
||||
|
||||
# Install a specific version
|
||||
asdf install nodejs 16.5.0
|
||||
|
||||
# Set the latest version in .tool-versions of the `current directory`
|
||||
asdf set nodejs latest
|
||||
|
||||
# Set a specific version in the `parent directory`
|
||||
asdf set -p nodejs 16.5.0 # -p is shorthand for --parent
|
||||
|
||||
# Set a global version under `$HOME`
|
||||
asdf set -u nodejs 16.5.0 # -u is shorthand for --home
|
||||
```
|
||||
|
||||
### Maintainer
|
||||
For more commands, run `asdf help` or refer to the
|
||||
[asdf CLI documentation](https://asdf-vm.com/manage/commands.html#all-commands).
|
||||
|
||||
## Maintainer
|
||||
|
||||
- [@RobLoach](https://github.com/RobLoach)
|
||||
|
|
|
|||
|
|
@ -1,30 +1,13 @@
|
|||
# Find where asdf should be installed
|
||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
||||
(( ! $+commands[asdf] )) && return
|
||||
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
||||
if [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
||||
ASDF_DIR="/opt/asdf-vm"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR"
|
||||
# If not found, check for Homebrew package
|
||||
elif (( $+commands[brew] )); then
|
||||
_ASDF_PREFIX="$(brew --prefix asdf)"
|
||||
ASDF_DIR="${_ASDF_PREFIX}/libexec"
|
||||
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
|
||||
unset _ASDF_PREFIX
|
||||
else
|
||||
return
|
||||
fi
|
||||
fi
|
||||
export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
|
||||
path=("$ASDF_DATA_DIR/shims" $path)
|
||||
|
||||
# Load command
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
source "$ASDF_DIR/asdf.sh"
|
||||
# Load completions
|
||||
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||
fpath+=("$ASDF_COMPLETIONS")
|
||||
autoload -Uz _asdf
|
||||
compdef _asdf asdf # compdef is already loaded before loading plugins
|
||||
fi
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `asdf`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _asdf
|
||||
_comps[asdf]=_asdf
|
||||
fi
|
||||
asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ autojump_paths=(
|
|||
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
|
||||
/etc/profiles/per-user/$USER/share/autojump/autojump.zsh # Home Manager, NixOS with user-scoped packages
|
||||
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
|
||||
$PREFIX/share/autojump/autojump.zsh # Termux package
|
||||
/etc/profile.d/autojump.zsh # manual installation
|
||||
/etc/profile.d/autojump.sh # Gentoo installation
|
||||
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# Bazel plugin
|
||||
|
||||
This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool that scalably supports multi-language and multi-platform projects.
|
||||
This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool
|
||||
that scalably supports multi-language and multi-platform projects.
|
||||
|
||||
To use it, add `bazel` to the plugins array in your zshrc file:
|
||||
|
||||
|
|
@ -14,9 +15,15 @@ The plugin has a copy of [the completion script from the git repository][1].
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------- | -------------------------------------- | ------------------------------------------------------ |
|
||||
| bzb | `bazel build` | The `bazel build` command |
|
||||
| bzt | `bazel test` | The `bazel test` command |
|
||||
| bzr | `bazel run` | The `bazel run` command |
|
||||
| bzq | `bazel query` | The `bazel query` command |
|
||||
| Alias | Command | Description |
|
||||
| ----- | ------------- | ------------------------- |
|
||||
| bzb | `bazel build` | The `bazel build` command |
|
||||
| bzt | `bazel test` | The `bazel test` command |
|
||||
| bzr | `bazel run` | The `bazel run` command |
|
||||
| bzq | `bazel query` | The `bazel query` command |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| -------- | -------------------------------- |
|
||||
| sri-hash | Generate SRI hash used by bzlmod |
|
||||
|
|
|
|||
|
|
@ -3,3 +3,7 @@ alias bzb='bazel build'
|
|||
alias bzt='bazel test'
|
||||
alias bzr='bazel run'
|
||||
alias bzq='bazel query'
|
||||
|
||||
sri-hash() {
|
||||
openssl dgst -sha256 -binary $1 | openssl base64 -A | sed 's/^/sha256-/'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ case $state in
|
|||
"random[Generate random intervals in a genome.]" \
|
||||
"reldist[Calculate the distribution of relative distances b/w two files.]" \
|
||||
"sample[Sample random records from file using reservoir sampling.]" \
|
||||
"shuffle[Randomly redistrubute intervals in a genome.]" \
|
||||
"shuffle[Randomly redistribute intervals in a genome.]" \
|
||||
"slop[Adjust the size of intervals.]" \
|
||||
"sort[Order the intervals in a file.]" \
|
||||
"subtract[Remove intervals based on overlaps b/w two files.]" \
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ One can configure a few things:
|
|||
- `bgnotify_bell` enabled or disables the terminal bell (default true)
|
||||
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
|
||||
- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
|
||||
- `bgnotify_extraargs` appends extra args to notifier (e.g. `-e` for notify-send to create a transient notification)
|
||||
|
||||
Use these by adding a function definition before the your call to source. Example:
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ function bgnotify_formatted {
|
|||
function bgnotify_appid {
|
||||
if (( ${+commands[osascript]} )); then
|
||||
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
|
||||
elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )); then # wayland+sway
|
||||
elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
|
||||
local app_id=$(bgnotify_find_sway_appid)
|
||||
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
|
||||
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
|
||||
|
|
@ -117,15 +117,15 @@ function bgnotify {
|
|||
local icon="$3"
|
||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||
local term_id=$(bgnotify_programid)
|
||||
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} &>/dev/null
|
||||
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} ${=bgnotify_extraargs:-} &>/dev/null
|
||||
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
||||
growlnotify -m "$title" "$message"
|
||||
growlnotify -m "$title" "$message" ${=bgnotify_extraargs:-}
|
||||
elif (( ${+commands[notify-send]} )); then
|
||||
notify-send "$title" "$message" ${=icon:+--icon "$icon"}
|
||||
notify-send "$title" "$message" ${=icon:+--icon "$icon"} ${=bgnotify_extraargs:-}
|
||||
elif (( ${+commands[kdialog]} )); then # KDE
|
||||
kdialog --title "$title" --passivepopup "$message" 5
|
||||
kdialog --title "$title" --passivepopup "$message" 5 ${=bgnotify_extraargs:-}
|
||||
elif (( ${+commands[notifu]} )); then # cygwin
|
||||
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"}
|
||||
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"} ${=bgnotify_extraargs:-}
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function branch_prompt_info() {
|
|||
while [[ "$dir" != '/' ]]; do
|
||||
# Found .git directory
|
||||
if [[ -d "${dir}/.git" ]]; then
|
||||
branch="${"$(<"${dir}/.git/HEAD")"##*/}"
|
||||
branch="${"$(<"${dir}/.git/HEAD")"##ref: refs/heads/}"
|
||||
echo '±' "${branch:gs/%/%%}"
|
||||
return
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ if (( ! $+commands[brew] )); then
|
|||
fi
|
||||
|
||||
if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
||||
# Maintain compatability with potential custom user profiles, where we had
|
||||
# Maintain compatibility with potential custom user profiles, where we had
|
||||
# previously relied on always sourcing shellenv. OMZ plugins should not rely
|
||||
# on this to be defined due to out of order processing.
|
||||
export HOMEBREW_PREFIX="$(brew --prefix)"
|
||||
|
|
|
|||
9
plugins/buf/README.md
Normal file
9
plugins/buf/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Buf plugin
|
||||
|
||||
This plugin adds completion for [Buf CLI](https://github.com/bufbuild/buf), a tool working with Protocol Buffers.
|
||||
|
||||
To use it, add `buf` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... buf)
|
||||
```
|
||||
14
plugins/buf/buf.plugin.zsh
Normal file
14
plugins/buf/buf.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Autocompletion for the Buf CLI (buf).
|
||||
if (( !$+commands[buf] )); then
|
||||
return
|
||||
fi
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `buf`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_buf" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _buf
|
||||
_comps[buf]=_buf
|
||||
fi
|
||||
|
||||
# Generate and load buf completion
|
||||
buf completion zsh >! "$ZSH_CACHE_DIR/completions/_buf" &|
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
# catimg
|
||||
|
||||
Plugin for displaying images on the terminal using the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
||||
Plugin for displaying images on the terminal using the `catimg.sh` script provided by
|
||||
[posva](https://github.com/posva/catimg)
|
||||
|
||||
To use it, add `catimg` to the plugins array in your zshrc file:
|
||||
|
||||
|
|
@ -10,7 +11,7 @@ plugins=(... catimg)
|
|||
|
||||
## Requirements
|
||||
|
||||
- `convert` (ImageMagick)
|
||||
- `magick convert` (ImageMagick)
|
||||
|
||||
## Functions
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@
|
|||
|
||||
|
||||
function catimg() {
|
||||
if [[ -x `which convert` ]]; then
|
||||
zsh $ZSH/plugins/catimg/catimg.sh $@
|
||||
if (( $+commands[magick] )); then
|
||||
CONVERT_CMD="magick" zsh $ZSH/plugins/catimg/catimg.sh $@
|
||||
elif (( $+commands[convert] )); then
|
||||
CONVERT_CMD="convert" zsh $ZSH/plugins/catimg/catimg.sh $@
|
||||
else
|
||||
echo "catimg need convert (ImageMagick) to work)"
|
||||
echo "catimg need magick/convert (ImageMagick) to work)"
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
# GitHub: https://github.com/posva/catimg #
|
||||
################################################################################
|
||||
|
||||
# this should come from outside, either `magick` or `convert`
|
||||
# from imagemagick v7 and ahead `convert` is deprecated
|
||||
: ${CONVERT_CMD:=convert}
|
||||
|
||||
function help() {
|
||||
echo "Usage catimg [-h] [-w width] [-c char] img"
|
||||
echo "By default char is \" \" and w is the terminal width"
|
||||
|
|
@ -43,23 +47,23 @@ if [ ! "$WIDTH" ]; then
|
|||
else
|
||||
COLS=$(expr $WIDTH "/" $(echo -n "$CHAR" | wc -c))
|
||||
fi
|
||||
WIDTH=$(convert "$IMG" -print "%w\n" /dev/null)
|
||||
WIDTH=$($CONVERT_CMD "$IMG" -print "%w\n" /dev/null)
|
||||
if [ "$WIDTH" -gt "$COLS" ]; then
|
||||
WIDTH=$COLS
|
||||
fi
|
||||
|
||||
REMAP=""
|
||||
if convert "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
|
||||
if $CONVERT_CMD "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
|
||||
REMAP="-remap $COLOR_FILE"
|
||||
else
|
||||
echo "The version of convert is too old, don't expect good results :(" >&2
|
||||
#convert "$IMG" -colors 256 PNG8:tmp.png
|
||||
#IMG="tmp.png"
|
||||
# $CONVERT_CMD "$IMG" -colors 256 PNG8:tmp.png
|
||||
# IMG="tmp.png"
|
||||
fi
|
||||
|
||||
# Display the image
|
||||
I=0
|
||||
convert "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
|
||||
$CONVERT_CMD "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
|
||||
sed -e 's/.*none.*/NO NO NO/g' -e '1d;s/^.*(\(.*\)[,)].*$/\1/g;y/,/ /' |
|
||||
while read R G B f; do
|
||||
if [ ! "$R" = "NO" ]; then
|
||||
|
|
|
|||
11
plugins/chezmoi/README.md
Normal file
11
plugins/chezmoi/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# chezmoi Plugin
|
||||
|
||||
## Introduction
|
||||
|
||||
This `chezmoi` plugin sets up completion for [chezmoi](https://chezmoi.io).
|
||||
|
||||
To use it, add `chezmoi` to the plugins array of your zshrc file:
|
||||
|
||||
```bash
|
||||
plugins=(... chezmoi)
|
||||
```
|
||||
14
plugins/chezmoi/chezmoi.plugin.zsh
Normal file
14
plugins/chezmoi/chezmoi.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# COMPLETION FUNCTION
|
||||
if (( ! $+commands[chezmoi] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `chezmoi`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_chezmoi" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _chezmoi
|
||||
_comps[chezmoi]=_chezmoi
|
||||
fi
|
||||
|
||||
chezmoi completion zsh >| "$ZSH_CACHE_DIR/completions/_chezmoi" &|
|
||||
|
|
@ -22,6 +22,8 @@ _source-from-homebrew() {
|
|||
# check default brew prefix
|
||||
if [[ -h /usr/local/opt/chruby ]];then
|
||||
_brew_prefix="/usr/local/opt/chruby"
|
||||
elif [[ -h /opt/homebrew/opt/chruby ]]; then
|
||||
_brew_prefix="/opt/homebrew/opt/chruby"
|
||||
else
|
||||
# ok , it is not default prefix
|
||||
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
||||
|
|
|
|||
|
|
@ -36,3 +36,10 @@ Last login: Fri Jan 30 23:12:26 on ttys001
|
|||
- `cowsay` if using `chuck_cow`
|
||||
|
||||
Available via homebrew, apt, ...
|
||||
|
||||
> [!NOTE]
|
||||
> In addition to installing `fortune`, it may be necessary to run:
|
||||
>
|
||||
> `strfile $ZSH/plugins/chucknorris/fortunes/chucknorris\n`
|
||||
>
|
||||
> (include the "\n" literally) to write the fortune data to the proper directory.
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ colorize_cat() {
|
|||
ZSH_COLORIZE_STYLE="emacs"
|
||||
fi
|
||||
|
||||
# Use stdin if no arguments have been passed.
|
||||
if [ $# -eq 0 ]; then
|
||||
# Use stdin if stdin is not attached to a terminal.
|
||||
if [ ! -t 0 ]; then
|
||||
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
|
||||
else
|
||||
chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}"
|
||||
chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$@"
|
||||
fi
|
||||
return $?
|
||||
fi
|
||||
|
|
|
|||
37
plugins/conda/README.md
Normal file
37
plugins/conda/README.md
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# conda plugin
|
||||
|
||||
The conda plugin provides [aliases](#aliases) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html).
|
||||
|
||||
To use it, add `conda` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... conda)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| :------- | :-------------------------------------- | :------------------------------------------------------------------------------ |
|
||||
| `cna` | `conda activate` | Activate the specified conda environment |
|
||||
| `cnab` | `conda activate base` | Activate the base conda environment |
|
||||
| `cncf` | `conda env create -f` | Create a new conda environment from a YAML file |
|
||||
| `cncn` | `conda create -y -n` | Create a new conda environment with the given name |
|
||||
| `cnconf` | `conda config` | View or modify conda configuration |
|
||||
| `cncp` | `conda create -y -p` | Create a new conda environment with the given prefix |
|
||||
| `cncr` | `conda create -n` | Create new virtual environment with given name |
|
||||
| `cncss` | `conda config --show-source` | Show the locations of conda configuration sources |
|
||||
| `cnde` | `conda deactivate` | Deactivate the current conda environment |
|
||||
| `cnel` | `conda env list` | List all available conda environments |
|
||||
| `cni` | `conda install` | Install given package |
|
||||
| `cniy` | `conda install -y` | Install given package without confirmation |
|
||||
| `cnl` | `conda list` | List installed packages in the current environment |
|
||||
| `cnle` | `conda list --export` | Export the list of installed packages in the current environment |
|
||||
| `cnles` | `conda list --explicit > spec-file.txt` | Export the list of installed packages in the current environment to a spec file |
|
||||
| `cnr` | `conda remove` | Remove given package |
|
||||
| `cnrn` | `conda remove -y -all -n` | Remove all packages in the specified environment |
|
||||
| `cnrp` | `conda remove -y -all -p` | Remove all packages in the specified prefix |
|
||||
| `cnry` | `conda remove -y` | Remove given package without confirmation |
|
||||
| `cnsr` | `conda search` | Search conda repositories for package |
|
||||
| `cnu` | `conda update` | Update conda package manager |
|
||||
| `cnua` | `conda update --all` | Update all installed packages |
|
||||
| `cnuc` | `conda update conda` | Update conda package manager |
|
||||
23
plugins/conda/conda.plugin.zsh
Normal file
23
plugins/conda/conda.plugin.zsh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
alias cna='conda activate'
|
||||
alias cnab='conda activate base'
|
||||
alias cncf='conda env create -f'
|
||||
alias cncn='conda create -y -n'
|
||||
alias cnconf='conda config'
|
||||
alias cncp='conda create -y -p'
|
||||
alias cncr='conda create -n'
|
||||
alias cncss='conda config --show-source'
|
||||
alias cnde='conda deactivate'
|
||||
alias cnel='conda env list'
|
||||
alias cni='conda install'
|
||||
alias cniy='conda install -y'
|
||||
alias cnl='conda list'
|
||||
alias cnle='conda list --export'
|
||||
alias cnles='conda list --explicit > spec-file.txt'
|
||||
alias cnr='conda remove'
|
||||
alias cnrn='conda remove -y --all -n'
|
||||
alias cnrp='conda remove -y --all -p'
|
||||
alias cnry='conda remove -y'
|
||||
alias cnsr='conda search'
|
||||
alias cnu='conda update'
|
||||
alias cnua='conda update --all'
|
||||
alias cnuc='conda update conda'
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# Usage: dash [keyword:]query
|
||||
dash() { open -a Dash.app dash://"$*" }
|
||||
dash() { open -a Dash.app "dash://$(omz_urlencode -r $*)" }
|
||||
compdef _dash dash
|
||||
|
||||
_dash() {
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@ else
|
|||
}
|
||||
alias ac="su -ls '$apt_pref clean' root"
|
||||
alias ad="su -lc '$apt_pref update' root"
|
||||
alias adg="su -lc '$apt_pref update && aptitude $apt_upgr' root"
|
||||
alias adu="su -lc '$apt_pref update && aptitude dist-upgrade' root"
|
||||
alias afu="su -lc '$apt-file update'"
|
||||
alias adg="su -lc '$apt_pref update && $apt_pref $apt_upgr' root"
|
||||
alias adu="su -lc '$apt_pref update && $apt_pref dist-upgrade' root"
|
||||
alias afu="su -lc 'apt-file update'"
|
||||
alias au="su -lc '$apt_pref $apt_upgr' root"
|
||||
function ai() {
|
||||
cmd="su -lc '$apt_pref install $@' root"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
# Don't continue if direnv is not found
|
||||
command -v direnv &>/dev/null || return
|
||||
# If direnv is not found, don't continue and print a warning
|
||||
if (( ! $+commands[direnv] )); then
|
||||
echo "Warning: direnv not found. Please install direnv and ensure it's in your PATH before using this plugin."
|
||||
return
|
||||
fi
|
||||
|
||||
_direnv_hook() {
|
||||
trap -- '' SIGINT;
|
||||
|
|
|
|||
|
|
@ -60,3 +60,46 @@ to `/usr` again.
|
|||
After that, <kbd>Alt</kbd> + <kbd>Down</kbd> will probably go to `/usr/bin` if `bin` is the first directory in alphabetical
|
||||
order (depends on your `/usr` folder structure). <kbd>Alt</kbd> + <kbd>Up</kbd> will return to `/usr`, and once more will get
|
||||
you to the root folder (`/`).
|
||||
|
||||
### cde
|
||||
|
||||
This plugin also provides a `cde` alias that allows you to change to a directory without clearing the next directory stack.
|
||||
This changes the default behavior of `dirhistory`, which is to clear the next directory stack when changing directories.
|
||||
|
||||
For example, if the shell was started, and the following commands were entered:
|
||||
|
||||
```shell
|
||||
cd ~
|
||||
cd /usr
|
||||
cd share
|
||||
cd doc
|
||||
|
||||
# <Alt + Left>
|
||||
# <Alt + Left>
|
||||
```
|
||||
|
||||
The directory stack would look like this:
|
||||
|
||||
```sh
|
||||
➜ /usr typeset -pm dirhistory_\*
|
||||
typeset -ax dirhistory_past=( /home/user /usr )
|
||||
typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
|
||||
```
|
||||
|
||||
This means that pressing <kbd>Alt</kbd> + <kbd>Right</kbd>, you'd go to `/usr/share` and `/usr/share/doc` (the "future" directories).
|
||||
|
||||
If you run `cd /usr/bin`, the "future" directories will be removed, and you won't be able to access them with <kbd>Alt</kbd> + <kbd>Right</kbd>:
|
||||
|
||||
```sh
|
||||
➜ /u/bin typeset -pm dirhistory_\*
|
||||
typeset -ax dirhistory_past=( /home/user /usr )
|
||||
typeset -ax dirhistory_future=( /usr/bin )
|
||||
```
|
||||
|
||||
If you instead run `cde /usr/bin`, the "future" directories will be preserved:
|
||||
|
||||
```sh
|
||||
➜ /u/bin typeset -pm dirhistory_\*
|
||||
typeset -ax dirhistory_past=( /home/user /usr /usr/bin )
|
||||
typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
|
||||
```
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@ dirhistory_past=($PWD)
|
|||
dirhistory_future=()
|
||||
export dirhistory_past
|
||||
export dirhistory_future
|
||||
|
||||
export DIRHISTORY_SIZE=30
|
||||
|
||||
alias cde='dirhistory_cd'
|
||||
|
||||
# Pop the last element of dirhistory_past.
|
||||
# Pass the name of the variable to return the result in.
|
||||
# Returns the element if the array was not empty,
|
||||
|
|
@ -136,7 +137,11 @@ for keymap in emacs vicmd viins; do
|
|||
|
||||
case "$TERM_PROGRAM" in
|
||||
Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
|
||||
iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2
|
||||
ghostty) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # ghostty
|
||||
iTerm.app)
|
||||
bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back
|
||||
bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back
|
||||
;;
|
||||
esac
|
||||
|
||||
if (( ${+terminfo[kcub1]} )); then
|
||||
|
|
@ -151,7 +156,11 @@ for keymap in emacs vicmd viins; do
|
|||
|
||||
case "$TERM_PROGRAM" in
|
||||
Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
|
||||
iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2
|
||||
ghostty) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # ghostty
|
||||
iTerm.app)
|
||||
bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future
|
||||
bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future
|
||||
;;
|
||||
esac
|
||||
|
||||
if (( ${+terminfo[kcuf1]} )); then
|
||||
|
|
@ -200,6 +209,7 @@ for keymap in emacs vicmd viins; do
|
|||
case "$TERM_PROGRAM" in
|
||||
Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app
|
||||
iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
|
||||
ghostty) bindkey -M $keymap "^[[1;3A" dirhistory_zle_dirhistory_up ;; # ghostty
|
||||
esac
|
||||
|
||||
if (( ${+terminfo[kcuu1]} )); then
|
||||
|
|
@ -215,6 +225,7 @@ for keymap in emacs vicmd viins; do
|
|||
case "$TERM_PROGRAM" in
|
||||
Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app
|
||||
iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
|
||||
ghostty) bindkey -M $keymap "^[[1;3B" dirhistory_zle_dirhistory_down ;; # ghostty
|
||||
esac
|
||||
|
||||
if (( ${+terminfo[kcud1]} )); then
|
||||
|
|
|
|||
570
plugins/dnf/_dnf5
Normal file
570
plugins/dnf/_dnf5
Normal file
|
|
@ -0,0 +1,570 @@
|
|||
#compdef dnf5
|
||||
# based on dnf-5.2.6.2
|
||||
|
||||
# utility functions
|
||||
|
||||
_dnf5_helper() {
|
||||
_call_program specs $service "${(q-)@}" "${(q-)PREFIX}\*" \
|
||||
-qC --assumeno --nogpgcheck 2>/dev/null </dev/null
|
||||
}
|
||||
|
||||
_dnf5_repositories() {
|
||||
# required option: -T (all|disabled|enabled)
|
||||
local selected expl
|
||||
zparseopts -D -E - T:=selected
|
||||
selected=$selected[2]
|
||||
_wanted $selected-repositories expl "$selected repository" \
|
||||
compadd "$@" - "${(@)${(f)$(_dnf5_helper repo list --$selected)}[2,-1]%% *}"
|
||||
}
|
||||
|
||||
_dnf5_packages() {
|
||||
# required option: -T (all|available|installed|upgradable)
|
||||
local selected opt expl
|
||||
zparseopts -D -E - T:=selected
|
||||
selected=$selected[2]
|
||||
case $selected in
|
||||
all) opt='' ;; # option --all does not exist
|
||||
upgradable) opt='--upgrades' ;;
|
||||
*) opt="--$selected" ;;
|
||||
esac
|
||||
_wanted $selected-packages expl "$selected package" \
|
||||
compadd "$@" - $(_dnf5_helper repoquery $opt --qf='%{name} ')
|
||||
}
|
||||
|
||||
_dnf5_rpm_files() {
|
||||
local expl
|
||||
_wanted rpm-files expl 'rpm file' _files -g '(#i)*.rpm(-.)'
|
||||
}
|
||||
|
||||
_dnf5_packages_or_rpms() {
|
||||
if [[ "$words[CURRENT]" = (*/*|\~*) ]]; then # if looks like a path name
|
||||
_dnf5_rpm_files
|
||||
else
|
||||
_dnf5_packages "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
_dnf5_groups() {
|
||||
# optional option: -T (available|installed)
|
||||
local update_policy selected line pat groups
|
||||
zparseopts -D -E - T:=selected
|
||||
selected=$selected[2]
|
||||
if [[ -z $selected ]]; then
|
||||
selected=all
|
||||
opt= # option --all does not exist
|
||||
else
|
||||
opt=--$selected
|
||||
fi
|
||||
# XXX hidden groups are not included
|
||||
for line in ${${(f)"$(_dnf5_helper group list $opt)"}[2,-1]}; do
|
||||
line=( ${(z)line} )
|
||||
groups+=( "$line[1]:$line[2,-2]" )
|
||||
done
|
||||
_describe -t $selected-groups "$selected group" groups
|
||||
}
|
||||
|
||||
_dnf5_environments() {
|
||||
local line envs
|
||||
for line in ${${(f)"$(_dnf5_helper environment list)"}[2,-1]}; do
|
||||
line=( ${(z)line} )
|
||||
envs+=( "$line[1]:$line[2,-2]" )
|
||||
done
|
||||
_describe -t environments 'environment' envs
|
||||
}
|
||||
|
||||
# completers for (several) dnf commands
|
||||
|
||||
_dnf5-advisory () {
|
||||
_arguments : \
|
||||
$advisory_opts \
|
||||
'--contains-pkgs=[only show advisories containing specified packages]: : _sequence _dnf5_packages -T installed' \
|
||||
+ '(with)' \
|
||||
'--with-cve[show only advisories referencing CVE ticket]' \
|
||||
'--with-bz[show only advisories referencing Bugzilla ticket]' \
|
||||
+ '(type)' \
|
||||
'--all[show all advisories]' \
|
||||
'--available[show advisories containing newer versions of installed packages (default)]' \
|
||||
'--installed[show advisories containing equal and older version of installed packages]' \
|
||||
'--updates[show advisories containing upgradable packages]' \
|
||||
+ args \
|
||||
':subcommand:(list info summary)' '*:advisory spec:'
|
||||
}
|
||||
|
||||
_dnf5-group() {
|
||||
local -a tmp
|
||||
if (( CURRENT == 2 )); then
|
||||
tmp=(
|
||||
'list:list all matching groups'
|
||||
'info:print detailed information about groups'
|
||||
'install:install packages from specified groups'
|
||||
'remove:remove removable packages in specified groups'
|
||||
'upgrade:upgrade specified groups and packages in them'
|
||||
)
|
||||
_describe -t subcommands 'subcommand' tmp
|
||||
else
|
||||
case $words[2] in
|
||||
list|info)
|
||||
tmp=(
|
||||
'(--installed)--available[show only available groups]'
|
||||
'(--available)--installed[show only installed groups]'
|
||||
'--hidden[show also hidden groups]'
|
||||
'--contains-pkgs=[show only groups containing specified packages]: : _sequence _dnf5_packages -T all'
|
||||
'*: : _dnf5_groups'
|
||||
)
|
||||
;;
|
||||
install)
|
||||
tmp=( $common_opts
|
||||
'--with-optional[include optional packages from the groups]'
|
||||
'*: : _dnf5_groups -T available' )
|
||||
;|
|
||||
upgrade)
|
||||
tmp=( ${common_opts:#--skip-broken*}
|
||||
'*: : _dnf5_groups -T installed' )
|
||||
;|
|
||||
remove)
|
||||
tmp=( $offline_opts
|
||||
'*: : _dnf5_groups -T installed' )
|
||||
;|
|
||||
install|remove)
|
||||
tmp+=( '--no-packages[operate on groups only, not manipulate any packages]' )
|
||||
;|
|
||||
install|upgrade)
|
||||
tmp+=( $downgrade_opts )
|
||||
;;
|
||||
esac
|
||||
_arguments : $tmp
|
||||
fi
|
||||
}
|
||||
|
||||
_dnf5-history() {
|
||||
local -a tmp
|
||||
if (( CURRENT == 2 )); then
|
||||
tmp=(
|
||||
'list:list info about recorded transactions'
|
||||
'info:print detailed about specific transactions'
|
||||
'undo:revert all actions from the specified transaction'
|
||||
'redo:repeat the specified transaction'
|
||||
'rollback:undo all transactions performed after the specified transaction'
|
||||
'store:store the transaction into a directory'
|
||||
)
|
||||
_describe -t subcommands 'subcommand' tmp
|
||||
else
|
||||
case $words[2] in
|
||||
list|info)
|
||||
tmp=( '--reverse[reverse the order of transactions in output]' )
|
||||
;;
|
||||
undo|rollback|redo)
|
||||
tmp=( '--skip-unavailable[allow skipping impossible actions]' )
|
||||
;|
|
||||
undo|rollback)
|
||||
tmp+=( $replay_opts )
|
||||
;;
|
||||
store)
|
||||
tmp=( {-o,--output=}'[directory for storing the transaction (default ./transaction)]: : _directories')
|
||||
esac
|
||||
_arguments : $tmp '2:transaction:( )'
|
||||
fi
|
||||
}
|
||||
|
||||
_dnf5-mark() {
|
||||
local -a tmp
|
||||
if (( CURRENT == 2 )); then
|
||||
tmp=(
|
||||
'user:mark the package as user-installed'
|
||||
'dependency:mark the package as a dependency'
|
||||
'weak:mark the package as a weak dependency'
|
||||
'group:mark the package as installed by the specified group'
|
||||
)
|
||||
_describe -t subcommands 'subcommand' tmp
|
||||
else
|
||||
tmp=(
|
||||
'--skip-unavailable[skip packages not installed on the system]'
|
||||
'--store=[store the transaction in specified directory]: : _directories'
|
||||
)
|
||||
if [[ $words[2] = group ]]; then
|
||||
tmp+=( '2:group-id: _dnf5_groups -T installed' )
|
||||
fi
|
||||
_arguments : $tmp '*: : _dnf5_packages -T installed'
|
||||
fi
|
||||
}
|
||||
|
||||
_dnf5-module() {
|
||||
local -a tmp
|
||||
if (( CURRENT == 2 )); then
|
||||
tmp=(
|
||||
'list:list module streams'
|
||||
'info:print details about module streams'
|
||||
'enable:enable module streams'
|
||||
'disable:disable modules including all their streams'
|
||||
"reset:reset module state so it's no longer enabled or disabled"
|
||||
)
|
||||
_describe -t subcommands 'subcommand' tmp
|
||||
elif (( CURRENT == 3 )) && [[ $cur = -* ]]; then
|
||||
case $words[2] in
|
||||
list|info) tmp=( --enabled --disabled ) ;;
|
||||
enable) tmp=( --skip-broken --skip-unavailable ) ;;
|
||||
*) tmp=( --skip-unavailable ) ;;
|
||||
esac
|
||||
_wanted options expl 'option' compadd -a tmp
|
||||
else
|
||||
_message 'module spec'
|
||||
fi
|
||||
}
|
||||
|
||||
_dnf5-offline() { # also used by the 'system-upgrade' command
|
||||
local -a tmp
|
||||
if (( CURRENT == 2 )); then
|
||||
tmp=(
|
||||
'clean:remove any stored offline transactions and cached packages'
|
||||
'log:list boots during which offline transaction was attempted'
|
||||
'reboot:prepare the system for offline transaction and reboot'
|
||||
)
|
||||
if [[ $cmd = offline ]]; then
|
||||
tmp+=( 'status:show status of the current offline transaction' )
|
||||
else
|
||||
tmp+=( 'download:download all packages needed for upgrade' )
|
||||
fi
|
||||
_describe -t subcommands 'subcommand' tmp && ret=0
|
||||
else
|
||||
case $words[2] in
|
||||
download)
|
||||
_arguments : \
|
||||
'--releasever=[the version to upgrade to]:version number:' \
|
||||
'--no-downgrade:do not install packages older than currently installed' '*: :' && ret=0
|
||||
;;
|
||||
log)
|
||||
_arguments : \
|
||||
'--number=[show log of transaction specified by number]:transaction number:' '*: :' && ret=0
|
||||
;;
|
||||
reboot)
|
||||
_wanted options expl 'option' compadd -- --poweroff && ret=0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
_dnf5-repoquery() {
|
||||
local v
|
||||
local -a opts=(
|
||||
$advisory_opts
|
||||
'--arch=[limit results to specified architectures]:list of archs: '
|
||||
'--available[limit results to available packages]'
|
||||
'--disable-modular-filtering[include packages of inactive module streams]'
|
||||
'--duplicates[limit to installed duplicate packages]'
|
||||
'--exactdeps[limit to packages that require capability specified by ==what{requires,depends}]'
|
||||
'--extras[limit to installed packages that are not present in any available repository]'
|
||||
'--file=[limit results to packages which own specified file]:list of files: _sequence _files'
|
||||
'--installed[query installed packages]'
|
||||
'--installonly[limit to installed installonly packages]'
|
||||
'--latest-limit=[limit to latest packages of specified number]:number:'
|
||||
'--leaves[limit to groups of installed packages not required by other installed packages]'
|
||||
'--providers-of=[select packages that provide specified attribute]:attribute:(conflicts depends enhances obsoletes provides recommends requires requires_pre suggests supplement)'
|
||||
'--recent[limit to only recently changed packages]'
|
||||
'--recursive[make --whatrequires/--providers-of work recursively]'
|
||||
'--security[limit to packages in security advisories]'
|
||||
'--srpm[use the corresponding source RPM]'
|
||||
'--unneeded[limit to unneeded installed packages]'
|
||||
'--upgrades[limit to available packages that provide upgrade for installed packages]'
|
||||
'--userinstalled[limit to packages that are not installed as dependencies]'
|
||||
'--whatdepends=[limit to packages that require, enhance, recommend, suggest of supplement specified capability]:list of capability:'
|
||||
'--whatconflicts=[limit to packages that conflicts with specified capabilities]:list of capability: '
|
||||
)
|
||||
for v in enhance obsolete provide recommend require suggest supplement; do
|
||||
opts+=( "--what${v}s=[limit to packages that $v specified capabilities]:list of capability: ")
|
||||
done
|
||||
# mutually exclusive formatting options
|
||||
opts+=(
|
||||
+ '(format)'
|
||||
'--conflicts[display capabilities that the package conflicts with]'
|
||||
'--depends[display capabilities that the package depends on, enables, recommends, suggests or supplements]'
|
||||
'--files[show files in the package]'
|
||||
'--requires-pre[display capabilities required to run pre/post scripts of the package]'
|
||||
'--sourcerpm[display source RPM of the package]'
|
||||
'--location[display location of the package]'
|
||||
'--info[show detailed information about the package]'
|
||||
'--changelogs[print the package changelogs]'
|
||||
'(- *)--querytags[list tags recognized by --queryformat]'
|
||||
'--queryformat=[specify output format]:format:'
|
||||
)
|
||||
for v in enhance obsolete provide recommend require suggest supplement; do
|
||||
opts+=( "--${v}s[display capabilities ${v}ed by the package]" )
|
||||
done
|
||||
|
||||
_arguments : '*: : _dnf5_packages -T all' $opts
|
||||
}
|
||||
|
||||
# dnf commands
|
||||
|
||||
_dnf5_commands() {
|
||||
local -a dnf_cmds=(
|
||||
'advisory:manage advisories'
|
||||
'autoremove:remove unneeded packages'
|
||||
'check:check for problems in package database'
|
||||
'check-upgrade:check for available package upgrades'
|
||||
'clean:remove or invalidate cached data'
|
||||
'distro-sync:up/downgrade installed packages to the latest available'
|
||||
'downgrade:downgrade packages'
|
||||
'download:download packages'
|
||||
'environment:manage comps environments'
|
||||
'group:manage comps groups'
|
||||
'history:manage transaction history'
|
||||
'info:provide detailed information about packages'
|
||||
'install:install packages'
|
||||
'leaves:list groups of leaf packages'
|
||||
'list:list installed or available packages'
|
||||
'makecache:generate the metadata cache'
|
||||
'mark:change the reason of an installed package'
|
||||
'module:manage modules'
|
||||
'offline:manage offline transactions'
|
||||
'provides:find what package provides the given value'
|
||||
'reinstall:reinstall packages'
|
||||
'remove:remove packages'
|
||||
'replay:replay stored transactions'
|
||||
'repo:manage repositories'
|
||||
'repoquery:search for packages in repositories'
|
||||
'search:search for packages using keywords'
|
||||
'swap:remove software and install another in the single transaction'
|
||||
'system-upgrade:upgrade the system to a new major release'
|
||||
'upgrade:upgrade packages'
|
||||
'versionlock:protect packages from updates to newer versions'
|
||||
)
|
||||
_describe -t dnf-commands 'dnf command' dnf_cmds
|
||||
}
|
||||
|
||||
# subcommands and options
|
||||
|
||||
_dnf5_subcmds_opts() {
|
||||
local cur=$words[CURRENT] cmd=$words[1] expl ret=1
|
||||
local -a tmp
|
||||
# common options
|
||||
local -a offline_opts=(
|
||||
'(--store)--offline[store the transaction to be performed offline]'
|
||||
'(--offline)--store=[store the transaction in specified directory]: : _directories'
|
||||
)
|
||||
local -a common_opts=(
|
||||
$offline_opts
|
||||
'--allowerasing[allow erasing of installed packages]'
|
||||
'--skip-broken[resolve dependency problems by skipping problematic packages]'
|
||||
"--skip-unavailable[skip packages that can't be synchronized]"
|
||||
'--downloadonly[download packages without executing transaction]'
|
||||
)
|
||||
local -a advisory_opts=(
|
||||
'--advisories=[consider only specified advisories]:list of advisories:'
|
||||
'--advisory-severities=[limit to advisories with specified severity]:severity:_sequence compadd - critical important moderate low none'
|
||||
'--bzs=[limit to advisories that fix specified Bugzilla ID]:list of Bugzilla ID:'
|
||||
'--cves=[limit to advisories that fix specified CVE ID]:list of CVD ID]:'
|
||||
'--security[limit to security advisories]'
|
||||
'--bugfix[limit to bugfix advisories]'
|
||||
'--enhancement[limit to enhancement advisories]'
|
||||
'--newpackage[limit to newpackage advisories]'
|
||||
)
|
||||
local -a downgrade_opts=(
|
||||
'(--no-allow-downgrade)--allow-downgrade[enable downgrade of dependencies]'
|
||||
'(--allow-downgrade)--no-allow-downgrade[disable downgrade of dependencies]'
|
||||
)
|
||||
local -a replay_opts=(
|
||||
'--ignore-extras[not consider extra packages]'
|
||||
'--ignore-installed[mismatches between installed and stored transaction are not errors]'
|
||||
)
|
||||
# Deal with some aliases (not comprehensive)
|
||||
case $cmd in
|
||||
check-updgrade) cmd=check-update;;
|
||||
dg) cmd=downgrade;;
|
||||
dsync) cmd=distro-sync;;
|
||||
grp) cmd=group;;
|
||||
if) cmd=info;;
|
||||
in) cmd=install;;
|
||||
ls) cmd=list;;
|
||||
mc) cmd=makecache;;
|
||||
rei) cmd=reinstall;;
|
||||
rm) cmd=remove ;;
|
||||
rq) cmd=repoquery;;
|
||||
se) cmd=search;;
|
||||
update|up) cmd=upgrade;;
|
||||
esac
|
||||
local curcontext="${curcontext%:*:*}:dnf-${cmd}:"
|
||||
|
||||
case $cmd in
|
||||
advisory|group|history|mark|module|offline|repoquery)
|
||||
_dnf5-$cmd && ret=0
|
||||
;;
|
||||
system-upgrade)
|
||||
_dnf5-offline && ret=0
|
||||
;;
|
||||
autoremove)
|
||||
_arguments : $offline_opts && ret=0
|
||||
;;
|
||||
check)
|
||||
_arguments : \
|
||||
'--dependencies[show missing dependencies and conflicts]' \
|
||||
'--duplicates[show duplicated packages]' \
|
||||
'--obsoleted[show obsoleted packages]' && ret=0
|
||||
;;
|
||||
check-upgrade)
|
||||
_arguments : \
|
||||
$advisory_opts \
|
||||
'--changelogs[print package changelogs]' \
|
||||
'--minimal[reports the lowest versions of packages that fix advisories]' \
|
||||
'*: : _dnf5_packages -T installed' && ret=0
|
||||
;;
|
||||
clean)
|
||||
tmp=(
|
||||
'dbcache:remove cache files generated from the repository metadata'
|
||||
'expire-cache:mark the repository metadata expired'
|
||||
'metadata:remove the repository metadata'
|
||||
'packages:remove any cached packages'
|
||||
'all:clean all'
|
||||
)
|
||||
_describe -t cache-types 'cache type' tmp && ret=0
|
||||
;;
|
||||
distro-sync)
|
||||
_arguments : $common_opts '*: : _dnf5_packages -T installed' && ret=0
|
||||
;;
|
||||
downgrade)
|
||||
_arguments : \
|
||||
$common_opts $downgrade_opts \
|
||||
'*: : _dnf5_packages -T installed' && ret=0
|
||||
;;
|
||||
download)
|
||||
_arguments : \
|
||||
'--arch=[limit to packages of specified architecture]:list of architectures:' \
|
||||
'--resolve[resolve and download needed dependencies]' \
|
||||
'--alldeps[with --resolve, also download already installed dependencies]' \
|
||||
'--destdir=[download to the specified directory]: : _directories' \
|
||||
'--srpm[download the source rpm]' \
|
||||
'--url[print the list of URLs where the rpms can be downloaded]' \
|
||||
'*--urlprotocol=[with --url, limit to specified protocols]:protocol:_sequence compadd - http https ftp file' \
|
||||
'*: : _dnf5_packages -T all' && ret=0
|
||||
;;
|
||||
environment)
|
||||
_arguments : \
|
||||
'--available[show only available environments]' \
|
||||
'--installed[show only installed environments]' \
|
||||
':subcommand:(list info)' \
|
||||
'*: : _dnf5_environments' && ret=0
|
||||
;;
|
||||
info|list)
|
||||
_arguments : \
|
||||
'--showduplicates[show all versions of the packages]' \
|
||||
'*: : _dnf5_packages -T all' \
|
||||
+ '(type)' \
|
||||
'--installed[list only installed packages]:*: : _dnf5_packages -T installed' \
|
||||
'--available[list only available packages]:*: : _dnf5_packages -T available' \
|
||||
'--extras[list only extras]' \
|
||||
'--obsoletes[list only installed but obsoleted packages]:*: : _dnf5_packages -T installed' \
|
||||
'--recent[list only recently added packages]' \
|
||||
'--upgrades[list only available upgrades of installed packages]:*: : _dnf5_packages -T upgradable' \
|
||||
'--autoremove[list only packages that will be autoremoved]:*: : _dnf5_packages -T installed' &&ret=0
|
||||
;;
|
||||
install)
|
||||
_arguments : \
|
||||
$common_opts $downgrade_opts $advisory_opts \
|
||||
'*: : _dnf5_packages_or_rpms -T available' && ret=0
|
||||
;;
|
||||
leaves|makecache)
|
||||
# nothing to complete
|
||||
;;
|
||||
provides)
|
||||
_files && ret=0
|
||||
;;
|
||||
reinstall)
|
||||
_arguments : \
|
||||
$common_opts $downgrade_opts \
|
||||
'*: : _dnf5_packages_or_rpms -T installed' && ret=0
|
||||
;;
|
||||
remove)
|
||||
_arguments : \
|
||||
$offline_opts \
|
||||
'--no-autoremove[not remove dependencies that are no longer used]' \
|
||||
'*: : _dnf5_packages -T installed' && ret=0
|
||||
;;
|
||||
replay)
|
||||
_arguments : \
|
||||
$replay_opts \
|
||||
':transaction path:_directories' && ret=0
|
||||
;;
|
||||
repo)
|
||||
_arguments : \
|
||||
'--all[show info about all repositories]' \
|
||||
'--enabled[show info only about enabled repositories]' \
|
||||
'--disabled[show info only about disabled repositories]' \
|
||||
':subcommand:(list info)' && ret=0
|
||||
;;
|
||||
search)
|
||||
_arguments : \
|
||||
'--all[search patterns also inside description and URL fields]' \
|
||||
'--showduplicates[show all versions of packages, not only the latest ones]' \
|
||||
'*:search pattern:' && ret=0
|
||||
;;
|
||||
swap)
|
||||
_arguments : \
|
||||
$offline_opts \
|
||||
'--allowerasing[allow erasing of installed packages]' \
|
||||
': : _dnf5_packages -T installed' \
|
||||
': : _dnf5_packages -T available' && ret=0
|
||||
;;
|
||||
upgrade)
|
||||
_arguments : \
|
||||
${common_opts:#--skip-broken*} $downgrade_opts $advisory_opts \
|
||||
'--minimal[upgrade only to the lowest available versions that fix advisories]' \
|
||||
'--destdir=[specify directory into which downloading packages]: : _directories' \
|
||||
'*: : _dnf5_packages_or_rpms -T upgradable' && ret=0
|
||||
;;
|
||||
versionlock)
|
||||
_arguments : \
|
||||
':subcommand:(add exclude clear delete list)' \
|
||||
'*: : _dnf5_packages -T all' && ret=0
|
||||
;;
|
||||
esac
|
||||
return ret
|
||||
}
|
||||
|
||||
# main completer
|
||||
|
||||
_dnf5() {
|
||||
local curcontext="$curcontext" state state_descr line ret=1
|
||||
typeset -A opt_args
|
||||
local -a opts=(
|
||||
'(-y --assumeyes)--assumeno[answer no for all questions]'
|
||||
'--best[try the best available package version]'
|
||||
'(-C --cacheonly)'{-C,--cacheonly}"[run entirely from system cache, don't update cache]"
|
||||
'--comment=[add comment to transaction history]:comment:'
|
||||
'(-c --config)'{-c+,--config=}'[specify configuration file]:config file:_files'
|
||||
'--debugsolver[dump detailed solving results in file ./debugdata]'
|
||||
'*--disable-plugin=[disable specified plugins]:list of plugin names:'
|
||||
'(--repo)*--disable-repo=[disable specified repos]: : _sequence _dnf5_repositories -T enabled'
|
||||
'--dump-main-config[print main configuration values to stdout]'
|
||||
'*--dump-repo-config=[print repository configuration values to stdout]:repi id'
|
||||
'--dump-variables[print variable values to stdout]'
|
||||
'*--enable-plugin=[enable specified plugins]:list of plugin names:'
|
||||
'*--enable-repo=[enable additional repos]: : _sequence _dnf5_repositories -T disabled'
|
||||
'--forcearch=[force the use of the specified arch]:arch:'
|
||||
'(-)'{-h,--help}'[show the help message]'
|
||||
'--installroot=[set install root]: : _directories'
|
||||
'--no-best[do not limit transactions to best candidates]'
|
||||
'--no-docs[do not install documentation]'
|
||||
'--no-gpgcheck[skip checking GPG signatures on packages]'
|
||||
'--no-plugins[disable all plugins]'
|
||||
'(-q --quiet)'{-q,--quiet}'[show just the relevant content]'
|
||||
'--refresh[force refreshing metadata before running the command]'
|
||||
'--releasever=[override distribution release in config files]:release ver:'
|
||||
'(--disablerepo)*--repo=[enable just the specified repo]: : _sequence _dnf5_repositories -T all'
|
||||
'*--repofrompath=[specify additional repos]:repository_label,path_or_url: '
|
||||
'*--setopt=[override option in config file]:repoid.option=value:'
|
||||
'*--setvar=[override DNF5 variable value]'
|
||||
'--show-new-leaves[show newly installed leaf packages]'
|
||||
'--use-host-config[use config files and variables from host system]'
|
||||
'(- *)--version[show dnf version]'
|
||||
'(-y --assumeyes --assumeno)'{-y,--assumeyes}'[answer yes for all questions]'
|
||||
'*'{-x+,--exclude=}'[exclude specified packages from transaction]: : _sequence _dnf5_packages -T all'
|
||||
)
|
||||
_arguments -C -s : $opts ': :->command' '*:: :->cmd_args' && ret=0
|
||||
|
||||
case $state in
|
||||
command) _dnf5_commands && ret=0 ;;
|
||||
cmd_args) _dnf5_subcmds_opts && ret=0 ;;
|
||||
esac
|
||||
return ret
|
||||
}
|
||||
|
||||
_dnf5 "$@"
|
||||
|
|
@ -39,6 +39,10 @@ following setting. See https://github.com/ohmyzsh/ohmyzsh/issues/11789 for more
|
|||
zstyle ':omz:plugins:docker' legacy-completion yes
|
||||
```
|
||||
|
||||
### For Podman's Docker wrapper users
|
||||
|
||||
If you use Podman's Docker wrapper, you need to enable legacy completion. See above section.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|
|
@ -73,6 +77,7 @@ zstyle ':omz:plugins:docker' legacy-completion yes
|
|||
| drs | `docker container restart` | Restart one or more containers |
|
||||
| dsta | `docker stop $(docker ps -q)` | Stop all running containers |
|
||||
| dstp | `docker container stop` | Stop one or more running containers |
|
||||
| dsts | `docker stats` | Display real-time streaming statistics for containers |
|
||||
| dtop | `docker top` | Display the running processes of a container |
|
||||
| dvi | `docker volume inspect` | Display detailed information about one or more volumes |
|
||||
| dvls | `docker volume ls` | List all the volumes known to docker |
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ alias dst='docker container start'
|
|||
alias drs='docker container restart'
|
||||
alias dsta='docker stop $(docker ps -q)'
|
||||
alias dstp='docker container stop'
|
||||
alias dsts='docker stats'
|
||||
alias dtop='docker top'
|
||||
alias dvi='docker volume inspect'
|
||||
alias dvls='docker volume ls'
|
||||
|
|
@ -39,7 +40,7 @@ if (( ! $+commands[docker] )); then
|
|||
return
|
||||
fi
|
||||
|
||||
# Standarized $0 handling
|
||||
# Standardized $0 handling
|
||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
|
|
|||
|
|
@ -23,3 +23,4 @@ plugins=(... dotnet)
|
|||
| dp | dotnet pack | Create a NuGet package. |
|
||||
| dng | dotnet nuget | Provides additional NuGet commands. |
|
||||
| db | dotnet build | Build a .NET project |
|
||||
| dres | dotnet restore | Restore dependencies and project-specific tools for a project. |
|
||||
|
|
@ -10,7 +10,7 @@ _dotnet_completion() {
|
|||
|
||||
compdef _dotnet_completion dotnet
|
||||
|
||||
# Aliases bellow are here for backwards compatibility
|
||||
# Aliases below are here for backwards compatibility
|
||||
# added by Shaun Tabone (https://github.com/xontab)
|
||||
|
||||
alias dn='dotnet new'
|
||||
|
|
@ -24,3 +24,4 @@ alias da='dotnet add'
|
|||
alias dp='dotnet pack'
|
||||
alias dng='dotnet nuget'
|
||||
alias db='dotnet build'
|
||||
alias dres='dotnet restore'
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
|||
alias eframe='emacsclient --alternate-editor="" --create-frame'
|
||||
|
||||
# Emacs ANSI Term tracking
|
||||
if [[ -n "$INSIDE_EMACS" ]]; then
|
||||
if [[ -n "$INSIDE_EMACS" ]] && [[ "$INSIDE_EMACS" != "vterm" ]]; then
|
||||
chpwd_emacs() { print -P "\033AnSiTc %d"; }
|
||||
print -P "\033AnSiTc %d" # Track current working directory
|
||||
print -P "\033AnSiTu %n" # Track username
|
||||
|
|
|
|||
|
|
@ -29,5 +29,5 @@ plugins=(... ember-cli)
|
|||
|
||||
- [BilalBudhani](https://github.com/BilalBudhani)
|
||||
- [eubenesa](https://github.com/eubenesa)
|
||||
- [scottkidder](https://github.com/scottkidder]
|
||||
- [scottkidder](https://github.com/scottkidder)
|
||||
- [t-sauer](https://www.github.com/t-sauer)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
Update Emoji.py
|
||||
Refeshes OMZ emoji database based on the latest Unicode spec
|
||||
Refreshes OMZ emoji database based on the latest Unicode spec
|
||||
"""
|
||||
import re
|
||||
import json
|
||||
|
|
@ -95,7 +95,7 @@ def name_to_omz(_name, _group, _subgroup, _status):
|
|||
shortname = snake_case(_name)
|
||||
# Special treatment by status
|
||||
# Enables us to have every emoji combination,
|
||||
# even the one that are not officially sanctionned
|
||||
# even the one that are not officially sanctioned
|
||||
# and are implemented by, say, only one vendor
|
||||
if _status == "unqualified":
|
||||
shortname += "_unqualified"
|
||||
|
|
|
|||
|
|
@ -14,52 +14,56 @@ plugins=(... extract)
|
|||
|
||||
## Supported file extensions
|
||||
|
||||
| Extension | Description |
|
||||
| :---------------- | :----------------------------------- |
|
||||
| `7z` | 7zip file |
|
||||
| `Z` | Z archive (LZW) |
|
||||
| `apk` | Android app file |
|
||||
| `aar` | Android library file |
|
||||
| `bz2` | Bzip2 file |
|
||||
| `cab` | Microsoft cabinet archive |
|
||||
| `cpio` | Cpio archive |
|
||||
| `deb` | Debian package |
|
||||
| `ear` | Enterprise Application aRchive |
|
||||
| `exe` | Windows executable file |
|
||||
| `gz` | Gzip file |
|
||||
| `ipa` | iOS app package |
|
||||
| `ipsw` | iOS firmware file |
|
||||
| `jar` | Java Archive |
|
||||
| `lrz` | LRZ archive |
|
||||
| `lz4` | LZ4 archive |
|
||||
| `lzma` | LZMA archive |
|
||||
| `obscpio` | cpio archive used on OBS |
|
||||
| `rar` | WinRAR archive |
|
||||
| `rpm` | RPM package |
|
||||
| `sublime-package` | Sublime Text package |
|
||||
| `tar` | Tarball |
|
||||
| `tar.bz2` | Tarball with bzip2 compression |
|
||||
| `tar.gz` | Tarball with gzip compression |
|
||||
| `tar.lrz` | Tarball with lrzip compression |
|
||||
| `tar.lz` | Tarball with lzip compression |
|
||||
| `tar.lz4` | Tarball with lz4 compression |
|
||||
| `tar.xz` | Tarball with lzma2 compression |
|
||||
| `tar.zma` | Tarball with lzma compression |
|
||||
| `tar.zst` | Tarball with zstd compression |
|
||||
| `tbz` | Tarball with bzip compression |
|
||||
| `tbz2` | Tarball with bzip2 compression |
|
||||
| `tgz` | Tarball with gzip compression |
|
||||
| `tlz` | Tarball with lzma compression |
|
||||
| `txz` | Tarball with lzma2 compression |
|
||||
| `tzst` | Tarball with zstd compression |
|
||||
| `war` | Web Application archive (Java-based) |
|
||||
| `whl` | Python wheel file |
|
||||
| `xpi` | Mozilla XPI module file |
|
||||
| `xz` | LZMA2 archive |
|
||||
| `zip` | Zip archive |
|
||||
| `zlib` | zlib archive |
|
||||
| `zst` | Zstandard file (zstd) |
|
||||
| `zpaq` | Zpaq file |
|
||||
| Extension | Description |
|
||||
| :---------------- | :-------------------------------------- |
|
||||
| `7z` | 7zip file |
|
||||
| `apk` | Android app file |
|
||||
| `aar` | Android library file |
|
||||
| `bz2` | Bzip2 file |
|
||||
| `cab` | Microsoft cabinet archive |
|
||||
| `cpio` | Cpio archive |
|
||||
| `deb` | Debian package |
|
||||
| `ear` | Enterprise Application aRchive |
|
||||
| `exe` | Windows executable file |
|
||||
| `gz` | Gzip file |
|
||||
| `ipa` | iOS app package |
|
||||
| `ipsw` | iOS firmware file |
|
||||
| `jar` | Java Archive |
|
||||
| `lrz` | LRZ archive |
|
||||
| `lz4` | LZ4 archive |
|
||||
| `lzma` | LZMA archive |
|
||||
| `obscpio` | cpio archive used on OBS |
|
||||
| `pk3` | Renamed Zip archive used by Quake games |
|
||||
| `pk4` | Renamed Zip archive used by Quake games |
|
||||
| `pk7` | Renamed 7zip file used by Quake games |
|
||||
| `rar` | WinRAR archive |
|
||||
| `rpm` | RPM package |
|
||||
| `sublime-package` | Sublime Text package |
|
||||
| `tar` | Tarball |
|
||||
| `tar.bz2` | Tarball with bzip2 compression |
|
||||
| `tar.gz` | Tarball with gzip compression |
|
||||
| `tar.lrz` | Tarball with lrzip compression |
|
||||
| `tar.lz` | Tarball with lzip compression |
|
||||
| `tar.lz4` | Tarball with lz4 compression |
|
||||
| `tar.xz` | Tarball with lzma2 compression |
|
||||
| `tar.zma` | Tarball with lzma compression |
|
||||
| `tar.zst` | Tarball with zstd compression |
|
||||
| `tbz` | Tarball with bzip compression |
|
||||
| `tbz2` | Tarball with bzip2 compression |
|
||||
| `tgz` | Tarball with gzip compression |
|
||||
| `tlz` | Tarball with lzma compression |
|
||||
| `txz` | Tarball with lzma2 compression |
|
||||
| `tzst` | Tarball with zstd compression |
|
||||
| `vsix` | VS Code extension zip file |
|
||||
| `war` | Web Application archive (Java-based) |
|
||||
| `whl` | Python wheel file |
|
||||
| `xpi` | Mozilla XPI module file |
|
||||
| `xz` | LZMA2 archive |
|
||||
| `Z` | Z archive (LZW) |
|
||||
| `zip` | Zip archive |
|
||||
| `zlib` | zlib archive |
|
||||
| `zst` | Zstandard file (zstd) |
|
||||
| `zpaq` | Zpaq file |
|
||||
|
||||
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for more information
|
||||
regarding archive formats.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,57 @@
|
|||
#compdef extract
|
||||
#autoload
|
||||
|
||||
local -a exts=(
|
||||
7z
|
||||
aar
|
||||
apk
|
||||
bz2
|
||||
cab
|
||||
cpio
|
||||
crx
|
||||
deb
|
||||
ear
|
||||
gz
|
||||
ipa
|
||||
ipsw
|
||||
jar
|
||||
lrz
|
||||
lz4
|
||||
lzma
|
||||
obscpio
|
||||
pk3
|
||||
pk4
|
||||
pk7
|
||||
rar
|
||||
rpm
|
||||
sublime-package
|
||||
tar
|
||||
tar.bz2
|
||||
tar.gz
|
||||
tar.lrz
|
||||
tar.lz
|
||||
tar.lz4
|
||||
tar.xz
|
||||
tar.zma
|
||||
tar.zst
|
||||
tbz
|
||||
tbz2
|
||||
tgz
|
||||
tlz
|
||||
txz
|
||||
tzst
|
||||
vsix
|
||||
war
|
||||
whl
|
||||
xpi
|
||||
xz
|
||||
Z
|
||||
zip
|
||||
zpaq
|
||||
zst
|
||||
)
|
||||
|
||||
_arguments \
|
||||
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
|
||||
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|obscpio|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst|zpaq)(-.)'" \
|
||||
"*::archive file:_files -g '(#i)*.(${(j:|:)exts})(-.)'" \
|
||||
&& return 0
|
||||
|
|
|
|||
|
|
@ -76,11 +76,11 @@ EOF
|
|||
(*.lz4) lz4 -d "$full_path" ;;
|
||||
(*.lzma) unlzma "$full_path" ;;
|
||||
(*.z) uncompress "$full_path" ;;
|
||||
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$full_path" ;;
|
||||
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
|
||||
(*.rar) unrar x -ad "$full_path" ;;
|
||||
(*.rpm)
|
||||
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
||||
(*.7z | *.7z.[0-9]*) 7za x "$full_path" ;;
|
||||
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
|
||||
(*.deb)
|
||||
command mkdir -p "control" "data"
|
||||
ar vx "$full_path" > /dev/null
|
||||
|
|
|
|||
|
|
@ -65,6 +65,29 @@ If `yes`, sets the `--icons` option of `eza`, adding icons for files and folders
|
|||
|
||||
Default: `no`
|
||||
|
||||
### `color-scale`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'color-scale' all|age|size
|
||||
```
|
||||
|
||||
Highlight levels of field(s) distinctly. Use comma(,) separated list of `all`, `age`, `size`
|
||||
|
||||
Default: `none`
|
||||
|
||||
### `color-scale-mode`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'color-scale-mode' gradient|fixed
|
||||
```
|
||||
|
||||
Choose the mode for highlighting:
|
||||
|
||||
- `gradient` (default) -- gradient coloring
|
||||
- `fixed` -- fixed coloring
|
||||
|
||||
Default: `gradient`
|
||||
|
||||
### `size-prefix`
|
||||
|
||||
```zsh
|
||||
|
|
|
|||
|
|
@ -34,6 +34,14 @@ function _configure_eza() {
|
|||
if zstyle -t ':omz:plugins:eza' 'icons'; then
|
||||
_EZA_TAIL+=("--icons=auto")
|
||||
fi
|
||||
zstyle -s ':omz:plugins:eza' 'color-scale' _val
|
||||
if [[ $_val ]]; then
|
||||
_EZA_TAIL+=("--color-scale=$_val")
|
||||
fi
|
||||
zstyle -s ':omz:plugins:eza' 'color-scale-mode' _val
|
||||
if [[ $_val == (gradient|fixed) ]]; then
|
||||
_EZA_TAIL+=("--color-scale-mode=$_val")
|
||||
fi
|
||||
zstyle -s ':omz:plugins:eza' 'time-style' _val
|
||||
if [[ $_val ]]; then
|
||||
_EZA_TAIL+=("--time-style='$_val'")
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
# If they are not set yet, they will be
|
||||
# overwritten with their default values
|
||||
|
||||
default fastfile_dir "${HOME}/.fastfile"
|
||||
default fastfile_var_prefix "§"
|
||||
fastfile_dir="${fastfile_dir:-${HOME}/.fastfile}"
|
||||
fastfile_var_prefix="${fastfile_var_prefix:-§}"
|
||||
|
||||
###########################
|
||||
# Impl
|
||||
|
|
|
|||
35
plugins/foot/README.md
Normal file
35
plugins/foot/README.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# foot
|
||||
|
||||
This plugin adds shell integration for [foot, a fast, lightweight and
|
||||
minimalistic Wayland terminal emulator](https://codeberg.org/dnkl/foot).
|
||||
|
||||
To use, add `foot` to the list of plugins in your `.zshrc` file:
|
||||
|
||||
```zsh
|
||||
plugins=(... foot)
|
||||
```
|
||||
|
||||
## Spawning new terminal instances in the current working directory
|
||||
|
||||
When spawning a new terminal instance (with `ctrl+shift+n` by default), the new
|
||||
instance will start in the current working directory.
|
||||
|
||||
## Jumping between prompts
|
||||
|
||||
Foot can move the current viewport to focus prompts of already executed
|
||||
commands (bound to ctrl+shift+z/x by default).
|
||||
|
||||
## Piping last command's output
|
||||
|
||||
The key binding `pipe-command-output` can pipe the last command's output to an
|
||||
application of your choice (similar to the other `pipe-*` key bindings):
|
||||
|
||||
```
|
||||
[key-bindings]
|
||||
pipe-command-output=[sh -c "f=$(mktemp); cat - > $f; footclient emacsclient -nw $f; rm $f"] Control+Shift+g
|
||||
```
|
||||
|
||||
When pressing ctrl+shift+g, the last command's output is written to a
|
||||
temporary file, then an emacsclient is started in a new footclient instance.
|
||||
The temporary file is removed after the footclient instance has closed.
|
||||
|
||||
10
plugins/foot/foot.plugin.zsh
Normal file
10
plugins/foot/foot.plugin.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function precmd {
|
||||
print -Pn "\e]133;A\e\\"
|
||||
if ! builtin zle; then
|
||||
print -n "\e]133;D\e\\"
|
||||
fi
|
||||
}
|
||||
|
||||
function preexec {
|
||||
print -n "\e]133;C\e\\"
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ function gemy {
|
|||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_gem" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _gem
|
||||
_comps[docker]=_gem
|
||||
_comps[gem]=_gem
|
||||
fi
|
||||
|
||||
# zsh 5.5 already provides completion for `_gem`. With this we ensure that
|
||||
|
|
@ -23,7 +23,7 @@ if is-at-least 5.5; then
|
|||
fi
|
||||
|
||||
{
|
||||
# Standarized $0 handling
|
||||
# Standardized $0 handling
|
||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ You can change the fetch interval in your .zshrc:
|
|||
GIT_AUTO_FETCH_INTERVAL=1200 # in seconds
|
||||
```
|
||||
|
||||
A log of `git fetch --all` will be saved in `.git/FETCH_LOG`.
|
||||
A log of `git-fetch-all` will be saved in `.git/FETCH_LOG`.
|
||||
|
||||
## Toggle auto-fetch per folder
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@ def get_tagname_or_hash():
|
|||
return hash_
|
||||
return None
|
||||
|
||||
# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stashs count
|
||||
# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stash count
|
||||
# Use `--git-common-dir` to avoid problems with git worktrees, which don't have individual stashes
|
||||
def get_stash():
|
||||
cmd = Popen(['git', 'rev-parse', '--git-dir'], stdout=PIPE, stderr=PIPE)
|
||||
cmd = Popen(['git', 'rev-parse', '--git-common-dir'], stdout=PIPE, stderr=PIPE)
|
||||
so, se = cmd.communicate()
|
||||
stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash')
|
||||
|
||||
|
|
@ -35,7 +36,6 @@ def get_stash():
|
|||
except IOError:
|
||||
return 0
|
||||
|
||||
|
||||
# `git status --porcelain --branch` can collect all information
|
||||
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
|
||||
po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)
|
||||
|
|
|
|||
|
|
@ -73,11 +73,13 @@ plugins=(... git)
|
|||
| `gcans!` | `git commit --verbose --all --signoff --no-edit --amend` |
|
||||
| `gcann!` | `git commit --verbose --all --date=now --no-edit --amend` |
|
||||
| `gc!` | `git commit --verbose --amend` |
|
||||
| `gcn` | `git commit --verbose --no-edit` |
|
||||
| `gcn!` | `git commit --verbose --no-edit --amend` |
|
||||
| `gcs` | `git commit -S` |
|
||||
| `gcss` | `git commit -S -s` |
|
||||
| `gcssm` | `git commit -S -s -m` |
|
||||
| `gcf` | `git config --list` |
|
||||
| `gcfu` | `git commit --fixup` |
|
||||
| `gdct` | `git describe --tags $(git rev-list --tags --max-count=1)` |
|
||||
| `gd` | `git diff` |
|
||||
| `gdca` | `git diff --cached` |
|
||||
|
|
@ -114,6 +116,7 @@ plugins=(... git)
|
|||
| `gma` | `git merge --abort` |
|
||||
| `gmc` | `git merge --continue` |
|
||||
| `gms` | `git merge --squash` |
|
||||
| `gmff` | `git merge --ff-only` |
|
||||
| `gmom` | `git merge origin/$(git_main_branch)` |
|
||||
| `gmum` | `git merge upstream/$(git_main_branch)` |
|
||||
| `gmtl` | `git mergetool --no-prompt` |
|
||||
|
|
@ -125,6 +128,8 @@ plugins=(... git)
|
|||
| `gprav` | `git pull --rebase --autostash -v` |
|
||||
| `gprom` | `git pull --rebase origin $(git_main_branch)` |
|
||||
| `gpromi` | `git pull --rebase=interactive origin $(git_main_branch)` |
|
||||
| `gprum` | `git pull --rebase upstream $(git_main_branch)` |
|
||||
| `gprumi` | `git pull --rebase=interactive upstream $(git_main_branch)` |
|
||||
| `ggpull` | `git pull origin "$(git_current_branch)"` |
|
||||
| `ggl` | `git pull origin $(current_branch)` |
|
||||
| `gluc` | `git pull upstream $(git_current_branch)` |
|
||||
|
|
@ -154,6 +159,7 @@ plugins=(... git)
|
|||
| `grbd` | `git rebase $(git_develop_branch)` |
|
||||
| `grbm` | `git rebase $(git_main_branch)` |
|
||||
| `grbom` | `git rebase origin/$(git_main_branch)` |
|
||||
| `grbum` | `git rebase upstream/$(git_main_branch)` |
|
||||
| `grf` | `git reflog` |
|
||||
| `gr` | `git remote` |
|
||||
| `grv` | `git remote --verbose` |
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ function work_in_progress() {
|
|||
# Aliases
|
||||
# (sorted alphabetically by command)
|
||||
# (order should follow README)
|
||||
# (in some cases force the alisas order to match README, like for example gke and gk)
|
||||
# (in some cases force the alias order to match README, like for example gke and gk)
|
||||
#
|
||||
|
||||
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
|
||||
|
|
@ -197,8 +197,10 @@ alias gcan!='git commit --verbose --all --no-edit --amend'
|
|||
alias gcans!='git commit --verbose --all --signoff --no-edit --amend'
|
||||
alias gcann!='git commit --verbose --all --date=now --no-edit --amend'
|
||||
alias gc!='git commit --verbose --amend'
|
||||
alias gcn='git commit --verbose --no-edit'
|
||||
alias gcn!='git commit --verbose --no-edit --amend'
|
||||
alias gcf='git config --list'
|
||||
alias gcfu='git commit --fixup'
|
||||
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
|
||||
alias gd='git diff'
|
||||
alias gdca='git diff --cached'
|
||||
|
|
@ -255,6 +257,7 @@ alias gm='git merge'
|
|||
alias gma='git merge --abort'
|
||||
alias gmc='git merge --continue'
|
||||
alias gms="git merge --squash"
|
||||
alias gmff="git merge --ff-only"
|
||||
alias gmom='git merge origin/$(git_main_branch)'
|
||||
alias gmum='git merge upstream/$(git_main_branch)'
|
||||
alias gmtl='git mergetool --no-prompt'
|
||||
|
|
@ -274,6 +277,8 @@ compdef _git ggu=git-checkout
|
|||
|
||||
alias gprom='git pull --rebase origin $(git_main_branch)'
|
||||
alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
|
||||
alias gprum='git pull --rebase upstream $(git_main_branch)'
|
||||
alias gprumi='git pull --rebase=interactive upstream $(git_main_branch)'
|
||||
alias ggpull='git pull origin "$(git_current_branch)"'
|
||||
|
||||
function ggl() {
|
||||
|
|
@ -337,6 +342,7 @@ alias grbs='git rebase --skip'
|
|||
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 grf='git reflog'
|
||||
alias gr='git remote'
|
||||
alias grv='git remote --verbose'
|
||||
|
|
|
|||
40
plugins/gitfast/MANUAL.adoc
Normal file
40
plugins/gitfast/MANUAL.adoc
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
This project is a friendly fork of the official Git completion
|
||||
(`contrib/completion`) and prompt scripts for Bash, Zsh, and possibly other
|
||||
shells.
|
||||
|
||||
Most Git developers use the Bash shell, for which the completion scripts work
|
||||
rather well, however, Zsh is typically neglected. I've sent many patches to fix
|
||||
the issues, many have been merged, but many have been ignored, thus the need for
|
||||
a canonical location of a good, working Zsh completion.
|
||||
|
||||
There are advantages for Bash users too. Currently the scripts under `contrib` are tied to the
|
||||
specific Git version, for example the completion scripts of version v2.40
|
||||
(https://git.kernel.org/pub/scm/git/git.git/plain/contrib/completion/git-completion.bash?h=v2.40.0[git-completion.bash])
|
||||
have issues with older versions of Git (e.g. v2.33); the ones in
|
||||
this project don't.
|
||||
|
||||
With `git-completion` you can be sure you are using the latest completion that
|
||||
works in both shells, and any Git version.
|
||||
|
||||
This is a sister project of the
|
||||
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitfast[Oh My Zsh
|
||||
gitfast] plugin (that I also maintain), which has similar needs.
|
||||
|
||||
== Installation ==
|
||||
|
||||
* https://github.com/felipec/git-completion/wiki/Bash[Bash instructions]
|
||||
* https://github.com/felipec/git-completion/wiki/Zsh[Zsh instructions]
|
||||
|
||||
== Improvements from upstream ==
|
||||
|
||||
This is a short list of the benefits you get:
|
||||
|
||||
* Easier installation
|
||||
* Tons of bug fixes
|
||||
* Works with older versions of git
|
||||
* Zsh: much more options
|
||||
* Zsh: quoting works properly
|
||||
* Zsh: automatic suffix removal
|
||||
|
||||
For a full list of all the patches on top of upstream git check
|
||||
https://github.com/felipec/git-completion/wiki/Patches[Patches].
|
||||
|
|
@ -2,23 +2,11 @@
|
|||
|
||||
# zsh completion wrapper for git
|
||||
#
|
||||
# Copyright (c) 2012-2020 Felipe Contreras <felipe.contreras@gmail.com>
|
||||
# Copyright (c) 2012-2024 Felipe Contreras <felipe.contreras@gmail.com>
|
||||
#
|
||||
# The recommended way to install this script is to make a copy of it as a
|
||||
# file named '_git' inside any directory in your fpath.
|
||||
# The recommended way to use this script is to prepend its location to your $fpath:
|
||||
#
|
||||
# For example, create a directory '~/.zsh/', copy this file to '~/.zsh/_git',
|
||||
# and then add the following to your ~/.zshrc file:
|
||||
#
|
||||
# fpath=(~/.zsh $fpath)
|
||||
#
|
||||
# You need git's bash completion script installed. By default bash-completion's
|
||||
# location will be used (e.g. pkg-config --variable=completionsdir bash-completion).
|
||||
#
|
||||
# If your bash completion script is somewhere else, you can specify the
|
||||
# location in your ~/.zshrc:
|
||||
#
|
||||
# zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
|
||||
# fpath=($git_completion_srcdir $fpath)
|
||||
#
|
||||
|
||||
zstyle -T ':completion:*:*:git:*' tag-order && \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
# bash/zsh completion support for core Git.
|
||||
#
|
||||
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
|
||||
# Copyright (c) 2012-2024 Felipe Contreras <felipe.contreras@gmail.com>
|
||||
#
|
||||
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
|
||||
# Distributed under the GNU General Public License, version 2.0.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ files=(
|
|||
/etc/grc.zsh # default
|
||||
/usr/local/etc/grc.zsh # homebrew darwin-x64
|
||||
/opt/homebrew/etc/grc.zsh # homebrew darwin-arm64
|
||||
/home/linuxbrew/.linuxbrew/etc/grc.zsh # linuxbrew
|
||||
/usr/share/grc/grc.zsh # Gentoo Linux (app-misc/grc)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -295,8 +295,8 @@ _history-substring-search-begin() {
|
|||
fi
|
||||
|
||||
#
|
||||
# Escape and join query parts with wildcard character '*' as seperator
|
||||
# `(j:CHAR:)` join array to string with CHAR as seperator
|
||||
# Escape and join query parts with wildcard character '*' as separator
|
||||
# `(j:CHAR:)` join array to string with CHAR as separator
|
||||
#
|
||||
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
- Zaphod.
|
||||
%
|
||||
"`In those days spirits were brave, the stakes were high, men were REAL men, women were REAL women, and small furry creatures from Alpha Centauri were REAL small furry creatures from Aplha Centauri.'"
|
||||
"`In those days spirits were brave, the stakes were high, men were REAL men, women were REAL women, and small furry creatures from Alpha Centauri were REAL small furry creatures from Alpha Centauri.'"
|
||||
|
||||
- The Book getting all nostalgic.
|
||||
%
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ This plugin supplies one command, `jira`, through which all its features are exp
|
|||
| `jira new` | Opens a new Jira issue dialogue |
|
||||
| `jira ABC-123` | Opens an existing issue |
|
||||
| `jira ABC-123 m` | Opens an existing issue for adding a comment |
|
||||
| `jira project ABC` | Opens JIRA project summary |
|
||||
| `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
|
||||
| `jira mine` | Queries for your own issues |
|
||||
| `jira tempo` | Opens your JIRA Tempo |
|
||||
|
|
@ -43,6 +44,22 @@ starting with "_": "MP-1234_fix_dashboard". In both these cases, the issue opene
|
|||
This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234",
|
||||
"mp-1234" opens the issue "mp-1234", and "1234" opens the issue "MP-1234".
|
||||
|
||||
If your branch naming convention deviates, you can overwrite the jira_branch function to determine and echo the Jira issue key yourself.
|
||||
Define a function `jira_branch` after sourcing `oh-my-zsh.sh` in your `.zshrc`.
|
||||
Example:
|
||||
```zsh
|
||||
# Determine branch name from naming convention 'type/KEY-123/description'.
|
||||
function jira_branch() {
|
||||
# Get name of the branch
|
||||
issue_arg=$(git rev-parse --abbrev-ref HEAD)
|
||||
# Strip prefixes like feature/ or bugfix/
|
||||
issue_arg=${issue_arg#*/}
|
||||
# Strip suffixes like /some-branch-description
|
||||
issue_arg=${issue_arg%%/*}
|
||||
# Return the value
|
||||
echo $issue_arg
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### Debugging usage
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ local -a _1st_arguments
|
|||
_1st_arguments=(
|
||||
'new:create a new issue'
|
||||
'mine:open my issues'
|
||||
'project:open the project'
|
||||
'dashboard:open the dashboard'
|
||||
'tempo:open the tempo'
|
||||
'reported:search for issues reported by a user'
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ jira Performs the default action
|
|||
jira new Opens a new Jira issue dialogue
|
||||
jira ABC-123 Opens an existing issue
|
||||
jira ABC-123 m Opens an existing issue for adding a comment
|
||||
jira project ABC Opens JIRA project summary
|
||||
jira dashboard [rapid_view] Opens your JIRA dashboard
|
||||
jira mine Queries for your own issues
|
||||
jira tempo Opens your JIRA Tempo
|
||||
|
|
@ -17,6 +18,30 @@ jira branch Opens an existing issue matching the current bra
|
|||
EOF
|
||||
}
|
||||
|
||||
# If your branch naming convention deviates, you can partially override this plugin function
|
||||
# to determine the jira issue key based on your formatting.
|
||||
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#partially-overriding-an-existing-plugin
|
||||
function jira_branch() {
|
||||
# Get name of the branch
|
||||
issue_arg=$(git rev-parse --abbrev-ref HEAD)
|
||||
# Strip prefixes like feature/ or bugfix/
|
||||
issue_arg=${issue_arg##*/}
|
||||
# Strip suffixes starting with _
|
||||
issue_arg=(${(s:_:)issue_arg})
|
||||
# If there is only one part, it means that there is a different delimiter. Try with -
|
||||
if [[ ${#issue_arg[@]} = 1 && ${issue_arg} == *-* ]]; then
|
||||
issue_arg=(${(s:-:)issue_arg})
|
||||
issue_arg="${issue_arg[1]}-${issue_arg[2]}"
|
||||
else
|
||||
issue_arg=${issue_arg[1]}
|
||||
fi
|
||||
if [[ "${issue_arg:l}" = ${jira_prefix:l}* ]]; then
|
||||
echo "${issue_arg}"
|
||||
else
|
||||
echo "${jira_prefix}${issue_arg}"
|
||||
fi
|
||||
}
|
||||
|
||||
function jira() {
|
||||
emulate -L zsh
|
||||
local action jira_url jira_prefix
|
||||
|
|
@ -64,6 +89,9 @@ function jira() {
|
|||
elif [[ "$action" == "mine" ]]; then
|
||||
echo "Opening my issues"
|
||||
open_command "${jira_url}/issues/?filter=-1"
|
||||
elif [[ "$action" == "project" ]]; then
|
||||
echo "Opening project"
|
||||
open_command "${jira_url}/jira/software/c/projects/${2}/summary"
|
||||
elif [[ "$action" == "dashboard" ]]; then
|
||||
echo "Opening dashboard"
|
||||
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
|
||||
|
|
@ -91,24 +119,7 @@ function jira() {
|
|||
# but `branch` is a special case that will parse the current git branch
|
||||
local issue_arg issue
|
||||
if [[ "$action" == "branch" ]]; then
|
||||
# Get name of the branch
|
||||
issue_arg=$(git rev-parse --abbrev-ref HEAD)
|
||||
# Strip prefixes like feature/ or bugfix/
|
||||
issue_arg=${issue_arg##*/}
|
||||
# Strip suffixes starting with _
|
||||
issue_arg=(${(s:_:)issue_arg})
|
||||
# If there is only one part, it means that there is a different delimiter. Try with -
|
||||
if [[ ${#issue_arg[@]} = 1 && ${issue_arg} == *-* ]]; then
|
||||
issue_arg=(${(s:-:)issue_arg})
|
||||
issue_arg="${issue_arg[1]}-${issue_arg[2]}"
|
||||
else
|
||||
issue_arg=${issue_arg[1]}
|
||||
fi
|
||||
if [[ "${issue_arg:l}" = ${jira_prefix:l}* ]]; then
|
||||
issue="${issue_arg}"
|
||||
else
|
||||
issue="${jira_prefix}${issue_arg}"
|
||||
fi
|
||||
issue=$(jira_branch)
|
||||
else
|
||||
issue_arg=${(U)action}
|
||||
issue="${jira_prefix}${issue_arg}"
|
||||
|
|
|
|||
90
plugins/jj/README.md
Normal file
90
plugins/jj/README.md
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
# jj - Jujutsu CLI
|
||||
|
||||
This plugin provides autocompletion for [jj](https://martinvonz.github.io/jj).
|
||||
|
||||
To use it, add `jj` to the plugins array of your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... jj)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command |
|
||||
| ------ | ----------------------------- |
|
||||
| jjc | `jj commit` |
|
||||
| jjcmsg | `jj commit --message` |
|
||||
| jjd | `jj diff` |
|
||||
| jjdmsg | `jj desc --message` |
|
||||
| jjds | `jj desc` |
|
||||
| jje | `jj edit` |
|
||||
| jjgcl | `jj git clone` |
|
||||
| jjgf | `jj git fetch` |
|
||||
| jjgfa | `jj git fetch --all-remotes` |
|
||||
| jjgp | `jj git push` |
|
||||
| jjl | `jj log` |
|
||||
| jjla | `jj log -r "all()"` |
|
||||
| jjn | `jj new` |
|
||||
| jjrb | `jj rebase` |
|
||||
| jjrs | `jj restore` |
|
||||
| jjrt | `cd "$(jj root \|\| echo .)"` |
|
||||
| jjsp | `jj split` |
|
||||
| jjsq | `jj squash` |
|
||||
|
||||
## Prompt usage
|
||||
|
||||
Because `jj` has a very powerful [template syntax](https://martinvonz.github.io/jj/latest/templates/), this
|
||||
plugin only exposes a convenience function `jj_prompt_template` to read information from the current change.
|
||||
It is basically the same as `jj log --no-graph -r @ -T $1`:
|
||||
|
||||
```sh
|
||||
_my_theme_jj_info() {
|
||||
jj_prompt_template 'self.change_id().shortest(3)'
|
||||
}
|
||||
|
||||
PROMPT='$(_my_theme_jj_info) $'
|
||||
```
|
||||
|
||||
`jj_prompt_template` escapes `%` signs in the output. Use `jj_prompt_template_raw` if you don't want that
|
||||
(e.g. to colorize the output).
|
||||
|
||||
However, because `jj` can be used inside a Git repository, some themes might clash with it. Generally, you can
|
||||
fix it with a wrapper function that tries `jj` first and then falls back to `git` if it didn't work:
|
||||
|
||||
```sh
|
||||
_my_theme_vcs_info() {
|
||||
jj_prompt_template 'self.change_id().shortest(3)' \
|
||||
|| git_prompt_info
|
||||
}
|
||||
|
||||
PROMPT='$(_my_theme_vcs_info) $'
|
||||
```
|
||||
|
||||
You can find an example
|
||||
[here](https://github.com/nasso/omzsh/blob/e439e494f22f4fd4ef1b6cb64626255f4b341c1b/themes/sunakayu.zsh-theme).
|
||||
|
||||
### Performance
|
||||
|
||||
Sometimes `jj` can be slower than `git`.
|
||||
|
||||
If you feel slowdowns, consider using the following:
|
||||
|
||||
```
|
||||
zstyle :omz:plugins:jj ignore-working-copy yes
|
||||
```
|
||||
|
||||
This will add `--ignore-working-copy` to all `jj` commands executed by your prompt. The downside here is that
|
||||
your prompt might be out-of-sync until the next time `jj` gets a chance to _not_ ignore the working copy (i.e.
|
||||
you manually run a `jj` command).
|
||||
|
||||
If you prefer to keep your prompt always up-to-date but still don't want to _feel_ the slowdown, you can make
|
||||
your prompt asynchronous. This plugin doesn't do this automatically so you'd have to hack your theme a bit for
|
||||
that.
|
||||
|
||||
## See Also
|
||||
|
||||
- [martinvonz/jj](https://github.com/martinvonz/jj)
|
||||
|
||||
## Contributors
|
||||
|
||||
- [nasso](https://github.com/nasso) - Plugin Author
|
||||
54
plugins/jj/jj.plugin.zsh
Normal file
54
plugins/jj/jj.plugin.zsh
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# if jj is not found, don't do the rest of the script
|
||||
if (( ! $+commands[jj] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `jj`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_jj" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _jj
|
||||
_comps[jj]=_jj
|
||||
fi
|
||||
|
||||
COMPLETE=zsh jj >| "$ZSH_CACHE_DIR/completions/_jj" &|
|
||||
|
||||
function __jj_prompt_jj() {
|
||||
local -a flags
|
||||
flags=("--no-pager")
|
||||
if zstyle -t ':omz:plugins:jj' ignore-working-copy; then
|
||||
flags+=("--ignore-working-copy")
|
||||
fi
|
||||
command jj $flags "$@"
|
||||
}
|
||||
|
||||
# convenience functions for themes
|
||||
function jj_prompt_template_raw() {
|
||||
__jj_prompt_jj log --no-graph -r @ -T "$@" 2> /dev/null
|
||||
}
|
||||
|
||||
function jj_prompt_template() {
|
||||
local out
|
||||
out=$(jj_prompt_template_raw "$@") || return 1
|
||||
echo "${out:gs/%/%%}"
|
||||
}
|
||||
|
||||
# Aliases (sorted alphabetically)
|
||||
alias jjc='jj commit'
|
||||
alias jjcmsg='jj commit --message'
|
||||
alias jjd='jj diff'
|
||||
alias jjdmsg='jj desc --message'
|
||||
alias jjds='jj desc'
|
||||
alias jje='jj edit'
|
||||
alias jjgcl='jj git clone'
|
||||
alias jjgf='jj git fetch'
|
||||
alias jjgfa='jj git fetch --all-remotes'
|
||||
alias jjgp='jj git push'
|
||||
alias jjl='jj log'
|
||||
alias jjla='jj log -r "all()"'
|
||||
alias jjn='jj new'
|
||||
alias jjrb='jj rebase'
|
||||
alias jjrs='jj restore'
|
||||
alias jjrt='cd "$(jj root || echo .)"'
|
||||
alias jjsp='jj split'
|
||||
alias jjsq='jj squash'
|
||||
|
|
@ -8,6 +8,17 @@ To use it, add `jsontools` to the plugins array in your zshrc file:
|
|||
plugins=(... jsontools)
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
The plugin uses one of these tools to process JSON data, in the following order:
|
||||
|
||||
- `node`
|
||||
- `python3`
|
||||
- `ruby`
|
||||
|
||||
Any of these must be in `$PATH` before the plugin is loaded, otherwise the plugin exits
|
||||
prematurely and the functions will not be available.
|
||||
|
||||
## Usage
|
||||
|
||||
Usage is simple... just take your json data and pipe it into the appropriate jsontool:
|
||||
|
|
@ -19,7 +30,7 @@ Usage is simple... just take your json data and pipe it into the appropriate jso
|
|||
|
||||
### Supports NDJSON (Newline Delimited JSON)
|
||||
|
||||
The plugin also supports [NDJSON](http://ndjson.org/) input, which means all functions
|
||||
The plugin also supports [NDJSON](https://github.com/ndjson/ndjson-spec) input, which means all functions
|
||||
have an alternative function that reads and processes the input line by line. These
|
||||
functions have the same name except using `ndjson` instead of `json`:
|
||||
|
||||
|
|
|
|||
9
plugins/k9s/README.md
Normal file
9
plugins/k9s/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# k9s plugin
|
||||
|
||||
This plugin adds completion support for the [k9s](https://k9scli.io).
|
||||
|
||||
To use it, add `k9s` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... k9s)
|
||||
```
|
||||
14
plugins/k9s/k9s.plugin.zsh
Normal file
14
plugins/k9s/k9s.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
if (( ! $+commands[k9s] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file does not exist, fake it and load it
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_k9s" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _k9s
|
||||
_comps[k9s]=_k9s
|
||||
fi
|
||||
|
||||
# and then generate it in the background. On first completion,
|
||||
# the actual completion file will be loaded.
|
||||
k9s completion zsh >| "$ZSH_CACHE_DIR/completions/_k9s" &|
|
||||
16
plugins/kamal/README.md
Normal file
16
plugins/kamal/README.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Kamal
|
||||
|
||||
This plugin provides completion for [Kamal](https://kamal-deploy.org/) as well as some
|
||||
aliases for frequent Kamal commands.
|
||||
|
||||
To use it, add kamal to the plugins array of your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... kamal)
|
||||
```
|
||||
|
||||
## Aliase
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-----------|----------------------------------|----------------------------------------------------------------------------------|
|
||||
| kad | `kamal deploy` | Deploy app to servers |
|
||||
691
plugins/kamal/_kamal
Normal file
691
plugins/kamal/_kamal
Normal file
|
|
@ -0,0 +1,691 @@
|
|||
#compdef kamal
|
||||
|
||||
# Description
|
||||
# -----------
|
||||
# zsh completion for Kamal (https://kamal-deploy.org/)
|
||||
# -------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
# * Igor Aleksandrov <igor.alexandrov@gmail.com>
|
||||
# -------------------------------------------------------------------------
|
||||
# Inspiration
|
||||
# -----------
|
||||
# * docker-compose ohmyzsh completion script by @sdurrheimer Steve Durrheimer
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# _kamal_commands() {
|
||||
# # Only initialize if empty
|
||||
# if (( ${#kamal_commands} == 0 )); then
|
||||
# kamal_commands=(
|
||||
# accessory
|
||||
# app
|
||||
# audit
|
||||
# build
|
||||
# config
|
||||
# deploy
|
||||
# details
|
||||
# docs
|
||||
# help
|
||||
# init
|
||||
# lock
|
||||
# proxy
|
||||
# prune
|
||||
# redeploy
|
||||
# registry
|
||||
# remove
|
||||
# rollback
|
||||
# secrets
|
||||
# server
|
||||
# setup
|
||||
# upgrade
|
||||
# version
|
||||
# )
|
||||
# fi
|
||||
|
||||
# _values 'Kamal commands' $kamal_commands
|
||||
# }
|
||||
|
||||
typeset -gr _kamal_commands=(
|
||||
'accessory:Control accessory services'
|
||||
'app:Control application deployment'
|
||||
'audit:Audit security of deployment'
|
||||
'build:Build and manage app images'
|
||||
'config:Show effective configuration'
|
||||
'deploy:Deploy app to servers'
|
||||
'details:Show details about deployment'
|
||||
'docs:Open documentation in browser'
|
||||
'help:Show command help'
|
||||
'init:Initialize new Kamal project'
|
||||
'lock:Manage deployment locks'
|
||||
'proxy:Control reverse proxy'
|
||||
'prune:Clean up containers and images'
|
||||
'redeploy:Redeploy current version'
|
||||
'registry:Manage Docker registry access'
|
||||
'remove:Remove app from servers'
|
||||
'rollback:Rollback to a previous version'
|
||||
'secrets:Manage deployment secrets'
|
||||
'server:Control server configuration'
|
||||
'setup:Setup initial deployment'
|
||||
'upgrade:Upgrade deployment'
|
||||
'version:Show Kamal version'
|
||||
)
|
||||
|
||||
# Helper function to display messages
|
||||
_kamal_message() {
|
||||
local msg="$1"
|
||||
_kamal_message "==> $msg"
|
||||
}
|
||||
|
||||
# Helper function to extract destination names from ./config/deploy.*.yml
|
||||
_kamal_destinations() {
|
||||
local -a dests
|
||||
local file
|
||||
|
||||
# Check if config directory exists
|
||||
if [[ ! -d "config" ]]; then
|
||||
_kamal_message "Cannot find Kamal configuration directory at ./config" && return 1
|
||||
fi
|
||||
|
||||
for file in config/deploy.*.yml(N); do
|
||||
[[ $file =~ config/deploy\.(.+)\.yml ]] && dests+=("${match[1]}")
|
||||
done
|
||||
|
||||
_values 'Destination' $dests
|
||||
}
|
||||
|
||||
# Define global _kamal_flags array
|
||||
typeset -ga _kamal_flags
|
||||
_kamal_flags=(
|
||||
'(-v --verbose )'{-v,--verbose}'[Detailed logging]'
|
||||
'(--no-verbose --skip-verbose)'{--no-verbose,--skip-verbose}'[No detailed logging]'
|
||||
'(-q --quiet --no-quiet --skip-quiet)'{-q,--quiet}'[Minimal logging]'
|
||||
'(-q --quiet --no-quiet --skip-quiet)'{--no-quiet,--skip-quiet}'[No minimal logging]'
|
||||
'--version=[Run commands against a specific app version]:version'
|
||||
'(-p --primary --no-primary --skip-primary)'{-p,--primary}'[Run commands only on primary host instead of all]'
|
||||
'(-p --primary --no-primary --skip-primary)'{--no-primary,--skip-primary}'[Do not run commands only on primary host]'
|
||||
'(-h --hosts)'{-h,--hosts=}'[Run commands on these hosts instead of all]:hosts'
|
||||
'(-r --roles)'{-r,--roles=}'[Run commands on these roles instead of all]:roles'
|
||||
'(-c --config-file)'{-c,--config-file=}'[Path to config file]:config file:_files'
|
||||
'(-d --destination)'{-d,--destination=}'[Specify destination to be used for config file]:destination:_kamal_destinations'
|
||||
'(-H --skip-hooks)'{-H,--skip-hooks}'[Do not run hooks]'
|
||||
)
|
||||
|
||||
_kamal() {
|
||||
local context state state_descr line curcontext="$curcontext"
|
||||
typeset -A opt_args
|
||||
|
||||
local ret=1
|
||||
|
||||
_arguments -C \
|
||||
$_kamal_flags \
|
||||
'1: :->command' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
# First argument - show available commands
|
||||
_describe -t kamal-commands "Kamal commands" _kamal_commands && ret=0
|
||||
;;
|
||||
(args)
|
||||
# Subsequent arguments - handle based on the command
|
||||
case $words[1] in
|
||||
(accessory)
|
||||
_kamal_accessory && ret=0
|
||||
;;
|
||||
(app)
|
||||
_kamal_app && ret=0
|
||||
;;
|
||||
(audit)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(build)
|
||||
_kamal_build && ret=0
|
||||
;;
|
||||
(config)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(deploy)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(details)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(docs)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(help)
|
||||
_kamal_help && ret=0
|
||||
;;
|
||||
(init)
|
||||
local -a init_flags
|
||||
init_flags=(
|
||||
$_kamal_flags
|
||||
'(--bundle --no-bundle --skip-bundle)--bundle[Add Kamal to the Gemfile and create a bin/kamal binstub]'
|
||||
'(--bundle --no-bundle --skip-bundle)--no-bundle[Do not add Kamal to the Gemfile and create a bin/kamal binstub]'
|
||||
'(--bundle --no-bundle --skip-bundle)--skip-bundle[Skip add Kamal to the Gemfile and create a bin/kamal binstub]'
|
||||
)
|
||||
_arguments $init_flags && ret=0
|
||||
;;
|
||||
(lock)
|
||||
_kamal_lock && ret=0
|
||||
;;
|
||||
(proxy)
|
||||
_kamal_proxy && ret=0
|
||||
;;
|
||||
(prune)
|
||||
_kamal_prune && ret=0
|
||||
;;
|
||||
(redeploy)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(registry)
|
||||
_kamal_registry && ret=0
|
||||
;;
|
||||
(remove)
|
||||
local -a remove_flags
|
||||
remove_flags=(
|
||||
$_kamal_flags
|
||||
'(-y --confirmed --no-confirmed --skip-confirmed)'{-y,--confirmed}'[Proceed without confirmation question]'
|
||||
'(-y --confirmed --no-confirmed --skip-confirmed)--no-confirmed[Proceed without confirmation question]'
|
||||
'(-y --confirmed --no-confirmed --skip-confirmed)--skip-confirmed[Proceed without confirmation question]'
|
||||
)
|
||||
_arguments $remove_flags && ret=0
|
||||
;;
|
||||
(rollback)
|
||||
if (( CURRENT == 2 )); then
|
||||
_kamal_message "Enter the version to rollback to" && ret=0
|
||||
else
|
||||
_values $_kamal_flags && ret=0
|
||||
fi
|
||||
;;
|
||||
(secrets)
|
||||
_kamal_secrets && ret=0
|
||||
;;
|
||||
(server)
|
||||
_kamal_server && ret=0
|
||||
;;
|
||||
(setup)
|
||||
local -a setup_flags
|
||||
setup_flags=(
|
||||
$_kamal_flags
|
||||
'(-P --skip-push)'{-P,--skip-push}'[Skip image build and push]'
|
||||
)
|
||||
_arguments $setup_flags && ret=0
|
||||
;;
|
||||
(upgrade)
|
||||
local -a upgrade_flags
|
||||
upgrade_flags=(
|
||||
$_kamal_flags
|
||||
'(-y --confirmed --no-confirmed --skip-confirmed)'{-y,--confirmed}'[Proceed without confirmation question]'
|
||||
'(-y --confirmed --no-confirmed --skip-confirmed)--no-confirmed[Do not proceed without confirmation question]'
|
||||
'(-y --confirmed --no-confirmed --skip-confirmed)--skip-confirmed[Skip confirmation question]'
|
||||
'(--rolling --no-rolling --skip-rolling)--rolling[Upgrade one host at a time]'
|
||||
'(--rolling --no-rolling --skip-rolling)--no-rolling[Do not upgrade one host at a time]'
|
||||
'(--rolling --no-rolling --skip-rolling)--skip-rolling[Skip rolling upgrade]'
|
||||
)
|
||||
_arguments $upgrade_flags && ret=0
|
||||
;;
|
||||
(version)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_accessory() {
|
||||
local context state line
|
||||
typeset -A opt_args
|
||||
local ret=1
|
||||
|
||||
# Define accessory subcommands
|
||||
local -a accessory_subcommands
|
||||
accessory_subcommands=(
|
||||
"boot:Boot new accessory service on host (use NAME=all to boot all accessories)"
|
||||
"details:Show details about accessory on host (use NAME=all to show all accessories)"
|
||||
"exec:Execute a custom command on servers within the accessory container (use --help to show options)"
|
||||
"help:Describe subcommands or one specific subcommand"
|
||||
"logs:Show log lines from accessory on host (use --help to show options)"
|
||||
"reboot:Reboot existing accessory on host (stop container, remove container, start new container; use NAME=all to boot all accessories)"
|
||||
"remove:Remove accessory container, image and data directory from host (use NAME=all to remove all accessories)"
|
||||
"restart:Restart existing accessory container on host"
|
||||
"start:Start existing accessory container on host"
|
||||
"stop:Stop existing accessory container on host"
|
||||
"upgrade:Upgrade accessories from Kamal 1.x to 2.0 (restart them in 'kamal' network)"
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(subcmd)
|
||||
_describe -t accessory-commands "Kamal accessory commands" accessory_subcommands && ret=0
|
||||
;;
|
||||
(args)
|
||||
case $words[1] in
|
||||
(boot|details|exec|logs|reboot|remove|restart|start|stop)
|
||||
# These commands require a NAME parameter
|
||||
if (( CURRENT == 2 )); then
|
||||
# At the NAME position - we could add accessory name completion here
|
||||
# if we had a way to list available accessories
|
||||
_kamal_message "Specify an accessory name (or 'all' for all accessories)" && ret=0
|
||||
elif [[ "$words[1]" == "exec" && CURRENT == 3 ]]; then
|
||||
# For exec, the 3rd argument is a command
|
||||
_kamal_message "Enter a command to execute" && ret=0
|
||||
elif (( CURRENT > 2 )) && [[ "$words[1]" != "exec" || CURRENT > 3 ]]; then
|
||||
_values $_kamal_flags && ret=0
|
||||
fi
|
||||
;;
|
||||
(help)
|
||||
# Remove help itself from the list of commands
|
||||
accessory_subcommands=("${(@)accessory_subcommands:#help*}")
|
||||
_describe -t accessory-help-commands "Kamal accessory help commands" accessory_subcommands
|
||||
;;
|
||||
(upgrade)
|
||||
# For upgrade, show flags immediately
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_app() {
|
||||
local context state line
|
||||
typeset -A opt_args
|
||||
local ret=1
|
||||
|
||||
local -a app_subcommands
|
||||
app_subcommands=(
|
||||
"boot:Boot app on servers (or reboot app if already running)"
|
||||
"containers:Show app containers on servers"
|
||||
"details:Show details about app containers"
|
||||
"exec:Execute a custom command on servers within the app container (use --help to show options)"
|
||||
"help:Describe subcommands or one specific subcommand"
|
||||
"images:Show app images on servers"
|
||||
"logs:Show log lines from app on servers (use --help to show options)"
|
||||
"remove:Remove app containers and images from servers"
|
||||
"stale_containers:Detect app stale containers"
|
||||
"start:Start existing app container on servers"
|
||||
"stop:Stop app container on servers"
|
||||
"version:Show app version currently running on servers"
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(subcmd)
|
||||
_describe -t app-commands "Kamal app commands" app_subcommands && ret=0
|
||||
;;
|
||||
(args)
|
||||
case $words[1] in
|
||||
(boot|containers|details|images|logs|remove|stale_containers|start|stop)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(exec)
|
||||
# For exec, the next argument is a command
|
||||
if (( CURRENT == 2 )); then
|
||||
_kamal_message "Enter a command to execute" && ret=0
|
||||
else
|
||||
_values $_kamal_flags && ret=0
|
||||
fi
|
||||
;;
|
||||
(help)
|
||||
# Remove help itself from the list of commands
|
||||
app_subcommands=("${(@)app_subcommands:#help*}")
|
||||
_describe -t app-help-commands "Kamal app help commands" app_subcommands
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_build() {
|
||||
local context state line
|
||||
typeset -A opt_args
|
||||
local ret=1
|
||||
|
||||
local -a build_subcommands
|
||||
build_subcommands=(
|
||||
"create:Create a build setup"
|
||||
"deliver:Build app and push app image to registry then pull image on servers"
|
||||
"details:Show build setup"
|
||||
"dev:Build using the working directory, tag it as dirty, and push to local image store."
|
||||
"help:Describe subcommands or one specific subcommand"
|
||||
"pull:Pull app image from registry onto servers"
|
||||
"push:Build and push app image to registry"
|
||||
"remove:Remove build setup"
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(subcmd)
|
||||
_describe -t build-commands "Kamal build commands" build_subcommands && ret=0
|
||||
;;
|
||||
(args)
|
||||
case $words[1] in
|
||||
(create|deliver|details|dev|pull|push|remove)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(help)
|
||||
# Remove help itself from the list of commands
|
||||
build_subcommands=("${(@)build_subcommands:#help*}")
|
||||
_describe -t build-help-commands "Kamal build help commands" build_subcommands
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_help() {
|
||||
local ret=1
|
||||
|
||||
# Make sure kamal_commands is initialized properly
|
||||
# if (( ${#kamal_commands} == 0 )); then
|
||||
# _kamal_commands >/dev/null
|
||||
# fi
|
||||
|
||||
# If we already have a command after "help", return without suggestions
|
||||
if (( CURRENT > 2 )); then
|
||||
ret=0
|
||||
else
|
||||
local -a help_commands
|
||||
# Filter out help from the list of commands
|
||||
help_commands=("${(@)_kamal_commands:#help}")
|
||||
|
||||
_values 'Kamal help' $help_commands && ret=0
|
||||
fi
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_lock() {
|
||||
local context state line
|
||||
typeset -A opt_args
|
||||
local ret=1
|
||||
|
||||
local -a lock_subcommands
|
||||
lock_subcommands=(
|
||||
"acquire:Acquire the deploy lock"
|
||||
"help:Describe subcommands or one specific subcommand"
|
||||
"release:Release the deploy lock"
|
||||
"status:Report lock status"
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(subcmd)
|
||||
_describe -t lock-commands "Kamal lock commands" lock_subcommands && ret=0
|
||||
;;
|
||||
(args)
|
||||
case $words[1] in
|
||||
(acquire)
|
||||
local -a acquire_flags
|
||||
acquire_flags=(
|
||||
$_kamal_flags
|
||||
'(-m --message)'{-m,--message=}'[A lock message]:message:' # Required flag
|
||||
)
|
||||
_arguments $acquire_flags && ret=0
|
||||
;;
|
||||
(release|status)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(help)
|
||||
# Remove help itself from the list of commands
|
||||
lock_subcommands=("${(@)lock_subcommands:#help*}")
|
||||
_describe -t lock-help-commands "Kamal lock help commands" lock_subcommands
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_proxy() {
|
||||
local context state line
|
||||
typeset -A opt_args
|
||||
local ret=1
|
||||
|
||||
local -a proxy_subcommands
|
||||
proxy_subcommands=(
|
||||
"boot:Boot proxy on servers"
|
||||
"boot_config:Manage kamal-proxy boot configuration"
|
||||
"details:Show details about proxy container from servers"
|
||||
"help:Describe subcommands or one specific subcommand"
|
||||
"logs:Show log lines from proxy on servers"
|
||||
"reboot:Reboot proxy on servers (stop container, remove container, start new container)"
|
||||
"remove:Remove proxy container and image from servers"
|
||||
"restart:Restart existing proxy container on servers"
|
||||
"start:Start existing proxy container on servers"
|
||||
"stop:Stop existing proxy container on servers"
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(subcmd)
|
||||
_describe -t proxy-commands "Kamal proxy commands" proxy_subcommands && ret=0
|
||||
;;
|
||||
(args)
|
||||
case $words[1] in
|
||||
(boot|details|logs|reboot|remove|restart|start|stop)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(boot_config)
|
||||
if (( CURRENT == 2 )); then
|
||||
local -a boot_config_commands=(
|
||||
"set:Set boot configuration"
|
||||
"get:Get boot configuration"
|
||||
"reset:Reset boot configuration"
|
||||
)
|
||||
_describe -t boot-config-commands "Boot config commands" boot_config_commands && ret=0
|
||||
else
|
||||
_values $_kamal_flags && ret=0
|
||||
fi
|
||||
;;
|
||||
(help)
|
||||
# Remove help itself from the list of commands
|
||||
proxy_subcommands=("${(@)proxy_subcommands:#help*}")
|
||||
_describe -t proxy-help-commands "Kamal proxy help commands" proxy_subcommands
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_prune() {
|
||||
local context state line
|
||||
typeset -A opt_args
|
||||
local ret=1
|
||||
|
||||
local -a prune_subcommands
|
||||
prune_subcommands=(
|
||||
"all:Prune unused images and stopped containers"
|
||||
"containers:Prune all stopped containers, except the last n (default 5)"
|
||||
"help:Describe subcommands or one specific subcommand"
|
||||
"images:Prune unused images"
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(subcmd)
|
||||
_describe -t prune-commands "Kamal prune commands" prune_subcommands && ret=0
|
||||
;;
|
||||
(args)
|
||||
case $words[1] in
|
||||
(all|containers|images)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(help)
|
||||
# Remove help itself from the list of commands
|
||||
prune_subcommands=("${(@)prune_subcommands:#help*}")
|
||||
_describe -t prune-help-commands "Kamal prune help commands" prune_subcommands
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_registry() {
|
||||
local context state line
|
||||
typeset -A opt_args
|
||||
local ret=1
|
||||
|
||||
local -a registry_subcommands
|
||||
registry_subcommands=(
|
||||
"help:Describe subcommands or one specific subcommand"
|
||||
"login:Log in to registry locally and remotely"
|
||||
"logout:Log out of registry locally and remotely"
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(subcmd)
|
||||
_describe -t registry-commands "Kamal registry commands" registry_subcommands && ret=0
|
||||
;;
|
||||
(args)
|
||||
case $words[1] in
|
||||
(help)
|
||||
# Remove help itself from the list of commands
|
||||
registry_subcommands=("${(@)registry_subcommands:#help*}")
|
||||
_describe -t registry-help-commands "Kamal registry help commands" registry_subcommands
|
||||
;;
|
||||
(login|logout)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_secrets() {
|
||||
local context state line
|
||||
typeset -A opt_args
|
||||
local ret=1
|
||||
|
||||
local -a secrets_subcommands
|
||||
secrets_subcommands=(
|
||||
"extract:Extract a single secret from the results of a fetch call"
|
||||
"fetch:Fetch secrets from a vault"
|
||||
"help:Describe subcommands or one specific subcommand"
|
||||
"print:Print the secrets (for debugging)"
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(subcmd)
|
||||
_describe -t secrets-commands "Kamal secrets commands" secrets_subcommands && ret=0
|
||||
;;
|
||||
(args)
|
||||
case $words[1] in
|
||||
(fetch)
|
||||
local -a fetch_flags
|
||||
fetch_flags=(
|
||||
$_kamal_flags
|
||||
'(-a --adapter)'{-a,--adapter=}'[Secret storage adapter]:adapter:(aws-parameter-store)'
|
||||
)
|
||||
_arguments $fetch_flags && ret=0
|
||||
;;
|
||||
(extract|print)
|
||||
_arguments $_kamal_flags && ret=0
|
||||
;;
|
||||
(help)
|
||||
# Remove help itself from the list of commands
|
||||
secrets_subcommands=("${(@)secrets_subcommands:#help*}")
|
||||
_describe -t secrets-help-commands "Kamal secrets help commands" secrets_subcommands
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal_server() {
|
||||
local context state line
|
||||
typeset -A opt_args
|
||||
local ret=1
|
||||
|
||||
local -a server_subcommands
|
||||
server_subcommands=(
|
||||
"bootstrap:Set up Docker to run Kamal apps"
|
||||
"exec:Run a custom command on the server (use --help to show options)"
|
||||
"help:Describe subcommands or one specific subcommand"
|
||||
)
|
||||
|
||||
local -a server_flags
|
||||
server_flags=(
|
||||
$_kamal_flags
|
||||
'(-i --interactive --no-interactive --skip-interactive)'{-i,--interactive}'[Run the command interactively]'
|
||||
'(-i --interactive --no-interactive --skip-interactive)--no-interactive[Do not run the command interactively]'
|
||||
'(-i --interactive --no-interactive --skip-interactive)--skip-interactive[Skip interactive mode]'
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
(subcmd)
|
||||
_describe -t server-commands "Kamal server commands" server_subcommands && ret=0
|
||||
;;
|
||||
(args)
|
||||
case $words[1] in
|
||||
(bootstrap)
|
||||
_arguments $server_flags && ret=0
|
||||
;;
|
||||
(exec)
|
||||
if (( CURRENT == 2 )); then
|
||||
# For exec, the next argument is a command
|
||||
_kamal_message "Enter a command to execute" && ret=0
|
||||
else
|
||||
_values $server_flags && ret=0
|
||||
fi
|
||||
;;
|
||||
(help)
|
||||
# Remove help itself from the list of commands
|
||||
server_subcommands=("${(@)server_subcommands:#help*}")
|
||||
_describe -t server-help-commands "Kamal server help commands" server_subcommands
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_kamal "$@"
|
||||
25
plugins/kamal/kamal.plugin.zsh
Normal file
25
plugins/kamal/kamal.plugin.zsh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Find kamal binary (local ./bin/kamal or global)
|
||||
function _kamal_command () {
|
||||
if [ -x "./bin/kamal" ]; then
|
||||
./bin/kamal "$@"
|
||||
else
|
||||
command kamal "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function which-kamal() {
|
||||
if [ -x "./bin/kamal" ]; then
|
||||
echo "Using local ./bin/kamal"
|
||||
else
|
||||
echo "Using global $(command -v kamal)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Use `_kamal_command`` function for `kamal` command
|
||||
alias kamal='_kamal_command'
|
||||
|
||||
# Aliases
|
||||
alias kad='kamal deploy'
|
||||
|
||||
# Hook up completion
|
||||
compdef _kamal_command=kamal
|
||||
|
|
@ -19,8 +19,15 @@ function {
|
|||
# load additional options
|
||||
zstyle -a :omz:plugins:keychain options options
|
||||
|
||||
# start keychain...
|
||||
keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
|
||||
# Check keychain version to decide whether to use --agents
|
||||
local version_string=$(keychain --version 2>&1 | head -n 2 | tail -n 1 | cut -d ' ' -f 4)
|
||||
# start keychain, only use --agents for versions below 2.9.0
|
||||
autoload -Uz is-at-least
|
||||
if is-at-least 2.9 "$version_string"; then
|
||||
keychain ${^options:-} ${^identities} --host $SHORT_HOST
|
||||
else
|
||||
keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
|
||||
fi
|
||||
|
||||
# Get the filenames to store/lookup the environment from
|
||||
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
|
||||
|
|
|
|||
|
|
@ -11,122 +11,126 @@ plugins=(... kubectl)
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------|
|
||||
| k | `kubectl` | The kubectl command |
|
||||
| kca | `kubectl --all-namespaces` | The kubectl command targeting all namespaces |
|
||||
| kaf | `kubectl apply -f` | Apply a YML file |
|
||||
| keti | `kubectl exec -ti` | Drop into an interactive terminal on a container |
|
||||
| | | **Manage configuration quickly to switch contexts between local, dev and staging** |
|
||||
| kcuc | `kubectl config use-context` | Set the current-context in a kubeconfig file |
|
||||
| kcsc | `kubectl config set-context` | Set a context entry in kubeconfig |
|
||||
| kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig |
|
||||
| kccc | `kubectl config current-context` | Display the current-context |
|
||||
| kcgc | `kubectl config get-contexts` | List of contexts available |
|
||||
| | | **General aliases** |
|
||||
| kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector |
|
||||
| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument |
|
||||
| | | **Pod management** |
|
||||
| kgp | `kubectl get pods` | List all pods in ps output format |
|
||||
| kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes |
|
||||
| kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included |
|
||||
| kep | `kubectl edit pods` | Edit pods from the default editor |
|
||||
| kdp | `kubectl describe pods` | Describe all pods |
|
||||
| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
|
||||
| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
|
||||
| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` |
|
||||
| | | **Service management** |
|
||||
| kgs | `kubectl get svc` | List all services in ps output format |
|
||||
| kgsw | `kgs --watch` | After listing all services, watch for changes |
|
||||
| kgswide | `kgs -o wide` | After listing all services, output in plain-text format with any additional information |
|
||||
| kes | `kubectl edit svc` | Edit services(svc) from the default editor |
|
||||
| kds | `kubectl describe svc` | Describe all services in detail |
|
||||
| kdels | `kubectl delete svc` | Delete all services matching passed argument |
|
||||
| | | **Ingress management** |
|
||||
| kgi | `kubectl get ingress` | List ingress resources in ps output format |
|
||||
| kei | `kubectl edit ingress` | Edit ingress resource from the default editor |
|
||||
| kdi | `kubectl describe ingress` | Describe ingress resource in detail |
|
||||
| kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument |
|
||||
| | | **Namespace management** |
|
||||
| kgns | `kubectl get namespaces` | List the current namespaces in a cluster |
|
||||
| kcn | `kubectl config set-context --current --namespace` | Change current namespace |
|
||||
| kens | `kubectl edit namespace` | Edit namespace resource from the default editor |
|
||||
| kdns | `kubectl describe namespace` | Describe namespace resource in detail |
|
||||
| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace |
|
||||
| | | **ConfigMap management** |
|
||||
| kgcm | `kubectl get configmaps` | List the configmaps in ps output format |
|
||||
| kecm | `kubectl edit configmap` | Edit configmap resource from the default editor |
|
||||
| kdcm | `kubectl describe configmap` | Describe configmap resource in detail |
|
||||
| kdelcm | `kubectl delete configmap` | Delete the configmap |
|
||||
| | | **Secret management** |
|
||||
| kgsec | `kubectl get secret` | Get secret for decoding |
|
||||
| kdsec | `kubectl describe secret` | Describe secret resource in detail |
|
||||
| kdelsec | `kubectl delete secret` | Delete the secret |
|
||||
| | | **Deployment management** |
|
||||
| kgd | `kubectl get deployment` | Get the deployment |
|
||||
| kgdw | `kgd --watch` | After getting the deployment, watch for changes |
|
||||
| kgdwide | `kgd -o wide` | After getting the deployment, output in plain-text format with any additional information |
|
||||
| ked | `kubectl edit deployment` | Edit deployment resource from the default editor |
|
||||
| kdd | `kubectl describe deployment` | Describe deployment resource in detail |
|
||||
| kdeld | `kubectl delete deployment` | Delete the deployment |
|
||||
| ksd | `kubectl scale deployment` | Scale a deployment |
|
||||
| krsd | `kubectl rollout status deployment` | Check the rollout status of a deployment |
|
||||
| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime |
|
||||
| | | **Rollout management** |
|
||||
| kgrs | `kubectl get replicaset` | List all ReplicaSets `rs` created by the deployment |
|
||||
| kdrs | `kubectl describe replicaset` | Describe ReplicaSet in detail |
|
||||
| kers | `kubectl edit replicaset` | Edit ReplicaSet from the default editor |
|
||||
| krh | `kubectl rollout history` | Check the revisions of this deployment |
|
||||
| kru | `kubectl rollout undo` | Rollback to the previous revision |
|
||||
| | | **Port forwarding** |
|
||||
| kpf | `kubectl port-forward` | Forward one or more local ports to a pod |
|
||||
| | | **Tools for accessing all information** |
|
||||
| kga | `kubectl get all` | List all resources in ps format |
|
||||
| kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces |
|
||||
| | | **Logs** |
|
||||
| kl | `kubectl logs` | Print the logs for a container or resource |
|
||||
| klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) |
|
||||
| | | **File copy** |
|
||||
| kcp | `kubectl cp` | Copy files and directories to and from containers |
|
||||
| | | **Node management** |
|
||||
| kgno | `kubectl get nodes` | List the nodes in ps output format |
|
||||
| keno | `kubectl edit node` | Edit nodes resource from the default editor |
|
||||
| kdno | `kubectl describe node` | Describe node resource in detail |
|
||||
| kdelno | `kubectl delete node` | Delete the node |
|
||||
| | | **Persistent Volume Claim management** |
|
||||
| kgpvc | `kubectl get pvc` | List all PVCs |
|
||||
| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes |
|
||||
| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor |
|
||||
| kdpvc | `kubectl describe pvc` | Describe all pvcs |
|
||||
| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments |
|
||||
| | | **StatefulSets management** |
|
||||
| kgss | `kubectl get statefulset` | List the statefulsets in ps format |
|
||||
| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes |
|
||||
| kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information |
|
||||
| kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor |
|
||||
| kdss | `kubectl describe statefulset` | Describe statefulset resource in detail |
|
||||
| kdelss | `kubectl delete statefulset` | Delete the statefulset |
|
||||
| ksss | `kubectl scale statefulset` | Scale a statefulset |
|
||||
| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment |
|
||||
| | | **Service Accounts management** |
|
||||
| kdsa | `kubectl describe sa` | Describe a service account in details |
|
||||
| kdelsa | `kubectl delete sa` | Delete the service account |
|
||||
| | | **DaemonSet management** |
|
||||
| kgds | `kubectl get daemonset` | List all DaemonSets in ps output format |
|
||||
| kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes |
|
||||
| keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor |
|
||||
| kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail |
|
||||
| kdelds | `kubectl delete daemonset` | Delete all DaemonSets matching passed argument |
|
||||
| | | **CronJob management** |
|
||||
| kgcj | `kubectl get cronjob` | List all CronJobs in ps output format |
|
||||
| kecj | `kubectl edit cronjob` | Edit CronJob from the default editor |
|
||||
| kdcj | `kubectl describe cronjob` | Describe a CronJob in details |
|
||||
| kdelcj | `kubectl delete cronjob` | Delete the CronJob |
|
||||
| | | **Job management** |
|
||||
| kgj | `kubectl get job` | List all Job in ps output format |
|
||||
| kej | `kubectl edit job` | Edit a Job in details |
|
||||
| kdj | `kubectl describe job` | Describe the Job |
|
||||
| kdelj | `kubectl delete job` | Delete the Job |
|
||||
| Alias | Command | Description |
|
||||
| :------- | :------------------------------------------------------ | :----------------------------------------------------------------------------------------------- |
|
||||
| k | `kubectl` | The kubectl command |
|
||||
| kca | `kubectl --all-namespaces` | The kubectl command targeting all namespaces |
|
||||
| kaf | `kubectl apply -f` | Apply a YML file |
|
||||
| keti | `kubectl exec -ti` | Drop into an interactive terminal on a container |
|
||||
| | | **Manage configuration quickly to switch contexts between local, dev and staging** |
|
||||
| kcuc | `kubectl config use-context` | Set the current-context in a kubeconfig file |
|
||||
| kcsc | `kubectl config set-context` | Set a context entry in kubeconfig |
|
||||
| kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig |
|
||||
| kccc | `kubectl config current-context` | Display the current-context |
|
||||
| kcgc | `kubectl config get-contexts` | List of contexts available |
|
||||
| | | **General aliases** |
|
||||
| kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector |
|
||||
| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument |
|
||||
| kge | `kubectl get events --sort-by=".lastTimestamp"` | Get events (sorted by timestamp) |
|
||||
| kgew | `kubectl get events --watch --sort-by=".lastTimestamp"` | Get events and watch as they occur (sorted by timestamp) |
|
||||
| | | **Pod management** |
|
||||
| kgp | `kubectl get pods` | List all pods in ps output format |
|
||||
| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
|
||||
| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` |
|
||||
| kgpsl | `kubectl get pods --show-labels` | List all pods in ps output format with labels |
|
||||
| kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes |
|
||||
| kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included |
|
||||
| kep | `kubectl edit pods` | Edit pods from the default editor |
|
||||
| kdp | `kubectl describe pods` | Describe all pods |
|
||||
| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
|
||||
| | | **Service management** |
|
||||
| kgs | `kubectl get svc` | List all services in ps output format |
|
||||
| kgsw | `kgs --watch` | After listing all services, watch for changes |
|
||||
| kgswide | `kgs -o wide` | After listing all services, output in plain-text format with any additional information |
|
||||
| kes | `kubectl edit svc` | Edit services(svc) from the default editor |
|
||||
| kds | `kubectl describe svc` | Describe all services in detail |
|
||||
| kdels | `kubectl delete svc` | Delete all services matching passed argument |
|
||||
| | | **Ingress management** |
|
||||
| kgi | `kubectl get ingress` | List ingress resources in ps output format |
|
||||
| kei | `kubectl edit ingress` | Edit ingress resource from the default editor |
|
||||
| kdi | `kubectl describe ingress` | Describe ingress resource in detail |
|
||||
| kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument |
|
||||
| | | **Namespace management** |
|
||||
| kgns | `kubectl get namespaces` | List the current namespaces in a cluster |
|
||||
| kcn | `kubectl config set-context --current --namespace` | Change current namespace |
|
||||
| kens | `kubectl edit namespace` | Edit namespace resource from the default editor |
|
||||
| kdns | `kubectl describe namespace` | Describe namespace resource in detail |
|
||||
| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace |
|
||||
| | | **ConfigMap management** |
|
||||
| kgcm | `kubectl get configmaps` | List the configmaps in ps output format |
|
||||
| kecm | `kubectl edit configmap` | Edit configmap resource from the default editor |
|
||||
| kdcm | `kubectl describe configmap` | Describe configmap resource in detail |
|
||||
| kdelcm | `kubectl delete configmap` | Delete the configmap |
|
||||
| | | **Secret management** |
|
||||
| kgsec | `kubectl get secret` | Get secret for decoding |
|
||||
| kdsec | `kubectl describe secret` | Describe secret resource in detail |
|
||||
| kdelsec | `kubectl delete secret` | Delete the secret |
|
||||
| | | **Deployment management** |
|
||||
| kgd | `kubectl get deployment` | Get the deployment |
|
||||
| kgdw | `kgd --watch` | After getting the deployment, watch for changes |
|
||||
| kgdwide | `kgd -o wide` | After getting the deployment, output in plain-text format with any additional information |
|
||||
| ked | `kubectl edit deployment` | Edit deployment resource from the default editor |
|
||||
| kdd | `kubectl describe deployment` | Describe deployment resource in detail |
|
||||
| kdeld | `kubectl delete deployment` | Delete the deployment |
|
||||
| ksd | `kubectl scale deployment` | Scale a deployment |
|
||||
| krsd | `kubectl rollout status deployment` | Check the rollout status of a deployment |
|
||||
| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime |
|
||||
| | | **Rollout management** |
|
||||
| kgrs | `kubectl get replicaset` | List all ReplicaSets `rs` created by the deployment |
|
||||
| kdrs | `kubectl describe replicaset` | Describe ReplicaSet in detail |
|
||||
| kers | `kubectl edit replicaset` | Edit ReplicaSet from the default editor |
|
||||
| krh | `kubectl rollout history` | Check the revisions of this deployment |
|
||||
| kru | `kubectl rollout undo` | Rollback to the previous revision |
|
||||
| | | **Port forwarding** |
|
||||
| kpf | `kubectl port-forward` | Forward one or more local ports to a pod |
|
||||
| | | **Tools for accessing all information** |
|
||||
| kga | `kubectl get all` | List all resources in ps format |
|
||||
| kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces |
|
||||
| | | **Logs** |
|
||||
| kl | `kubectl logs` | Print the logs for a container or resource |
|
||||
| klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) |
|
||||
| | | **File copy** |
|
||||
| kcp | `kubectl cp` | Copy files and directories to and from containers |
|
||||
| | | **Node management** |
|
||||
| kgno | `kubectl get nodes` | List the nodes in ps output format |
|
||||
| kgnosl | `kubectl get nodes --show-labels` | List the nodes in ps output format with labels |
|
||||
| keno | `kubectl edit node` | Edit nodes resource from the default editor |
|
||||
| kdno | `kubectl describe node` | Describe node resource in detail |
|
||||
| kdelno | `kubectl delete node` | Delete the node |
|
||||
| | | **Persistent Volume Claim management** |
|
||||
| kgpvc | `kubectl get pvc` | List all PVCs |
|
||||
| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes |
|
||||
| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor |
|
||||
| kdpvc | `kubectl describe pvc` | Describe all pvcs |
|
||||
| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments |
|
||||
| | | **StatefulSets management** |
|
||||
| kgss | `kubectl get statefulset` | List the statefulsets in ps format |
|
||||
| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes |
|
||||
| kgsswide | `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information |
|
||||
| kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor |
|
||||
| kdss | `kubectl describe statefulset` | Describe statefulset resource in detail |
|
||||
| kdelss | `kubectl delete statefulset` | Delete the statefulset |
|
||||
| ksss | `kubectl scale statefulset` | Scale a statefulset |
|
||||
| krsss | `kubectl rollout status statefulset` | Check the rollout status of a deployment |
|
||||
| | | **Service Accounts management** |
|
||||
| kdsa | `kubectl describe sa` | Describe a service account in details |
|
||||
| kdelsa | `kubectl delete sa` | Delete the service account |
|
||||
| | | **DaemonSet management** |
|
||||
| kgds | `kubectl get daemonset` | List all DaemonSets in ps output format |
|
||||
| kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes |
|
||||
| keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor |
|
||||
| kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail |
|
||||
| kdelds | `kubectl delete daemonset` | Delete all DaemonSets matching passed argument |
|
||||
| | | **CronJob management** |
|
||||
| kgcj | `kubectl get cronjob` | List all CronJobs in ps output format |
|
||||
| kecj | `kubectl edit cronjob` | Edit CronJob from the default editor |
|
||||
| kdcj | `kubectl describe cronjob` | Describe a CronJob in details |
|
||||
| kdelcj | `kubectl delete cronjob` | Delete the CronJob |
|
||||
| | | **Job management** |
|
||||
| kgj | `kubectl get job` | List all Job in ps output format |
|
||||
| kej | `kubectl edit job` | Edit a Job in details |
|
||||
| kdj | `kubectl describe job` | Describe the Job |
|
||||
| kdelj | `kubectl delete job` | Delete the Job |
|
||||
|
||||
## Wrappers
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,14 @@ alias kcgc='kubectl config get-contexts'
|
|||
# General aliases
|
||||
alias kdel='kubectl delete'
|
||||
alias kdelf='kubectl delete -f'
|
||||
alias kge='kubectl get events --sort-by=".lastTimestamp"'
|
||||
alias kgew='kubectl get events --sort-by=".lastTimestamp" --watch'
|
||||
|
||||
# Pod management.
|
||||
alias kgp='kubectl get pods'
|
||||
alias kgpl='kgp -l'
|
||||
alias kgpn='kgp -n'
|
||||
alias kgpsl='kubectl get pods --show-labels'
|
||||
alias kgpa='kubectl get pods --all-namespaces'
|
||||
alias kgpw='kgp --watch'
|
||||
alias kgpwide='kgp -o wide'
|
||||
|
|
@ -48,12 +53,6 @@ alias kdelp='kubectl delete pods'
|
|||
alias kgpall='kubectl get pods --all-namespaces -o wide'
|
||||
alias kclearevicted="kubectl get pods --all-namespaces -o json | jq '.items[] | select(.status.reason!=null) | select(.status.reason | contains(\"Evicted\")) | \"kubectl delete pods \(.metadata.name) -n \(.metadata.namespace)\"' | xargs -n 1 bash -c"
|
||||
|
||||
# get pod by label: kgpl "app=myapp" -n myns
|
||||
alias kgpl='kgp -l'
|
||||
|
||||
# get pod by namespace: kgpn kube-system"
|
||||
alias kgpn='kgp -n'
|
||||
|
||||
# Service management.
|
||||
alias kgs='kubectl get svc'
|
||||
alias kgsa='kubectl get svc --all-namespaces'
|
||||
|
|
@ -145,6 +144,7 @@ alias kcp='kubectl cp'
|
|||
|
||||
# Node Management
|
||||
alias kgno='kubectl get nodes'
|
||||
alias kgnosl='kubectl get nodes --show-labels'
|
||||
alias keno='kubectl edit node'
|
||||
alias kdno='kubectl describe node'
|
||||
alias kdelno='kubectl delete node'
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ plugins=(... laravel)
|
|||
| `pamfs` | `php artisan migrate:fresh --seed` |
|
||||
| `pamr` | `php artisan migrate:rollback` |
|
||||
| `pads` | `php artisan db:seed` |
|
||||
| `padw` | `php artisan db:wipe` |
|
||||
|
||||
## Makers
|
||||
|
||||
|
|
@ -49,6 +50,7 @@ plugins=(... laravel)
|
|||
| `pacoc` | `php artisan config:clear` |
|
||||
| `pavic` | `php artisan view:clear` |
|
||||
| `paroc` | `php artisan route:clear` |
|
||||
| `paopc` | `php artisan optimize:clear` |
|
||||
|
||||
## Queues
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ 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'
|
||||
|
||||
# Makers
|
||||
alias pamm='php artisan make:model'
|
||||
|
|
@ -36,6 +37,7 @@ 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'
|
||||
|
||||
# queues
|
||||
alias paqf='php artisan queue:failed'
|
||||
|
|
|
|||
|
|
@ -9,20 +9,23 @@ chpwd_last_working_dir() {
|
|||
[[ "$ZSH_SUBSHELL" -eq 0 ]] || return 0
|
||||
# Add ".$SSH_USER" suffix to cache file if $SSH_USER is set and non-empty
|
||||
local cache_file="$ZSH_CACHE_DIR/last-working-dir${SSH_USER:+.$SSH_USER}"
|
||||
builtin pwd >| "$cache_file"
|
||||
'builtin' 'echo' '-E' "$PWD" >| "$cache_file"
|
||||
}
|
||||
|
||||
# Changes directory to the last working directory
|
||||
lwd() {
|
||||
# Add ".$SSH_USER" suffix to cache file if $SSH_USER is set and non-empty
|
||||
local cache_file="$ZSH_CACHE_DIR/last-working-dir${SSH_USER:+.$SSH_USER}"
|
||||
[[ -r "$cache_file" ]] && cd "$(cat "$cache_file")"
|
||||
[[ -r "$cache_file" ]] && cd "$(<"$cache_file")"
|
||||
}
|
||||
|
||||
# Jump to last directory automatically unless:
|
||||
# - this isn't the first time the plugin is loaded
|
||||
# - it's not in $HOME directory
|
||||
[[ -n "$ZSH_LAST_WORKING_DIRECTORY" ]] && return
|
||||
[[ "$PWD" != "$HOME" ]] && return
|
||||
#
|
||||
# - This isn't the first time the plugin is loaded
|
||||
# - We're not in the $HOME directory (e.g. if terminal opened a different folder)
|
||||
[[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]] || return
|
||||
[[ "$PWD" == "$HOME" ]] || return
|
||||
|
||||
lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
|
||||
if lwd 2>/dev/null; then
|
||||
ZSH_LAST_WORKING_DIRECTORY=1
|
||||
fi
|
||||
|
|
|
|||
24
plugins/localstack/README.md
Normal file
24
plugins/localstack/README.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Localstack plugin #
|
||||
|
||||
CLI support for LOCALSTACK interaction
|
||||
|
||||
## Description ##
|
||||
To use it, add `localstack` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... localstack)
|
||||
```
|
||||
|
||||
## Usage ##
|
||||
|
||||
This plugin supplies one command, `lsk`, through which all its features are exposed.
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
| :------------ | :-------------------------------------------------------------------- |
|
||||
| `lsk sqs-send <queue> <message.json>` | sends a given message in sqs to a given queue |
|
||||
|
||||
## Examples
|
||||
|
||||

|
||||
37
plugins/localstack/localstack.plugin.zsh
Normal file
37
plugins/localstack/localstack.plugin.zsh
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# CLI support for LOCALSTACK interaction
|
||||
#
|
||||
# See README.md for details
|
||||
lsk() {
|
||||
case $1 in
|
||||
sqs-send)
|
||||
shift
|
||||
sqs-send "$@"
|
||||
;;
|
||||
*)
|
||||
echo "Command not found: $1"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Send SQS function
|
||||
#
|
||||
# This function sends a given message in sqs to a given queue, when used Localstack
|
||||
#
|
||||
# Use:
|
||||
# sqs-send <queue> <message>
|
||||
#
|
||||
# Parameters
|
||||
# <queue> A given queue
|
||||
# <message> A content of message em json archive
|
||||
#
|
||||
# Example
|
||||
# sqs-send user user.json
|
||||
sqs-send(){
|
||||
if [ -z "$1" ]; then
|
||||
echo "Use: sqs-send <queue> <payload>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
curl -X POST "http://localhost:4566/000000000000/$1" -d "Action=SendMessage" -d "MessageBody=$(cat $2)"
|
||||
}
|
||||
BIN
plugins/localstack/sqs-send-result.png
Normal file
BIN
plugins/localstack/sqs-send-result.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
|
|
@ -78,7 +78,7 @@ _lpass() {
|
|||
has_sync=1
|
||||
;;
|
||||
status)
|
||||
_arguments : '(-q --quiet)'{-q,--quiet}'[Supress output to stdout]'
|
||||
_arguments : '(-q --quiet)'{-q,--quiet}'[Suppress output to stdout]'
|
||||
has_color=1
|
||||
;;
|
||||
sync)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ plugins=(... macos)
|
|||
- [iTerm2](https://iterm2.com/)
|
||||
- [Hyper](https://hyper.is/)
|
||||
- [Tabby](https://tabby.sh/)
|
||||
- [Ghostty](https://ghostty.org)
|
||||
|
||||
## Commands
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,12 @@ EOF
|
|||
tell application "System Events"
|
||||
tell process "Tabby" to keystroke "t" using command down
|
||||
end tell
|
||||
EOF
|
||||
elif [[ "$the_app" == 'ghostty' ]]; then
|
||||
osascript >/dev/null <<EOF
|
||||
tell application "System Events"
|
||||
tell process "Ghostty" to keystroke "t" using command down
|
||||
end tell
|
||||
EOF
|
||||
else
|
||||
echo "$0: unsupported terminal app: $the_app" >&2
|
||||
|
|
@ -139,6 +145,12 @@ EOF
|
|||
tell application "System Events"
|
||||
tell process "Tabby" to keystroke "D" using command down
|
||||
end tell
|
||||
EOF
|
||||
elif [[ "$the_app" == 'ghostty' ]]; then
|
||||
osascript >/dev/null <<EOF
|
||||
tell application "System Events"
|
||||
tell process "Ghostty" to keystroke "D" using command down
|
||||
end tell
|
||||
EOF
|
||||
else
|
||||
echo "$0: unsupported terminal app: $the_app" >&2
|
||||
|
|
@ -194,6 +206,12 @@ EOF
|
|||
tell application "System Events"
|
||||
tell process "Tabby" to keystroke "d" using command down
|
||||
end tell
|
||||
EOF
|
||||
elif [[ "$the_app" == 'ghostty' ]]; then
|
||||
osascript >/dev/null <<EOF
|
||||
tell application "System Events"
|
||||
tell process "Ghostty" to keystroke "d" using command down
|
||||
end tell
|
||||
EOF
|
||||
else
|
||||
echo "$0: unsupported terminal app: $the_app" >&2
|
||||
|
|
@ -253,7 +271,7 @@ function man-preview() {
|
|||
[[ $# -eq 0 ]] && >&2 echo "Usage: $0 command1 [command2 ...]" && return 1
|
||||
|
||||
local page
|
||||
for page in "${(@f)"$(man -w $@)"}"; do
|
||||
for page in "${(@f)"$(command man -w $@)"}"; do
|
||||
command mandoc -Tpdf $page | open -f -a Preview
|
||||
done
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ plugins=(... macports)
|
|||
| pc | `sudo port clean --all installed` | Clean up intermediate installation files for installed ports |
|
||||
| pi | `sudo port install` | Install package given as argument |
|
||||
| pli | `port livecheck installed` | Check for updates for installed ports |
|
||||
| plm | `port-livecheck-maintainer` | Check for updates of ports mainained by the specified users |
|
||||
| plm | `port-livecheck-maintainer` | Check for updates of ports maintained by the specified users |
|
||||
| psu | `sudo port selfupdate` | Update ports tree with MacPorts repository |
|
||||
| puni | `sudo port uninstall inactive` | Uninstall inactive ports |
|
||||
| puo | `sudo port upgrade outdated` | Upgrade ports with newer versions available |
|
||||
|
|
|
|||
|
|
@ -17,3 +17,4 @@ plugins=(... mix)
|
|||
| Ecto | [Ecto](https://hexdocs.pm/ecto/Ecto.html) |
|
||||
| Hex | [Hex](https://hex.pm/) |
|
||||
| Nerves | [Nerves](https://nerves-project.org/) |
|
||||
| mix_test_watch | [mix_test_watch](https://hex.pm/packages/mix_test_watch) |
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ _1st_arguments=(
|
|||
'release.init:Generates sample files for releases'
|
||||
'run:Run the given file or expression'
|
||||
"test:Run a project's tests"
|
||||
"test.watch:Run a project's tests continuously using hex package mix_test_watch"
|
||||
'test.coverage:Build report from exported test coverage'
|
||||
'xref:Prints cross reference information'
|
||||
'--help:Describe available tasks'
|
||||
|
|
@ -120,7 +121,7 @@ __task_list ()
|
|||
local expl
|
||||
declare -a tasks
|
||||
|
||||
tasks=(app.config app.start app.tree archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.tree deps.unlock deps.update do ecto.create ecto.drop ecto.dump ecto.gen.migration ecto.gen.repo ecto.load ecto.migrate ecto.migrations ecto.rollback escript escript.build escript.install escript.uninstall firmware firmware.burn firmware.image format help hex hex.audit hex.build hex.config hex.docs hex.info hex.organization hex.key hex.outdated hex.owner hex.package hex.publish hex.registry hex.repo hex.retire hex.search hex.sponsor hex.user loadconfig local local.hex local.phoenix local.phx local.public_keys local.rebar nerves.artifact nerves.artifact.get nerves.info nerves.new nerves.release.init new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.auth phx.gen.cert phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.live phx.gen.notifier phx.gen.presence phx.gen.schema phx.gen.secret phx.gen.socket phx.new phx.new.ecto phx.new.web phx.routes phx.server profile.cprof profile.eprof profile.fprof release release.init run test test.coverage xref)
|
||||
tasks=(app.config app.start app.tree archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.tree deps.unlock deps.update do ecto.create ecto.drop ecto.dump ecto.gen.migration ecto.gen.repo ecto.load ecto.migrate ecto.migrations ecto.rollback escript escript.build escript.install escript.uninstall firmware firmware.burn firmware.image format help hex hex.audit hex.build hex.config hex.docs hex.info hex.organization hex.key hex.outdated hex.owner hex.package hex.publish hex.registry hex.repo hex.retire hex.search hex.sponsor hex.user loadconfig local local.hex local.phoenix local.phx local.public_keys local.rebar nerves.artifact nerves.artifact.get nerves.info nerves.new nerves.release.init new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.auth phx.gen.cert phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.live phx.gen.notifier phx.gen.presence phx.gen.schema phx.gen.secret phx.gen.socket phx.new phx.new.ecto phx.new.web phx.routes phx.server profile.cprof profile.eprof profile.fprof release release.init run test test.watch test.coverage xref)
|
||||
|
||||
_wanted tasks expl 'help' compadd $tasks
|
||||
}
|
||||
|
|
@ -145,9 +146,22 @@ case $state in
|
|||
(help)
|
||||
_arguments ':feature:__task_list'
|
||||
;;
|
||||
(format)
|
||||
_arguments -C \
|
||||
'--check-formatted' \
|
||||
'--dot-formatter' \
|
||||
'--dry-run' \
|
||||
'--force' \
|
||||
'--migrate' \
|
||||
'--no-exit' \
|
||||
'*::file:_files'
|
||||
;;
|
||||
(test)
|
||||
_files
|
||||
;;
|
||||
(test.watch)
|
||||
_files
|
||||
;;
|
||||
(run)
|
||||
_files
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ if it's found, or the mvn command otherwise.
|
|||
| `mvnct` | `mvn clean test` |
|
||||
| `mvncv` | `mvn clean verify` |
|
||||
| `mvncvst` | `mvn clean verify -DskipTests` |
|
||||
| `mvnv` | `mvn verify` |
|
||||
| `mvnvst` | `mvn verify -DskipTests` |
|
||||
| `mvndp` | `mvn deploy` |
|
||||
| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` |
|
||||
| `mvndt` | `mvn dependency:tree` |
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ alias mvncp='mvn clean package'
|
|||
alias mvnct='mvn clean test'
|
||||
alias mvncv='mvn clean verify'
|
||||
alias mvncvst='mvn clean verify -DskipTests'
|
||||
alias mvnv='mvn verify'
|
||||
alias mvnvst='mvn verify -DskipTests'
|
||||
alias mvndp='mvn deploy'
|
||||
alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc'
|
||||
alias mvndt='mvn dependency:tree'
|
||||
|
|
@ -101,8 +103,14 @@ function listMavenCompletions {
|
|||
new_file="../pom.xml"
|
||||
fi
|
||||
|
||||
# if file doesn't exist break
|
||||
file="${file:h}/${new_file}"
|
||||
|
||||
# if the file points to a directory, assume it is a pom.xml in that directory
|
||||
if [[ -d "$file" ]]; then
|
||||
file="${file}/pom.xml"
|
||||
fi
|
||||
|
||||
# if file doesn't exist break
|
||||
if ! [[ -e "$file" ]]; then
|
||||
break
|
||||
fi
|
||||
|
|
|
|||
20
plugins/ngrok/README.md
Normal file
20
plugins/ngrok/README.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# ngrok plugin
|
||||
|
||||
This plugin adds completion for the [ngrok](https://ngrok.com) CLI.
|
||||
|
||||
To use it, add `ngrok` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... ngrok)
|
||||
```
|
||||
|
||||
This plugin does not add any aliases.
|
||||
|
||||
## Cache
|
||||
|
||||
This plugin caches the completion script and is automatically updated asynchronously when the plugin is
|
||||
loaded, which is usually when you start up a new terminal emulator.
|
||||
|
||||
The cache is stored at:
|
||||
|
||||
- `$ZSH_CACHE/completions/_ngrok` completions script
|
||||
14
plugins/ngrok/ngrok.plugin.zsh
Normal file
14
plugins/ngrok/ngrok.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Autocompletion for ngrok
|
||||
if (( ! $+commands[ngrok] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `ngrok`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_ngrok" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _ngrok
|
||||
_comps[ngrok]=_ngrok
|
||||
fi
|
||||
|
||||
ngrok completion zsh >| "$ZSH_CACHE_DIR/completions/_ngrok" &|
|
||||
|
|
@ -26,9 +26,10 @@ These settings should go in your zshrc file, before Oh My Zsh is sourced:
|
|||
#### Lazy startup
|
||||
|
||||
This option will help you to defer nvm's load until you use it to speed-up your zsh startup. This will source
|
||||
nvm script only when using it, and will create a function for `node`, `npm`, `npx`, `pnpm`, `yarn`, `corepack`
|
||||
and the command(s) specified by `lazy-cmd` option, so when you call either of them, nvm will be loaded and run
|
||||
with default version. To enable it, you can add this snippet to your zshrc, before Oh My Zsh is sourced:
|
||||
nvm script only when using it, and will create a function for `node`, `npm`, `npx`, `pnpm`, `pnpx`, `yarn`,
|
||||
`corepack` and the command(s) specified by `lazy-cmd` option, so when you call either of them, nvm will be
|
||||
loaded and run with default version. To enable it, you can add this snippet to your zshrc, before Oh My Zsh is
|
||||
sourced:
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:nvm' lazy yes
|
||||
|
|
@ -41,6 +42,8 @@ as you want:
|
|||
zstyle ':omz:plugins:nvm' lazy-cmd eslint prettier typescript ...
|
||||
```
|
||||
|
||||
There will be a function `_omz_nvm_load` available to load `nvm` without executing any other trigger command.
|
||||
|
||||
#### `.nvmrc` autoload
|
||||
|
||||
Note: _if used at the same time as `lazy`, `autoload` will start working only after nvm has been lazy-loaded_
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if [[ -z "$NVM_DIR" ]] || [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
|
|||
return
|
||||
fi
|
||||
|
||||
function _omz_load_nvm_completion {
|
||||
function _omz_nvm_setup_completion {
|
||||
local _nvm_completion
|
||||
# Load nvm bash completion
|
||||
for _nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do
|
||||
|
|
@ -33,12 +33,12 @@ function _omz_load_nvm_completion {
|
|||
break
|
||||
fi
|
||||
done
|
||||
unfunction _omz_load_nvm_completion
|
||||
unfunction _omz_nvm_setup_completion
|
||||
}
|
||||
|
||||
function _omz_setup_autoload {
|
||||
function _omz_nvm_setup_autoload {
|
||||
if ! zstyle -t ':omz:plugins:nvm' autoload; then
|
||||
unfunction _omz_setup_autoload
|
||||
unfunction _omz_nvm_setup_autoload
|
||||
return
|
||||
fi
|
||||
|
||||
|
|
@ -68,13 +68,13 @@ function _omz_setup_autoload {
|
|||
add-zsh-hook chpwd load-nvmrc
|
||||
|
||||
load-nvmrc
|
||||
unfunction _omz_setup_autoload
|
||||
unfunction _omz_nvm_setup_autoload
|
||||
}
|
||||
|
||||
if zstyle -t ':omz:plugins:nvm' lazy; then
|
||||
# Call nvm when first using nvm, node, npm, pnpm, yarn, corepack or other commands in lazy-cmd
|
||||
zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
|
||||
nvm_lazy_cmd=(nvm node npm npx pnpm yarn corepack $nvm_lazy_cmd) # default values
|
||||
nvm_lazy_cmd=(_omz_nvm_load nvm node npm npx pnpm pnpx yarn corepack $nvm_lazy_cmd) # default values
|
||||
eval "
|
||||
function $nvm_lazy_cmd {
|
||||
for func in $nvm_lazy_cmd; do
|
||||
|
|
@ -84,14 +84,16 @@ if zstyle -t ':omz:plugins:nvm' lazy; then
|
|||
done
|
||||
# Load nvm if it exists in \$NVM_DIR
|
||||
[[ -f \"\$NVM_DIR/nvm.sh\" ]] && source \"\$NVM_DIR/nvm.sh\"
|
||||
_omz_load_nvm_completion
|
||||
_omz_setup_autoload
|
||||
\"\$0\" \"\$@\"
|
||||
_omz_nvm_setup_completion
|
||||
_omz_nvm_setup_autoload
|
||||
if [[ \"\$0\" != _omz_nvm_load ]]; then
|
||||
\"\$0\" \"\$@\"
|
||||
fi
|
||||
}
|
||||
"
|
||||
unset nvm_lazy_cmd
|
||||
else
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
_omz_load_nvm_completion
|
||||
_omz_setup_autoload
|
||||
_omz_nvm_setup_completion
|
||||
_omz_nvm_setup_autoload
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -15,29 +15,32 @@ plugins=(... opentofu)
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command |
|
||||
| ----- | --------------- |
|
||||
| `tt` | `tofu` |
|
||||
| `tta` | `tofu apply` |
|
||||
| `ttc` | `tofu console` |
|
||||
| `ttd` | `tofu destroy` |
|
||||
| `ttf` | `tofu fmt` |
|
||||
| `tti` | `tofu init` |
|
||||
| `tto` | `tofu output` |
|
||||
| `ttp` | `tofu plan` |
|
||||
| `ttv` | `tofu validate` |
|
||||
| `tts` | `tofu state` |
|
||||
| `ttsh`| `tofu show` |
|
||||
| `ttr` | `tofu refresh` |
|
||||
| `ttt` | `tofu test` |
|
||||
| `ttws`| `tofu workspace`|
|
||||
| Alias | Command |
|
||||
|--------|------------------------------|
|
||||
| `tt` | `tofu` |
|
||||
| `tta` | `tofu apply` |
|
||||
| `ttaa` | `tofu apply -auto-approve` |
|
||||
| `ttc` | `tofu console` |
|
||||
| `ttd` | `tofu destroy` |
|
||||
| `ttd!` | `tofu destroy -auto-approve` |
|
||||
| `ttf` | `tofu fmt` |
|
||||
| `ttfr` | `tofu fmt -recursive` |
|
||||
| `tti` | `tofu init` |
|
||||
| `tto` | `tofu output` |
|
||||
| `ttp` | `tofu plan` |
|
||||
| `ttv` | `tofu validate` |
|
||||
| `tts` | `tofu state` |
|
||||
| `ttsh` | `tofu show` |
|
||||
| `ttr` | `tofu refresh` |
|
||||
| `ttt` | `tofu test` |
|
||||
| `ttws` | `tofu workspace` |
|
||||
|
||||
|
||||
## Prompt functions
|
||||
|
||||
- `tofu_prompt_info`: shows the current workspace when in an OpenTofu project directory.
|
||||
|
||||
- `tofu_version_prompt_info`: shows the current version of the `tofu` commmand.
|
||||
- `tofu_version_prompt_info`: shows the current version of the `tofu` command.
|
||||
|
||||
To use them, add them to a `PROMPT` variable in your theme or `.zshrc` file:
|
||||
|
||||
|
|
|
|||
|
|
@ -29,9 +29,12 @@ function tofu_version_prompt_info() {
|
|||
|
||||
alias tt='tofu'
|
||||
alias tta='tofu apply'
|
||||
alias ttaa='tofu apply -auto-approve'
|
||||
alias ttc='tofu console'
|
||||
alias ttd='tofu destroy'
|
||||
alias ttd!='tofu destroy -auto-approve'
|
||||
alias ttf='tofu fmt'
|
||||
alias ttfr='tofu fmt -recursive'
|
||||
alias tti='tofu init'
|
||||
alias tto='tofu output'
|
||||
alias ttp='tofu plan'
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable.
|
|||
function above (default `^G`)
|
||||
* `PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE` is a variable which toggles whether
|
||||
the current mode is printed to the screen following a mode change (default `true`)
|
||||
* `HISTORY_START_WITH_GLOBAL` is a global variable that defines how to start the plugin: global or local (default `false`)
|
||||
|
||||
## History
|
||||
|
||||
|
|
|
|||
|
|
@ -8,30 +8,36 @@ To use it, add `perl` to the plugins array in your zshrc file:
|
|||
plugins=(... perl)
|
||||
```
|
||||
|
||||
## Perlbrew activation
|
||||
|
||||
If the plugin detects that `perlbrew` hasn't been activated, yet there is an installation of it in
|
||||
`$PERLBREW_ROOT`, it'll initialize by default. To avoid this behaviour, set `ZSH_PERLBREW_ACTIVATE=false`
|
||||
before `source oh-my-zsh.sh` in your zshrc.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Aliases | Command | Description |
|
||||
| :------------ | :----------------- | :------------------------------------- |
|
||||
| pbi | `perlbrew install` | Install specific perl version |
|
||||
| pbl | `perlbrew list` | List all perl version installed |
|
||||
| pbo | `perlbrew off` | Go back to the system perl |
|
||||
| pbs | `perlbrew switch` | Turn it back on |
|
||||
| pbu | `perlbrew use` | Use specific version of perl |
|
||||
| pd | `perldoc` | Show the perl documentation |
|
||||
| ple | `perl -wlne` | Use perl like awk/sed |
|
||||
| latest-perl | `curl ...` | Show the latest stable release of Perl |
|
||||
| Aliases | Command | Description |
|
||||
| :---------- | :----------------- | :------------------------------------- |
|
||||
| pbi | `perlbrew install` | Install specific perl version |
|
||||
| pbl | `perlbrew list` | List all perl version installed |
|
||||
| pbo | `perlbrew off` | Go back to the system perl |
|
||||
| pbs | `perlbrew switch` | Turn it back on |
|
||||
| pbu | `perlbrew use` | Use specific version of perl |
|
||||
| pd | `perldoc` | Show the perl documentation |
|
||||
| ple | `perl -wlne` | Use perl like awk/sed |
|
||||
| latest-perl | `curl ...` | Show the latest stable release of Perl |
|
||||
|
||||
## Functions
|
||||
|
||||
* `newpl`: creates a basic Perl script file and opens it with $EDITOR.
|
||||
- `newpl`: creates a basic Perl script file and opens it with $EDITOR.
|
||||
|
||||
* `pgs`: Perl Global Substitution: `pgs <find_pattern> <replace_pattern> <filename>`
|
||||
Looks for `<find_pattern>` and replaces it with `<replace_pattern>` in `<filename>`.
|
||||
- `pgs`: Perl Global Substitution: `pgs <find_pattern> <replace_pattern> <filename>` Looks for
|
||||
`<find_pattern>` and replaces it with `<replace_pattern>` in `<filename>`.
|
||||
|
||||
* `prep`: Perl grep, because 'grep -P' is terrible: `prep <pattern> [<filename>]`
|
||||
Lets you work with pipes or files (if no `<filename>` provided, use stdin).
|
||||
- `prep`: Perl grep, because 'grep -P' is terrible: `prep <pattern> [<filename>]` Lets you work with pipes or
|
||||
files (if no `<filename>` provided, use stdin).
|
||||
|
||||
## Requirements
|
||||
|
||||
In order to make this work, you will need to have perl installed.
|
||||
More info on the usage and install: https://www.perl.org/get.html
|
||||
In order to make this work, you will need to have perl installed. More info on the usage and install:
|
||||
https://www.perl.org/get.html
|
||||
|
|
|
|||
|
|
@ -54,3 +54,12 @@ pgs() { # [find] [replace] [filename]
|
|||
prep() { # [pattern] [filename unless STDOUT]
|
||||
perl -nle 'print if /'"$1"'/;' $2
|
||||
}
|
||||
|
||||
# If the 'perlbrew' function isn't defined, perlbrew isn't setup.
|
||||
if [[ $ZSH_PERLBREW_ACTIVATE != false ]] && (( ! $+functions[perlbrew] )); then
|
||||
local _perlbrew="${PERLBREW_ROOT:-${HOME}/perl5/perlbrew}"
|
||||
if [[ -f "${_perlbrew}/etc/bashrc" ]]; then
|
||||
source "${_perlbrew}/etc/bashrc"
|
||||
fi
|
||||
unset _perlbrew
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -20,17 +20,17 @@ the next time you autocomplete `pip install`.
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Description |
|
||||
| :------- | :-------------------------------------------- |
|
||||
| pipi | Install packages |
|
||||
| pipig | Install package from GitHub repository |
|
||||
| pipigb | Install package from GitHub branch |
|
||||
| pipigp | Install package from GitHub pull request |
|
||||
| pipu | Upgrade packages |
|
||||
| pipun | Uninstall packages |
|
||||
| pipgi | Grep through installed packages |
|
||||
| piplo | List outdated packages |
|
||||
| pipreq | Create requirements file |
|
||||
| pipir | Install packages from `requirements.txt` file |
|
||||
| pipupall | Update all installed packages |
|
||||
| pipunall | Uninstall all installed packages |
|
||||
| Alias | Command | Description |
|
||||
| :--------|:----------------------------------------------------------------------------------|:--------------------------------------------- |
|
||||
| pipi | `pip install` | Install packages |
|
||||
| pipig | `pip install "git+https://github.com/user/repo.git"` | Install package from GitHub repository |
|
||||
| pipigb | `pip install "git+https://github.com/user/repo.git@branch"` | Install package from GitHub branch |
|
||||
| pipigp | `pip install "git+https://github.com/user/repo.git@refs/pull/PR_NUMBER/head"` | Install package from GitHub pull request |
|
||||
| pipu | `pip install --upgrade` | Upgrade packages |
|
||||
| pipun | `pip uninstall` | Uninstall packages |
|
||||
| pipgi | `pip freeze \| grep` | Grep through installed packages |
|
||||
| piplo | `pip list --outdated` | List outdated packages |
|
||||
| pipreq | `pip freeze > requirements.txt` | Create requirements file |
|
||||
| pipir | `pip install -r requirements.txt` | Install packages from `requirements.txt` file |
|
||||
| pipupall | `pip list --outdated \| awk 'NR > 2 { print $1 }' \| xargs pip install --upgrade` | Update all installed packages |
|
||||
| pipunall | `pip list --format freeze \| cut -d= -f1 \| xargs pip uninstall` | Uninstall all installed packages |
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
|
|||
if [[ ! -f "$PWD/Pipfile" ]]; then
|
||||
if [[ "$PIPENV_ACTIVE" == 1 ]]; then
|
||||
if [[ "$PWD" != "$pipfile_dir"* ]]; then
|
||||
exit
|
||||
unset PIPENV_ACTIVE pipfile_dir
|
||||
deactivate
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
@ -28,7 +29,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
|
|||
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
|
||||
if [[ -f "$PWD/Pipfile" ]]; then
|
||||
export pipfile_dir="$PWD"
|
||||
pipenv shell
|
||||
source "$(pipenv --venv)/bin/activate"
|
||||
export PIPENV_ACTIVE=1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
398
plugins/pm2/_pm2
398
plugins/pm2/_pm2
|
|
@ -1,16 +1,233 @@
|
|||
#!/bin/zsh -f
|
||||
#compdef pm2
|
||||
#autoload
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for pm2 5.2.2 (https://pm2.keymetrics.io/).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Myoungdo Park <mdo.park@gmail.com>
|
||||
# * Shohei Yoshida <https://github.com/syohex>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
local -a _1st_arguments
|
||||
_pm2() {
|
||||
typeset -A opt_args
|
||||
local context state line
|
||||
|
||||
_1st_arguments=(
|
||||
local curcontext="$curcontext"
|
||||
|
||||
local ret=1
|
||||
|
||||
_arguments -C \
|
||||
'(- *)'{-v,-V,--version}'[print pm2 version]' \
|
||||
'(-s --silent)'{-s,--silent}'[hide all messages]' \
|
||||
'--ext[watch only this file extension]:extension' \
|
||||
'(-n --name)'{-n,--name}'[set a name for the process in the process list]:name' \
|
||||
'(-m --mini-list)'{-m,--mini-list}'[display a compacted list without formatting]' \
|
||||
'--interpreter[set a specific interpreter to use for executing app(default: node)]:prog' \
|
||||
'(--interpreter-args --node-args)'{--interpreter-args,--node-args}'[set arguments to pass to the interpreter]:args' \
|
||||
'(-o --output)'{-o,--output}'[specify log file for stdout]: :_files' \
|
||||
'(-e --error)'{-e,--error}'[specify log file for stderr]: :_files' \
|
||||
'(-l --log)'{-l,--log}'[specify log file which gathers both stdout and stderr]' \
|
||||
'--filter-env[filter out outgoing global values that contain provided strings]:envs' \
|
||||
'--log-type[specify log output style]: :(raw json)' \
|
||||
'--log-date-format[specify log output style]:format' \
|
||||
'--time[enable time logging]' \
|
||||
'--disable-logs[disable all logs storage]' \
|
||||
'*--env[specify which set of environment variables from ecosystem file must be injected]:env' \
|
||||
'(-a --update-env)'{-a,--update-env}'[force and update of the environment with restart/reload]' \
|
||||
'(-f --force)'{-f,--force}'[force actions]' \
|
||||
'(-i --instances)'{-i,--instances}'[launch number instances]:num' \
|
||||
'--parallel[number of parallel actions]:num' \
|
||||
'--shutdown-with-message[shutdown an application with process.send("shutdown") instead of process.kill(pid, SIGINT)]' \
|
||||
'(-p --pid)'{-p,--pid}'[specify pid file]: :_files' \
|
||||
'(-k --kill-timeout)'{-k,--kill-timeout}'[delay before sending final SIGKILL signal to process]:delay' \
|
||||
'--listen-timeout[listen timeout an application reload]:delay' \
|
||||
'--max-memory-restart[restart the app if an amount of memory is exceeded (in bytes)]:bytes' \
|
||||
'--restart-delay[specify a delay between restarts(in milliseconds)]:delay' \
|
||||
'--exp-backoff-restart-delay[specify a delay between restarts(in milliseconds)]:delay' \
|
||||
'(-x --execute-command)'{-e,--execute-command}'[execute a program using fork system]' \
|
||||
'--max-restarts[only start the script COUNT times]:count' \
|
||||
'(-u --user)'{-u,--user}'[define user when generating startup script]:username' \
|
||||
'--uid[run target script with <uid> rights]:uid' \
|
||||
'--gid[run target script with <gid> rights]:gui' \
|
||||
'--namespace[start application within specified namespace]:namespace' \
|
||||
'--cwd[run target script from path <cwd>]:cwd:_paths -/' \
|
||||
'--hp[define home path when generating startup script]: :_paths -/' \
|
||||
'--wait-ip[override systemd script to wait for full internet connectivity to launch pm2]' \
|
||||
'--service-name[define service name when generating startup script]' \
|
||||
'(-c --cron --cron-restart)'{-c,--cron,--cron-restart}'[restart a running process based on a cron pattern]:pattern' \
|
||||
'(-w --write)'{-w,--write}'[write configuration in local folder]' \
|
||||
'--no-daemon[run pm2 daemon in the foreground if it does not exist already]' \
|
||||
'(--disable-source-map-support --source-map-support)--source-map-support[force source map support]' \
|
||||
'--only[with json declaration, allow to only act on one application]:app' \
|
||||
'(--disable-source-map-support --source-map-support)--disable-source-map-support[force disable source map support]' \
|
||||
'--wait-ready[ask pm2 to wait for ready event from your app]' \
|
||||
'--merge-logs[merge logs from different instances but keep error and out separated]' \
|
||||
'*--watch[watch application folder for changes]: :_files -/' \
|
||||
'*--ignore-watch[list of paths to ignore]: :_files' \
|
||||
'--no-color[skip colors]' \
|
||||
'--no-vizion[start an app without vizion feature]' \
|
||||
'--np-autorestart[start an app without automatic restart]' \
|
||||
'--no-treekill[Only kill the main process, not detached children]' \
|
||||
'--no-pmx[start an app without pmx]' \
|
||||
'--no-automation[start an app without automation]' \
|
||||
'(--disable-trace --trace)--trace[enable transaction tracing with km]' \
|
||||
'(--disable-trace --trace)--disable-trace[disable transaction tracing with km]' \
|
||||
"--sort[sort process according to field's]:field_name" \
|
||||
'--attach[attach logging after your start/restart/stop/reload]' \
|
||||
'--v8[enable v8 data collecting]' \
|
||||
'--event-loop-inspector[enable event-loop-inspector dump in pmx]' \
|
||||
'--deep-monitoring[enable all monitoring tools]' \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'1: :_pm2_subcommands' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
case "$state" in
|
||||
(subcmds)
|
||||
case $words[1] in
|
||||
(start)
|
||||
_arguments \
|
||||
'--watch[watch folder for changes]' \
|
||||
'--fresh[Rebuild Dockerfile]' \
|
||||
'--daemon[Run container in Daemon mode(debug purposes)]' \
|
||||
'--container[Start application in container mode]' \
|
||||
'--dist[--with-container; change local Dockerfile to containerize all files in current directory]' \
|
||||
'--image-name[with --dist; set the exported image name]:name' \
|
||||
'--node-version[with --container, set a specific major Node.js version]:version' \
|
||||
'--dockerdaemon[for debugging purpose]' \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'*: :_pm2_id_namespace_file' \
|
||||
&& ret=0
|
||||
;;
|
||||
(trigger)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'1: :_pm2_id_names' \
|
||||
&& ret=0
|
||||
;;
|
||||
(deploy|startOrRestart|startOrReload|startOrGracefulReload)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'1: :_files -g "*.json"' \
|
||||
&& ret=0
|
||||
;;
|
||||
(stop|restart)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'--watch[Stop watching folder for changes]' \
|
||||
'*: :_pm2_id_namespace_all' \
|
||||
&& ret=0
|
||||
;;
|
||||
(reload|delete|reset)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'*: :_pm2_id_namespace_all' \
|
||||
&& ret=0
|
||||
;;
|
||||
(module:install)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'--tarball[is local tarball]' \
|
||||
'--install[run yarn install before starting module]' \
|
||||
'--docker[is docker container]' \
|
||||
'--v1[install module in v1 manner(do not use it)]' \
|
||||
'--safe[keep module backup, if new module fail = restore with previous]:time' \
|
||||
&& ret=0
|
||||
;;
|
||||
(publish|module:publish)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'--npm[publish on npm]' \
|
||||
'*: :_files -/' \
|
||||
&& ret=0
|
||||
;;
|
||||
(link)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'--info-node[set url info node]:url' \
|
||||
&& ret=0
|
||||
;;
|
||||
(plus)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'--info-node[set url info node]:url' \
|
||||
'(-d --discrete)'{-d,--discrete}'[silent mode]' \
|
||||
'(-a --install-all)'{-a,--install-all}'[install all modules (force yes)]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(dump|save)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'--force[force deletion of dump file even if empty]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(send|attach|describe|env)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'1: :_pm2_id_names' \
|
||||
&& ret=0
|
||||
;;
|
||||
(slist|sysinfos)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'--tree[show as tree]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(logs)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'--json[json log output]' \
|
||||
'--format[formatted log output]' \
|
||||
'--raw[raw output]' \
|
||||
'--err[only shows error output]' \
|
||||
'--out[only shows standard output]' \
|
||||
'--line[output the last N lines, instead of the last 15 by default]:lines' \
|
||||
'--timestamp[add timestamps(default format YYYY-MM-DD-HH:mm:ss)]:format' \
|
||||
'--nostream[print logs without launching the log stream]' \
|
||||
'*--highlight[highlights the given value]' \
|
||||
'1: :_pm2_id_namespace' \
|
||||
&& ret=0
|
||||
;;
|
||||
(serve)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'--port[specify port to listen to]:port' \
|
||||
'--spa[always serving index.html on inexistent sub path]' \
|
||||
'--basic-auth-username[set basic auth username]:username' \
|
||||
'--basic-auth-password[set basic auth password]:password' \
|
||||
'--monitor[frontend app monitoring]:app' \
|
||||
'*: :_files -/' \
|
||||
&& ret=0
|
||||
;;
|
||||
(*)
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[output usage information]' \
|
||||
'*: :_files' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
(( $+functions[_pm2_subcommands] )) ||
|
||||
_pm2_subcommands() {
|
||||
local -a subcommands=(
|
||||
"start:start and daemonize an app"
|
||||
"trigger:trigger process action"
|
||||
"deploy:deploy your json"
|
||||
"startOrRestart:start or restart JSON file"
|
||||
"startOrReload:start or gracefully reload JSON file"
|
||||
"pid:return pid of [app_name] or all"
|
||||
"create:return pid of [app_name] or all"
|
||||
"startOrGracefulReload:start or gracefully reload JSON file"
|
||||
"stop:stop a process"
|
||||
"restart:restart a process"
|
||||
"scale:scale up/down a process in cluster mode depending on total_number param"
|
||||
|
|
@ -23,18 +240,23 @@ _1st_arguments=(
|
|||
"sendSignal:send a system signal to the target process"
|
||||
"ping:ping pm2 daemon - if not up it will launch it"
|
||||
"updatePM2:update in-memory PM2 with local PM2"
|
||||
"update:update in-memory PM2 with local PM2"
|
||||
"install:install or update a module and run it forever"
|
||||
"module\:install:install or update a module and run it forever"
|
||||
"module\:update:update a module and run it forever"
|
||||
"module\:generate:Generate a sample module in current folder"
|
||||
"uninstall:stop and uninstall a module"
|
||||
"module\:uninstall:stop and uninstall a module"
|
||||
"package:Check & Package TAR type module"
|
||||
"publish:Publish the module you are currently on"
|
||||
"module\:publish:Publish the module you are currently on"
|
||||
"set:sets the specified config <key> <value>"
|
||||
"multiset:multiset eg \"key1 val1 key2 val2\""
|
||||
"get:get value for <key>"
|
||||
"conf:get / set module config values"
|
||||
"config:get / set module config values"
|
||||
"unset:clears the specified config <key>"
|
||||
"report:give a full pm2 report for https\://github.com/Unitech/pm2/issues"
|
||||
"report:give a full pm2 report for https://github.com/Unitech/pm2/issues"
|
||||
"link:link with the pm2 monitoring dashboard"
|
||||
"unlink:unlink with the pm2 monitoring dashboard"
|
||||
"monitor:monitor target process"
|
||||
|
|
@ -43,8 +265,8 @@ _1st_arguments=(
|
|||
"plus:enable pm2 plus"
|
||||
"login:Login to pm2 plus"
|
||||
"logout:Logout from pm2 plus"
|
||||
"web:launch a health API on 0.0.0.0\:9615"
|
||||
"dump:dump all processes for resurrecting them later"
|
||||
"save:dump all processes for resurrecting them later"
|
||||
"cleardump:Create empty dump file"
|
||||
"send:send stdin to <pm_id>"
|
||||
"attach:attach stdin/stdout to application identified by <pm_id>"
|
||||
|
|
@ -52,15 +274,27 @@ _1st_arguments=(
|
|||
"unstartup:disable the pm2 startup hook"
|
||||
"startup:enable the pm2 startup hook"
|
||||
"logrotate:copy default logrotate configuration"
|
||||
"ecosystem:generate a process conf file. (mode = null or simple)"
|
||||
"ecosystem:generate a process conf file"
|
||||
"init:generate a process conf file"
|
||||
"reset:reset counters for process"
|
||||
"describe:describe all parameters of a process id"
|
||||
"describe:describe all parameters of a process"
|
||||
"desc:describe all parameters of a process"
|
||||
"info:describe all parameters of a process"
|
||||
"show:describe all parameters of a process"
|
||||
"env:list all environment variables of a process id"
|
||||
"list:list all processes"
|
||||
"l:list all processes"
|
||||
"ps:list all processes"
|
||||
"status:list all processes"
|
||||
"jlist:list all processes in JSON format"
|
||||
"sysmonit:start system monitoring daemon"
|
||||
"slist:list system infos in JSON"
|
||||
"sysinfos:list system infos in JSON"
|
||||
"prettylist:print json in a prettified JSON"
|
||||
"monit:launch termcaps monitoring"
|
||||
"imonit:launch legacy termcaps monitoring"
|
||||
"dashboard:launch dashboard with monitoring and logs"
|
||||
"dash:launch dashboard with monitoring and logs"
|
||||
"flush:flush logs"
|
||||
"reloadLogs:reload all logs"
|
||||
"logs:stream logs file. Default stream all logs"
|
||||
|
|
@ -70,99 +304,71 @@ _1st_arguments=(
|
|||
"backward:downgrades repository to the previous commit for a given app"
|
||||
"deepUpdate:performs a deep update of PM2"
|
||||
"serve:serve a directory over http via port"
|
||||
"autoinstall:auto install"
|
||||
"examples:display pm2 usage examples"
|
||||
)
|
||||
)
|
||||
|
||||
local -a id_names
|
||||
|
||||
_id_names() {
|
||||
local app_list
|
||||
app_list=`pm2 list -m`
|
||||
|
||||
local -a names ids
|
||||
names=(`echo $app_list | grep '+---' | awk '{print $2}'`)
|
||||
ids=(`echo $app_list | grep 'pm2 id' | awk '{print $4}'`)
|
||||
|
||||
if (( ${#ids} > 0 )); then
|
||||
for i in {1..${#ids}}; do
|
||||
id_names+=( "${ids[i]}:${names[i]}" )
|
||||
done
|
||||
fi
|
||||
_describe -t subcommands 'subcommand' subcommands "$@"
|
||||
}
|
||||
|
||||
_arguments \
|
||||
'(-v --version)'{-v,--version}'[output version]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
(( $+functions[_pm2_id_names] )) ||
|
||||
_pm2_id_names() {
|
||||
local app_list=$(pm2 list -m)
|
||||
local -a names=(${(@f)"$(echo $app_list | awk '/^\+---/{sub("+--- ", ""); print}')"})
|
||||
local -a ids=(${(@f)"$(echo $app_list | awk '/^pm2 id/{sub("pm2 id :", ""); print}')"})
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe "command" _1st_arguments
|
||||
return
|
||||
if (( ${#ids} > 0 )); then
|
||||
local -a id_names
|
||||
for i in {1..${#ids}}; do
|
||||
id_names+=( "${ids[i]}:${names[i]}" )
|
||||
done
|
||||
|
||||
_describe 'id' id_names
|
||||
fi
|
||||
}
|
||||
|
||||
(( $+functions[_pm2_namespaces] )) ||
|
||||
_pm2_namespaces() {
|
||||
local -a namespaces=(${(@f)"$(pm2 list -m | awk '/^namespace :/{ print $3 }')"})
|
||||
if (( ${#namespaces} > 0 )); then
|
||||
_values 'namespace' $namespaces
|
||||
fi
|
||||
}
|
||||
|
||||
(( $+functions[_pm2_id_namespace] )) ||
|
||||
_pm2_id_namespace() {
|
||||
_alternative \
|
||||
'ids:id:_pm2_id_names' \
|
||||
'namespaces:namespace:_pm2_namespaces'
|
||||
}
|
||||
|
||||
(( $+functions[_pm2_id_namespace_all] )) ||
|
||||
_pm2_id_namespace_all() {
|
||||
_alternative \
|
||||
'ids:id:_pm2_id_names' \
|
||||
'namespaces:namespace:_pm2_namespaces' \
|
||||
'all:all:(all)'
|
||||
}
|
||||
|
||||
(( $+functions[_pm2_id_namespace_file] )) ||
|
||||
_pm2_id_namespace_file() {
|
||||
_alternative \
|
||||
'ids:id:_pm2_id_names' \
|
||||
'namespaces:namespace:_pm2_namespaces' \
|
||||
'files:file:_files'
|
||||
}
|
||||
|
||||
if [ "$funcstack[1]" = "_pm2" ]; then
|
||||
_pm2 "$@"
|
||||
else
|
||||
compdef _pm2 pm2
|
||||
fi
|
||||
|
||||
local -a id_comp id_all_comp id_all_files_comp start_options logs_options
|
||||
id_comp=('1: :->id_comp')
|
||||
id_all_comp=('1: :->id_all_comp')
|
||||
id_all_files_comp=('1: :->id_all_files_comp')
|
||||
start_options=(
|
||||
'--watch[Watch folder for changes]'
|
||||
'--fresh[Rebuild Dockerfile]'
|
||||
'--daemon[Run container in Daemon mode (debug purposes)]'
|
||||
'--container[Start application in container mode]'
|
||||
'--dist[with --container; change local Dockerfile to containerize all files in current directory]'
|
||||
'--image-name[with --dist; set the exported image name]'
|
||||
'--node-version[with --container, set a specific major Node.js version]'
|
||||
'--dockerdaemon[for debugging purpose]'
|
||||
'(-h --help)'{-h,--help}'[output usage information]'
|
||||
$id_all_files_comp
|
||||
)
|
||||
logs_options=(
|
||||
'--json[json log output]'
|
||||
'--format[formatted log output]'
|
||||
'--raw[raw output]'
|
||||
'--err[only shows error output]'
|
||||
'--out[only shows standard output]'
|
||||
'--lines[output the last N lines, instead of the last 15 by default]'
|
||||
'--timestamp[add timestamps (default format YYYY-MM-DD-HH:mm:ss)]'
|
||||
'--nostream[print logs without launching the log stream]'
|
||||
'(-h --help)'{-h,--help}'[output usage information]'
|
||||
$id_all_comp
|
||||
)
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
|
||||
case "$words[1]" in
|
||||
start)
|
||||
_arguments $start_options && return 0
|
||||
;;
|
||||
logs)
|
||||
_arguments $logs_options && return 0
|
||||
;;
|
||||
stop|restart|delete|reload|reset)
|
||||
_arguments $id_all_comp && return 0
|
||||
;;
|
||||
env|inspect|monitor|unmonitor|describe)
|
||||
_arguments $id_comp && return 0
|
||||
;;
|
||||
deploy|startOrRestart|startOrReload)
|
||||
_files ;;
|
||||
esac
|
||||
|
||||
case "$state" in
|
||||
id_comp)
|
||||
_id_names
|
||||
_alternative \
|
||||
'args:app args:(($id_names))'
|
||||
;;
|
||||
id_all_comp)
|
||||
_id_names
|
||||
id_names+=(all)
|
||||
_alternative \
|
||||
'args:app args:(($id_names))'
|
||||
;;
|
||||
id_all_files_comp)
|
||||
_id_names
|
||||
id_names+=(all)
|
||||
_alternative \
|
||||
'args:app args:(($id_names))' \
|
||||
'files:filename:_files'
|
||||
;;
|
||||
esac
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ _togglePoetryShell() {
|
|||
fi
|
||||
|
||||
# Deactivate the current environment if moving out of a Poetry directory or into a different Poetry directory
|
||||
if [[ $poetry_active -eq 1 ]] && { [[ $in_poetry_dir -eq 0 ]] && [[ "$PWD" != "$poetry_dir"* ]]; }; then
|
||||
if [[ $poetry_active -eq 1 ]] && { [[ $in_poetry_dir -eq 0 ]] || [[ "$PWD" != "$poetry_dir"* ]]; }; then
|
||||
export poetry_active=0
|
||||
unset poetry_dir
|
||||
deactivate
|
||||
(( $+functions[deactivate] )) && deactivate
|
||||
fi
|
||||
|
||||
# Activate the environment if in a Poetry directory and no environment is currently active
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue