merge from upstream

This commit is contained in:
abc 2023-04-07 16:01:57 +08:00
commit 64603fdc86
229 changed files with 5826 additions and 2389 deletions

2
.github/CODEOWNERS vendored
View file

@ -1,9 +1,9 @@
# Plugin owners # Plugin owners
plugins/archlinux/ @ratijas plugins/archlinux/ @ratijas
plugins/aws/ @maksyms
plugins/genpass/ @atoponce plugins/genpass/ @atoponce
plugins/git-lfs/ @hellovietduc plugins/git-lfs/ @hellovietduc
plugins/gitfast/ @felipec plugins/gitfast/ @felipec
plugins/react-native @esthor
plugins/sdk/ @rgoldberg plugins/sdk/ @rgoldberg
plugins/shell-proxy/ @septs plugins/shell-proxy/ @septs
plugins/universalarchive/ @Konfekt plugins/universalarchive/ @Konfekt

View file

@ -9,6 +9,7 @@
- [ ] The code is mine or it's from somewhere with an MIT-compatible license. - [ ] The code is mine or it's from somewhere with an MIT-compatible license.
- [ ] The code is efficient, to the best of my ability, and does not waste computer resources. - [ ] The code is efficient, to the best of my ability, and does not waste computer resources.
- [ ] The code is stable and I have tested it myself, to the best of my abilities. - [ ] The code is stable and I have tested it myself, to the best of my abilities.
- [ ] If the code introduces new aliases, I provide a valid use case for all plugin users down below.
## Changes: ## Changes:

View file

@ -7,13 +7,16 @@ on:
branches: branches:
- master - master
push: push:
branches: branches:
- master - master
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs: jobs:
tests: tests:
name: Run tests name: Run tests
@ -24,7 +27,7 @@ jobs:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
steps: steps:
- name: Set up git repository - name: Set up git repository
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install zsh - name: Install zsh
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: sudo apt-get update; sudo apt-get install zsh run: sudo apt-get update; sudo apt-get install zsh

View file

@ -9,6 +9,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true cancel-in-progress: true
permissions: {}
jobs: jobs:
add-to-project: add-to-project:
name: Add to project name: Add to project
@ -26,24 +27,25 @@ jobs:
gh api graphql -f query=' gh api graphql -f query='
query($org: String!, $number: Int!) { query($org: String!, $number: Int!) {
organization(login: $org){ organization(login: $org){
projectNext(number: $number) { projectV2(number: $number) {
id id
fields(first:20) { fields(first:20) {
nodes { nodes {
id ... on ProjectV2Field {
name id
name
}
} }
} }
} }
} }
} }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
# Parse project data # Parse project data
cat >> $GITHUB_ENV <<EOF cat >> $GITHUB_ENV <<EOF
PROJECT_ID=$(jq '.data.organization.projectNext.id' project_data.json) PROJECT_ID=$(jq '.data.organization.projectV2.id' project_data.json)
PLUGIN_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json) PLUGIN_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json)
THEME_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Theme") | .id' project_data.json) THEME_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Theme") | .id' project_data.json)
EOF EOF
- name: Add to project - name: Add to project
@ -52,13 +54,13 @@ jobs:
run: | run: |
item_id="$(gh api graphql -f query=' item_id="$(gh api graphql -f query='
mutation($project: ID!, $content: ID!) { mutation($project: ID!, $content: ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $content}) { addProjectV2ItemById(input: {projectId: $project, contentId: $content}) {
projectNextItem { item {
id id
} }
} }
} }
' -f project=$PROJECT_ID -f content=$ISSUE_OR_PR_ID --jq '.data.addProjectNextItem.projectNextItem.id')" ' -f project=$PROJECT_ID -f content=$ISSUE_OR_PR_ID --jq '.data.addProjectV2ItemById.item.id')"
echo "ITEM_ID=$item_id" >> $GITHUB_ENV echo "ITEM_ID=$item_id" >> $GITHUB_ENV
@ -107,23 +109,27 @@ jobs:
$theme_field: ID! $theme_field: ID!
$theme_value: String! $theme_value: String!
) { ) {
set_plugin: updateProjectNextItemField(input: { set_plugin: updateProjectV2ItemFieldValue(input: {
projectId: $project projectId: $project
itemId: $item itemId: $item
fieldId: $plugin_field fieldId: $plugin_field
value: $plugin_value value: {
text: $plugin_value
}
}) { }) {
projectNextItem { projectV2Item {
id id
} }
} }
set_theme: updateProjectNextItemField(input: { set_theme: updateProjectV2ItemFieldValue(input: {
projectId: $project projectId: $project
itemId: $item itemId: $item
fieldId: $theme_field fieldId: $theme_field
value: $theme_value value: {
text: $theme_value
}
}) { }) {
projectNextItem { projectV2Item {
id id
} }
} }
@ -132,4 +138,3 @@ jobs:
-f plugin_field=$PLUGIN_FIELD_ID -f plugin_value=$PLUGIN \ -f plugin_field=$PLUGIN_FIELD_ID -f plugin_value=$PLUGIN \
-f theme_field=$THEME_FIELD_ID -f theme_value=$THEME \ -f theme_field=$THEME_FIELD_ID -f theme_value=$THEME \
--silent --silent

4
.gitignore vendored
View file

@ -6,3 +6,7 @@ cache/
log/ log/
*.swp *.swp
.DS_Store .DS_Store
# editor configs
.vscode
.idea

4
.prettierrc Normal file
View file

@ -0,0 +1,4 @@
{
"printWidth": 110,
"proseWrap": "always"
}

View file

@ -35,13 +35,13 @@ you would make is not already covered.
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
your problem. your problem.
If you find one, comment on it so we can know there are more people experiencing it. If you find one, comment on it, so we know more people are experiencing it.
If not, look at the [Troubleshooting](https://github.com/ohmyzsh/ohmyzsh/wiki/Troubleshooting) If not, look at the [Troubleshooting](https://github.com/ohmyzsh/ohmyzsh/wiki/Troubleshooting)
page for instructions on how to gather data to better debug your problem. page for instructions on how to gather data to better debug your problem.
Then, you can go ahead and create an issue with as much detail as you can provide. Then, you can go ahead and create an issue with as much detail as you can provide.
It should include the data gathered as indicated above, along with: It should include the data gathered as indicated above, along with the following:
1. How to reproduce the problem 1. How to reproduce the problem
2. What the correct behavior should be 2. What the correct behavior should be
@ -57,7 +57,7 @@ We will do our very best to help you.
Please be so kind as to [search](#use-the-search-luke) for any open issue already covering Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
your suggestion. your suggestion.
If you find one, comment on it so we can know there are more people supporting it. If you find one, comment on it, so we know more people are supporting it.
If not, you can go ahead and create an issue. Please copy to anyone relevant (e.g. plugin If not, you can go ahead and create an issue. Please copy to anyone relevant (e.g. plugin
maintainers) by mentioning their GitHub handle (starting with `@`) in your message. maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
@ -84,7 +84,7 @@ your [problem](#you-have-a-problem), and any pending/merged/rejected PR covering
If the solution is already reported, try it out and +1 the pull request if the If the solution is already reported, try it out and +1 the pull request if the
solution works ok. On the other hand, if you think your solution is better, post solution works ok. On the other hand, if you think your solution is better, post
it with a reference to the other one so we can have both solutions to compare. it with reference to the other one so we can have both solutions to compare.
If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin
maintainers) by mentioning their GitHub handle (starting with `@`) in your message. maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
@ -104,6 +104,27 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
For any extensive change, such as a new plugin, you will have to find testers to +1 your PR. For any extensive change, such as a new plugin, you will have to find testers to +1 your PR.
### New plugin aliases
We acknowledge that aliases are a core part of Oh My Zsh. There are plugins that have +100 aliases!
This has become an issue for two opposing reasons:
- Some users want to have their personal aliases in Oh My Zsh.
- Some users don't want any aliases at all and feel that there are too many.
Because of this, from now on, we require that new aliases follow these conditions:
1. They will be used by many people, not just a few.
2. The aliases will be used many times and for common tasks.
3. Prefer one generic alias over many specific ones.
4. When justifying the need for an alias, talk about workflows where you'll use it,
preferably in combination with other aliases.
5. If a command with the same name exists, look for a different alias name.
This list is not exhaustive! Please remember that your alias will be in the machines of many people,
so it should be justified why they should have it.
---- ----
## Use the Search, Luke ## Use the Search, Luke
@ -193,7 +214,7 @@ type(scope)!: subject
``` ```
- `subject`: a brief description of the changes. This will be displayed in the changelog. If you need - `subject`: a brief description of the changes. This will be displayed in the changelog. If you need
to specify other details you can use the commit body but it won't be visible. to specify other details, you can use the commit body, but it won't be visible.
Formatting tricks: the commit subject may contain: Formatting tricks: the commit subject may contain:
@ -210,9 +231,9 @@ type(scope)!: subject
### Style ### Style
Try to keep the first commit line short. This is harder to do using this commit style but try to be Try to keep the first commit line short. It's harder to do using this commit style but try to be
concise and if you need more space, you can use the commit body. Try to make sure that the commit concise, and if you need more space, you can use the commit body. Try to make sure that the commit
subject is clear and precise enough that users will know what change by just looking at the changelog. subject is clear and precise enough that users will know what changed by just looking at the changelog.
---- ----

View file

@ -67,7 +67,9 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
- [Manual Installation](#manual-installation) - [Manual Installation](#manual-installation)
- [Installation Problems](#installation-problems) - [Installation Problems](#installation-problems)
- [Custom Plugins and Themes](#custom-plugins-and-themes) - [Custom Plugins and Themes](#custom-plugins-and-themes)
- [Skip aliases](#skip-aliases)
- [Getting Updates](#getting-updates) - [Getting Updates](#getting-updates)
- [Updates verbosity](#updates-verbosity)
- [Manual Updates](#manual-updates) - [Manual Updates](#manual-updates)
- [Uninstalling Oh My Zsh](#uninstalling-oh-my-zsh) - [Uninstalling Oh My Zsh](#uninstalling-oh-my-zsh)
- [How do I contribute to Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh) - [How do I contribute to Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh)
@ -303,6 +305,58 @@ If you have many functions that go well together, you can put them as a `XYZ.plu
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`. If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
### Skip aliases
<a name="remove-directories-aliases"></a>
If you want to skip default Oh My Zsh aliases (those defined in `lib/*` files) or plugin aliases,
you can use the settings below in your `~/.zshrc` file, **before Oh My Zsh is loaded**. Note that
there are many different ways to skip aliases, depending on your needs.
```sh
# Skip all aliases, in lib files and enabled plugins
zstyle ':omz:*' aliases no
# Skip all aliases in lib files
zstyle ':omz:lib:*' aliases no
# Skip only aliases defined in the directories.zsh lib file
zstyle ':omz:lib:directories' aliases no
# Skip all plugin aliases
zstyle ':omz:plugins:*' aliases no
# Skip only the aliases from the git plugin
zstyle ':omz:plugins:git' aliases no
```
You can combine these in other ways taking into account that more specific scopes takes precedence:
```sh
# Skip all plugin aliases, except for the git plugin
zstyle ':omz:plugins:*' aliases no
zstyle ':omz:plugins:git' aliases yes
```
A previous version of this feature was using the setting below, which has been removed:
```sh
zstyle ':omz:directories' aliases no
```
Instead, you can now use the following:
```sh
zstyle ':omz:lib:directories' aliases no
```
#### Notice <!-- omit in toc -->
> This feature is currently in a testing phase and it may be subject to change in the future.
> It is also not currently compatible with plugin managers such as zpm or zinit, which don't
> source the init script (`oh-my-zsh.sh`) where this feature is implemented in.
> It is also not currently aware of "aliases" that are defined as functions. Example of such
> are `gccd`, `ggf`, or `ggl` functions from the git plugin.
## Getting Updates ## Getting Updates
By default, you will be prompted to check for updates every 2 weeks. You can choose other update modes by adding a line to your `~/.zshrc` file, **before Oh My Zsh is loaded**: By default, you will be prompted to check for updates every 2 weeks. You can choose other update modes by adding a line to your `~/.zshrc` file, **before Oh My Zsh is loaded**:
@ -334,6 +388,18 @@ zstyle ':omz:update' frequency 7
zstyle ':omz:update' frequency 0 zstyle ':omz:update' frequency 0
``` ```
### Updates verbosity
You can also limit the update verbosity with the following settings:
```sh
zstyle ':omz:update' verbose default # default update prompt
zstyle ':omz:update' verbose minimal # only few lines
zstyle ':omz:update' verbose silent # only errors
```
### Manual Updates ### Manual Updates
If you'd like to update at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run: If you'd like to update at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run:
@ -391,4 +457,4 @@ Oh My Zsh is released under the [MIT license](LICENSE.txt).
![Planet Argon](https://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg) ![Planet Argon](https://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg)
Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). Check out our [other open source projects](https://www.planetargon.com/open-source?utm_source=github). Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](http://www.planetargon.com/services/ruby-on-rails-development?utm_source=github). Check out our [other open source projects](https://www.planetargon.com/open-source?utm_source=github).

View file

@ -241,21 +241,21 @@ function _omz::plugin::disable {
# Remove plugins substitution awk script # Remove plugins substitution awk script
local awk_subst_plugins="\ local awk_subst_plugins="\
gsub(/\s+(${(j:|:)dis_plugins})/, \"\") # with spaces before gsub(/[ \t]+(${(j:|:)dis_plugins})/, \"\") # with spaces before
gsub(/(${(j:|:)dis_plugins})\s+/, \"\") # with spaces after gsub(/(${(j:|:)dis_plugins})[ \t]+/, \"\") # with spaces after
gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin) gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin)
" "
# Disable plugins awk script # Disable plugins awk script
local awk_script=" local awk_script="
# if plugins=() is in oneline form, substitute disabled plugins and go to next line # if plugins=() is in oneline form, substitute disabled plugins and go to next line
/^\s*plugins=\([^#]+\).*\$/ { /^[ \t]*plugins=\([^#]+\).*\$/ {
$awk_subst_plugins $awk_subst_plugins
print \$0 print \$0
next next
} }
# if plugins=() is in multiline form, enable multi flag and disable plugins if they're there # if plugins=() is in multiline form, enable multi flag and disable plugins if they're there
/^\s*plugins=\(/ { /^[ \t]*plugins=\(/ {
multi=1 multi=1
$awk_subst_plugins $awk_subst_plugins
print \$0 print \$0
@ -280,9 +280,10 @@ multi == 1 && length(\$0) > 0 {
" "
local zdot="${ZDOTDIR:-$HOME}" local zdot="${ZDOTDIR:-$HOME}"
awk "$awk_script" "$zdot/.zshrc" > "$zdot/.zshrc.new" \ local zshrc="${${:-"${zdot}/.zshrc"}:A}"
&& command mv -f "$zdot/.zshrc" "$zdot/.zshrc.bck" \ awk "$awk_script" "$zshrc" > "$zdot/.zshrc.new" \
&& command mv -f "$zdot/.zshrc.new" "$zdot/.zshrc" && command cp -f "$zshrc" "$zdot/.zshrc.bck" \
&& command mv -f "$zdot/.zshrc.new" "$zshrc"
# Exit if the new .zshrc file wasn't created correctly # Exit if the new .zshrc file wasn't created correctly
[[ $? -eq 0 ]] || { [[ $? -eq 0 ]] || {
@ -294,8 +295,7 @@ multi == 1 && length(\$0) > 0 {
# Exit if the new .zshrc file has syntax errors # Exit if the new .zshrc file has syntax errors
if ! command zsh -n "$zdot/.zshrc"; then if ! command zsh -n "$zdot/.zshrc"; then
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..." _omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new" command mv -f "$zdot/.zshrc.bck" "$zshrc"
command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
return 1 return 1
fi fi
@ -330,14 +330,14 @@ function _omz::plugin::enable {
# Enable plugins awk script # Enable plugins awk script
local awk_script=" local awk_script="
# if plugins=() is in oneline form, substitute ) with new plugins and go to the next line # if plugins=() is in oneline form, substitute ) with new plugins and go to the next line
/^\s*plugins=\([^#]+\).*\$/ { /^[ \t]*plugins=\([^#]+\).*\$/ {
sub(/\)/, \" $add_plugins&\") sub(/\)/, \" $add_plugins&\")
print \$0 print \$0
next next
} }
# if plugins=() is in multiline form, enable multi flag # if plugins=() is in multiline form, enable multi flag
/^\s*plugins=\(/ { /^[ \t]*plugins=\(/ {
multi=1 multi=1
} }
@ -354,9 +354,10 @@ multi == 1 && /^[^#]*\)/ {
" "
local zdot="${ZDOTDIR:-$HOME}" local zdot="${ZDOTDIR:-$HOME}"
awk "$awk_script" "$zdot/.zshrc" > "$zdot/.zshrc.new" \ local zshrc="${${:-"${zdot}/.zshrc"}:A}"
&& command mv -f "$zdot/.zshrc" "$zdot/.zshrc.bck" \ awk "$awk_script" "$zshrc" > "$zdot/.zshrc.new" \
&& command mv -f "$zdot/.zshrc.new" "$zdot/.zshrc" && command cp -f "$zshrc" "$zdot/.zshrc.bck" \
&& command mv -f "$zdot/.zshrc.new" "$zshrc"
# Exit if the new .zshrc file wasn't created correctly # Exit if the new .zshrc file wasn't created correctly
[[ $? -eq 0 ]] || { [[ $? -eq 0 ]] || {
@ -368,8 +369,7 @@ multi == 1 && /^[^#]*\)/ {
# Exit if the new .zshrc file has syntax errors # Exit if the new .zshrc file has syntax errors
if ! command zsh -n "$zdot/.zshrc"; then if ! command zsh -n "$zdot/.zshrc"; then
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..." _omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new" command mv -f "$zdot/.zshrc.bck" "$zshrc"
command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
return 1 return 1
fi fi
@ -416,14 +416,14 @@ function _omz::plugin::list {
if (( ${#custom_plugins} )); then if (( ${#custom_plugins} )); then
print -P "%U%BCustom plugins%b%u:" print -P "%U%BCustom plugins%b%u:"
print -l ${(q-)custom_plugins} | column -x print -lac ${(q-)custom_plugins}
fi fi
if (( ${#builtin_plugins} )); then if (( ${#builtin_plugins} )); then
(( ${#custom_plugins} )) && echo # add a line of separation (( ${#custom_plugins} )) && echo # add a line of separation
print -P "%U%BBuilt-in plugins%b%u:" print -P "%U%BBuilt-in plugins%b%u:"
print -l ${(q-)builtin_plugins} | column -x print -lac ${(q-)builtin_plugins}
fi fi
} }
@ -674,13 +674,13 @@ function _omz::theme::list {
# Print custom themes if there are any # Print custom themes if there are any
if (( ${#custom_themes} )); then if (( ${#custom_themes} )); then
print -P "%U%BCustom themes%b%u:" print -P "%U%BCustom themes%b%u:"
print -l ${(q-)custom_themes} | column -x print -lac ${(q-)custom_themes}
echo echo
fi fi
# Print built-in themes # Print built-in themes
print -P "%U%BBuilt-in themes%b%u:" print -P "%U%BBuilt-in themes%b%u:"
print -l ${(q-)builtin_themes} | column -x print -lac ${(q-)builtin_themes}
} }
function _omz::theme::set { function _omz::theme::set {
@ -699,9 +699,9 @@ function _omz::theme::set {
# Enable theme in .zshrc # Enable theme in .zshrc
local awk_script=' local awk_script='
!set && /^\s*ZSH_THEME=[^#]+.*$/ { !set && /^[ \t]*ZSH_THEME=[^#]+.*$/ {
set=1 set=1
sub(/^\s*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`") sub(/^[ \t]*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`")
print $0 print $0
next next
} }
@ -715,7 +715,8 @@ END {
' '
local zdot="${ZDOTDIR:-$HOME}" local zdot="${ZDOTDIR:-$HOME}"
awk "$awk_script" "$zdot/.zshrc" > "$zdot/.zshrc.new" \ local zshrc="${${:-"${zdot}/.zshrc"}:A}"
awk "$awk_script" "$zshrc" > "$zdot/.zshrc.new" \
|| { || {
# Prepend ZSH_THEME= line to .zshrc if it doesn't exist # Prepend ZSH_THEME= line to .zshrc if it doesn't exist
cat <<EOF cat <<EOF
@ -724,8 +725,8 @@ ZSH_THEME="$1" # set by \`omz\`
EOF EOF
cat "$zdot/.zshrc" cat "$zdot/.zshrc"
} > "$zdot/.zshrc.new" \ } > "$zdot/.zshrc.new" \
&& command mv -f "$zdot/.zshrc" "$zdot/.zshrc.bck" \ && command cp -f "$zshrc" "$zdot/.zshrc.bck" \
&& command mv -f "$zdot/.zshrc.new" "$zdot/.zshrc" && command mv -f "$zdot/.zshrc.new" "$zshrc"
# Exit if the new .zshrc file wasn't created correctly # Exit if the new .zshrc file wasn't created correctly
[[ $? -eq 0 ]] || { [[ $? -eq 0 ]] || {
@ -737,8 +738,7 @@ EOF
# Exit if the new .zshrc file has syntax errors # Exit if the new .zshrc file has syntax errors
if ! command zsh -n "$zdot/.zshrc"; then if ! command zsh -n "$zdot/.zshrc"; then
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..." _omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new" command mv -f "$zdot/.zshrc.bck" "$zshrc"
command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
return 1 return 1
fi fi
@ -776,10 +776,11 @@ function _omz::update {
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD) local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD)
# Run update script # Run update script
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
if [[ "$1" != --unattended ]]; then if [[ "$1" != --unattended ]]; then
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" --interactive || return $? ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode || return $?
else else
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" || return $? ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -v $verbose_mode || return $?
fi fi
# Update last updated file # Update last updated file

View file

@ -10,8 +10,8 @@
# - pbcopy, pbpaste (macOS) # - pbcopy, pbpaste (macOS)
# - cygwin (Windows running Cygwin) # - cygwin (Windows running Cygwin)
# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set) # - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
# - xclip (if $DISPLAY is set)
# - xsel (if $DISPLAY is set) # - xsel (if $DISPLAY is set)
# - xclip (if $DISPLAY is set)
# - lemonade (for SSH) https://github.com/pocke/lemonade # - lemonade (for SSH) https://github.com/pocke/lemonade
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ # - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
# - win32yank (Windows) # - win32yank (Windows)
@ -52,38 +52,38 @@ function detect-clipboard() {
emulate -L zsh emulate -L zsh
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
function clipcopy() { pbcopy < "${1:-/dev/stdin}"; } function clipcopy() { cat "${1:-/dev/stdin}" | pbcopy; }
function clippaste() { pbpaste; } function clippaste() { pbpaste; }
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; } function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
function clippaste() { cat /dev/clipboard; } function clippaste() { cat /dev/clipboard; }
elif (( $+commands[clip.exe] )) && (( $+commands[powershell.exe] )); then
function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; }
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
function clipcopy() { wl-copy < "${1:-/dev/stdin}"; } function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
function clippaste() { wl-paste; } function clippaste() { wl-paste; }
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; }
function clippaste() { xclip -out -selection clipboard; }
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; } function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; }
function clippaste() { xsel --clipboard --output; } function clippaste() { xsel --clipboard --output; }
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; }
function clippaste() { xclip -out -selection clipboard; }
elif (( ${+commands[lemonade]} )); then elif (( ${+commands[lemonade]} )); then
function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; } function clipcopy() { cat "${1:-/dev/stdin}" | lemonade copy; }
function clippaste() { lemonade paste; } function clippaste() { lemonade paste; }
elif (( ${+commands[doitclient]} )); then elif (( ${+commands[doitclient]} )); then
function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; } function clipcopy() { cat "${1:-/dev/stdin}" | doitclient wclip; }
function clippaste() { doitclient wclip -r; } function clippaste() { doitclient wclip -r; }
elif (( ${+commands[win32yank]} )); then elif (( ${+commands[win32yank]} )); then
function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; } function clipcopy() { cat "${1:-/dev/stdin}" | win32yank -i; }
function clippaste() { win32yank -o; } function clippaste() { win32yank -o; }
elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then
function clipcopy() { termux-clipboard-set < "${1:-/dev/stdin}"; } function clipcopy() { cat "${1:-/dev/stdin}" | termux-clipboard-set; }
function clippaste() { termux-clipboard-get; } function clippaste() { termux-clipboard-get; }
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
function clipcopy() { tmux load-buffer "${1:--}"; } function clipcopy() { tmux load-buffer "${1:--}"; }
function clippaste() { tmux save-buffer -; } function clippaste() { tmux save-buffer -; }
elif [[ $(uname -r) = *icrosoft* ]]; then
function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
else else
function _retry_clipboard_detection_or_fail() { function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift local clipcmd="${1}"; shift

View file

@ -18,9 +18,9 @@ if [[ "$CASE_SENSITIVE" = true ]]; then
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
else else
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]-_}={[:upper:][:lower:]_-}' 'r:|=*' 'l:|=* r:|=*'
else else
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|=*' 'l:|=* r:|=*'
fi fi
fi fi
unset CASE_SENSITIVE HYPHEN_INSENSITIVE unset CASE_SENSITIVE HYPHEN_INSENSITIVE

View file

@ -1,13 +1,8 @@
if [[ "$ENABLE_CORRECTION" == "true" ]]; then if [[ "$ENABLE_CORRECTION" == "true" ]]; then
alias cp='nocorrect cp' alias cp='nocorrect cp'
alias ebuild='nocorrect ebuild'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'
alias hpodder='nocorrect hpodder'
alias man='nocorrect man' alias man='nocorrect man'
alias mkdir='nocorrect mkdir' alias mkdir='nocorrect mkdir'
alias mv='nocorrect mv' alias mv='nocorrect mv'
alias mysql='nocorrect mysql'
alias sudo='nocorrect sudo' alias sudo='nocorrect sudo'
alias su='nocorrect su' alias su='nocorrect su'

View file

@ -1,8 +1,10 @@
# Changing/making/removing directory # Changing/making/removing directory
setopt auto_cd
setopt auto_pushd setopt auto_pushd
setopt pushd_ignore_dups setopt pushd_ignore_dups
setopt pushdminus setopt pushdminus
alias -g ...='../..' alias -g ...='../..'
alias -g ....='../../..' alias -g ....='../../..'
alias -g .....='../../../..' alias -g .....='../../../..'

View file

@ -30,6 +30,13 @@ function open_command() {
;; ;;
esac esac
# If a URL is passed, $BROWSER might be set to a local browser within SSH.
# See https://github.com/ohmyzsh/ohmyzsh/issues/11098
if [[ -n "$BROWSER" && "$1" = (http|https)://* ]]; then
"$BROWSER" "$@"
return
fi
${=open_cmd} "$@" &>/dev/null ${=open_cmd} "$@" &>/dev/null
} }
@ -56,7 +63,7 @@ function takegit() {
} }
function take() { function take() {
if [[ $1 =~ ^(https?|ftp).*\.tar\.(gz|bz2|xz)$ ]]; then if [[ $1 =~ ^(https?|ftp).*\.(tar\.(gz|bz2|xz)|tgz)$ ]]; then
takeurl "$1" takeurl "$1"
elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then
takegit "$1" takegit "$1"

View file

@ -19,6 +19,7 @@ function git_prompt_info() {
local ref local ref
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \ ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
|| ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) \ || ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) \
|| return 0 || return 0

View file

@ -24,8 +24,8 @@ else
if [[ -n "$GREP_OPTIONS" ]]; then if [[ -n "$GREP_OPTIONS" ]]; then
# export grep, egrep and fgrep settings # export grep, egrep and fgrep settings
alias grep="grep $GREP_OPTIONS" alias grep="grep $GREP_OPTIONS"
alias egrep="egrep $GREP_OPTIONS" alias egrep="grep -E $GREP_OPTIONS"
alias fgrep="fgrep $GREP_OPTIONS" alias fgrep="grep -F $GREP_OPTIONS"
# write to cache file if cache directory is writable # write to cache file if cache directory is writable
if [[ -w "$ZSH_CACHE_DIR" ]]; then if [[ -w "$ZSH_CACHE_DIR" ]]; then

View file

@ -15,8 +15,9 @@ if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
done done
fi fi
## jobs setopt multios # enable redirect to multiple streams: echo >file1 >file2
setopt long_list_jobs setopt long_list_jobs # show long list format job notifications
setopt interactivecomments # recognize comments
env_default 'PAGER' 'less' env_default 'PAGER' 'less'
env_default 'LESS' '-R' env_default 'LESS' '-R'
@ -24,12 +25,9 @@ env_default 'LESS' '-R'
## super user alias ## super user alias
alias _='sudo ' alias _='sudo '
## more intelligent acking for ubuntu users ## more intelligent acking for ubuntu users and no alias for users without ack
if (( $+commands[ack-grep] )); then if (( $+commands[ack-grep] )); then
alias afind='ack-grep -il' alias afind='ack-grep -il'
else elif (( $+commands[ack] )); then
alias afind='ack -il' alias afind='ack -il'
fi fi
# recognize comments
setopt interactivecomments

View file

@ -18,6 +18,7 @@ function chruby_prompt_info \
vi_mode_prompt_info \ vi_mode_prompt_info \
virtualenv_prompt_info \ virtualenv_prompt_info \
jenv_prompt_info \ jenv_prompt_info \
azure_prompt_info \
tf_prompt_info \ tf_prompt_info \
{ {
return 1 return 1

View file

@ -17,7 +17,7 @@ function title {
: ${2=$1} : ${2=$1}
case "$TERM" in case "$TERM" in
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*|foot) cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*|foot|contour*)
print -Pn "\e]2;${2:q}\a" # set window name print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name print -Pn "\e]1;${1:q}\a" # set tab name
;; ;;
@ -109,28 +109,52 @@ if [[ -z "$INSIDE_EMACS" || "$INSIDE_EMACS" = vterm ]]; then
add-zsh-hook preexec omz_termsupport_preexec add-zsh-hook preexec omz_termsupport_preexec
fi fi
# Keep Apple Terminal.app's current working directory updated # Keep terminal emulator's current working directory correct,
# Based on this answer: https://superuser.com/a/315029 # even if the current working directory path contains symbolic links
# With extra fixes to handle multibyte chars and non-UTF-8 locales #
# References:
# - Apple's Terminal.app: https://superuser.com/a/315029
# - iTerm2: https://iterm2.com/documentation-escape-codes.html (iTerm2 Extension / CurrentDir+RemoteHost)
# - Konsole: https://bugs.kde.org/show_bug.cgi?id=327720#c1
# - libvte (gnome-terminal, mate-terminal, …): https://bugzilla.gnome.org/show_bug.cgi?id=675987#c14
# Apparently it had a bug before ~2012 were it would display the unknown OSC 7 code
#
# As of May 2021 mlterm, PuTTY, rxvt, screen, termux & xterm simply ignore the unknown OSC.
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then # Don't define the function if we're inside Emacs
# Emits the control sequence to notify Terminal.app of the cwd if [[ -n "$INSIDE_EMACS" ]]; then
# Identifies the directory using a file: URI scheme, including return
# the host name to disambiguate local vs. remote paths.
function update_terminalapp_cwd() {
emulate -L zsh
# Percent-encode the host and path names.
local URL_HOST URL_PATH
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Undocumented Terminal.app-specific control sequence
printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
add-zsh-hook precmd update_terminalapp_cwd
# Run once to get initial cwd set
update_terminalapp_cwd
fi fi
# Don't define the function if we're in an unsupported terminal
case "$TERM" in
# all of these either process OSC 7 correctly or ignore entirely
xterm*|putty*|rxvt*|konsole*|mlterm*|alacritty|screen*|tmux*) ;;
contour*|foot*) ;;
*)
# Terminal.app and iTerm2 process OSC 7 correctly
case "$TERM_PROGRAM" in
Apple_Terminal|iTerm.app) ;;
*) return ;;
esac ;;
esac
# Emits the control sequence to notify many terminal emulators
# of the cwd
#
# Identifies the directory using a file: URI scheme, including
# the host name to disambiguate local vs. remote paths.
function omz_termsupport_cwd {
# Percent-encode the host and path names.
local URL_HOST URL_PATH
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# common control sequence (OSC 7) to set current host and path
printf "\e]7;%s\a" "file://${URL_HOST}${URL_PATH}"
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
# i.e. when a script or function changes directory without `cd -q`, chpwd
# will be called the output may be swallowed by the script or function.
add-zsh-hook precmd omz_termsupport_cwd

View file

@ -1,59 +1,83 @@
# ls colors # Sets color variable such as $fg, $bg, $color and $reset_color
autoload -U colors && colors autoload -U colors && colors
# Enable ls colors # Expand variables and commands in PROMPT variables
export LSCOLORS="Gxfxcxdxbxegedabagacad"
# TODO organise this chaotic logic
if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
# Find the option for using colors in ls, depending on the version
if [[ "$OSTYPE" == netbsd* ]]; then
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
elif [[ "$OSTYPE" == openbsd* ]]; then
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
# with color and multibyte support) are available from ports. "colorls"
# will be installed on purpose and can't be pulled in by installing
# coreutils, so prefer it to "gls".
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
colorls -G -d . &>/dev/null && alias ls='colorls -G'
elif [[ "$OSTYPE" == (darwin|freebsd)* ]]; then
# this is a good alias, it works by default just using $LSCOLORS
ls -G . &>/dev/null && alias ls='ls -G'
# only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file)
# otherwise, gls will use the default color scheme which is ugly af
[[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty'
else
# For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
if [[ -z "$LS_COLORS" ]]; then
(( $+commands[dircolors] )) && eval "$(dircolors -b)"
fi
ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' }
# Take advantage of $LS_COLORS for completion as well.
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
fi
fi
# enable diff color if possible.
if command diff --color /dev/null /dev/null &>/dev/null; then
alias diff='diff --color'
fi
setopt auto_cd
setopt multios
setopt prompt_subst setopt prompt_subst
[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO="" # Prompt function theming defaults
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Beginning of the git prompt, before the branch name
# git theming default: Variables for theming the git info prompt ZSH_THEME_GIT_PROMPT_SUFFIX=")" # End of the git prompt
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
ZSH_THEME_RUBY_PROMPT_PREFIX="(" ZSH_THEME_RUBY_PROMPT_PREFIX="("
ZSH_THEME_RUBY_PROMPT_SUFFIX=")" ZSH_THEME_RUBY_PROMPT_SUFFIX=")"
# Use diff --color if available
if command diff --color /dev/null{,} &>/dev/null; then
function diff {
command diff --color "$@"
}
fi
# Don't set ls coloring if disabled
[[ "$DISABLE_LS_COLORS" != true ]] || return 0
function test-ls-args {
local cmd="$1" # ls, gls, colorls, ...
local args="${@[2,-1]}" # arguments except the first one
command "$cmd" "$args" /dev/null &>/dev/null
}
# Find the option for using colors in ls, depending on the version
case "$OSTYPE" in
netbsd*)
# On NetBSD, test if `gls` (GNU ls) is installed (this one supports colors);
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
test-ls-args gls --color && alias ls='gls --color=tty'
;;
openbsd*)
# On OpenBSD, `gls` (ls from GNU coreutils) and `colorls` (ls from base,
# with color and multibyte support) are available from ports.
# `colorls` will be installed on purpose and can't be pulled in by installing
# coreutils (which might be installed for ), so prefer it to `gls`.
test-ls-args gls --color && alias ls='gls --color=tty'
test-ls-args colorls -G && alias ls='colorls -G'
;;
(darwin|freebsd)*)
# This alias works by default just using $LSCOLORS
test-ls-args ls -G && alias ls='ls -G'
# Only use GNU ls if installed and there are user defaults for $LS_COLORS,
# as the default coloring scheme is not very pretty
[[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] \
&& test-ls-args gls --color \
&& alias ls='gls --color=tty'
;;
*)
if test-ls-args ls --color; then
alias ls='ls --color=tty'
elif test-ls-args ls -G; then
alias ls='ls -G'
fi
;;
esac
unfunction test-ls-args
# Default coloring for BSD-based ls
export LSCOLORS="Gxfxcxdxbxegedabagacad"
# Default coloring for GNU-based ls
if [[ -z "$LS_COLORS" ]]; then
# Define LS_COLORS via dircolors if available. Otherwise, set a default
# equivalent to LSCOLORS (generated via https://geoff.greer.fm/lscolors)
if (( $+commands[dircolors] )); then
[[ -f "$HOME/.dircolors" ]] \
&& source <(dircolors -b "$HOME/.dircolors") \
|| source <(dircolors -b)
else
export LS_COLORS="di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
fi
fi

View file

@ -38,7 +38,7 @@
# due to malicious input as a consequence of CVE-2021-45444, which affects # due to malicious input as a consequence of CVE-2021-45444, which affects
# zsh versions from 5.0.3 to 5.8. # zsh versions from 5.0.3 to 5.8.
# #
autoload -Uz +X regexp-replace VCS_INFO_formats 2>/dev/null || return autoload -Uz +X regexp-replace VCS_INFO_formats 2>/dev/null || return 0
# We use $tmp here because it's already a local variable in VCS_INFO_formats # We use $tmp here because it's already a local variable in VCS_INFO_formats
typeset PATCH='for tmp (base base-name branch misc revision subdir) hook_com[$tmp]="${hook_com[$tmp]//\%/%%}"' typeset PATCH='for tmp (base base-name branch misc revision subdir) hook_com[$tmp]="${hook_com[$tmp]//\%/%%}"'

View file

@ -57,9 +57,7 @@ mkdir -p "$ZSH_CACHE_DIR/completions"
(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath) (( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
# Check for updates on initial load... # Check for updates on initial load...
if [[ "$DISABLE_AUTO_UPDATE" != true ]]; then source "$ZSH/tools/check_for_upgrade.sh"
source "$ZSH/tools/check_for_upgrade.sh"
fi
# Initializes Oh My Zsh # Initializes Oh My Zsh
@ -67,7 +65,7 @@ fi
fpath=("$ZSH/functions" "$ZSH/completions" $fpath) fpath=("$ZSH/functions" "$ZSH/completions" $fpath)
# Load all stock functions (from $fpath files) called below. # Load all stock functions (from $fpath files) called below.
autoload -U compaudit compinit autoload -U compaudit compinit zrecompile
# Set ZSH_CUSTOM to the path where your custom config files # Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/ # and plugins exists, or else we will use the default custom/
@ -142,22 +140,57 @@ EOF
fi fi
unset zcompdump_revision zcompdump_fpath zcompdump_refresh unset zcompdump_revision zcompdump_fpath zcompdump_refresh
# zcompile the completion dump file if the .zwc is older or missing.
if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then
zrecompile -q -p "$ZSH_COMPDUMP"
command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock"
fi
_omz_source() {
local context filepath="$1"
# Construct zstyle context based on path
case "$filepath" in
lib/*) context="lib:${filepath:t:r}" ;; # :t = lib_name.zsh, :r = lib_name
plugins/*) context="plugins:${filepath:h:t}" ;; # :h = plugins/plugin_name, :t = plugin_name
esac
local disable_aliases=0
zstyle -T ":omz:${context}" aliases || disable_aliases=1
# Back up alias names prior to sourcing
local -a aliases_pre galiases_pre
if (( disable_aliases )); then
aliases_pre=("${(@k)aliases}")
galiases_pre=("${(@k)galiases}")
fi
# Source file from $ZSH_CUSTOM if it exists, otherwise from $ZSH
if [[ -f "$ZSH_CUSTOM/$filepath" ]]; then
source "$ZSH_CUSTOM/$filepath"
elif [[ -f "$ZSH/$filepath" ]]; then
source "$ZSH/$filepath"
fi
# Unset all aliases that don't appear in the backed up list of aliases
if (( disable_aliases )); then
local -a disabled
# ${var:|array} gets the list of items in var not in array
disabled=("${(@k)aliases:|aliases_pre}" "${(@k)galiases:|galiases_pre}")
(( $#disabled == 0 )) || unalias "${(@)disabled}"
fi
}
# Load all of the config files in ~/oh-my-zsh that end in .zsh # Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore # TIP: Add files you don't want in git to .gitignore
for config_file ("$ZSH"/lib/*.zsh); do for config_file ("$ZSH"/lib/*.zsh); do
custom_config_file="$ZSH_CUSTOM/lib/${config_file:t}" _omz_source "lib/${config_file:t}"
[[ -f "$custom_config_file" ]] && config_file="$custom_config_file"
source "$config_file"
done done
unset custom_config_file unset custom_config_file
# Load all of the plugins that were defined in ~/.zshrc # Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do for plugin ($plugins); do
if [[ -f "$ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh" ]]; then _omz_source "plugins/$plugin/$plugin.plugin.zsh"
source "$ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh"
elif [[ -f "$ZSH/plugins/$plugin/$plugin.plugin.zsh" ]]; then
source "$ZSH/plugins/$plugin/$plugin.plugin.zsh"
fi
done done
unset plugin unset plugin
@ -185,3 +218,6 @@ if [[ -n "$ZSH_THEME" ]]; then
echo "[oh-my-zsh] theme '$ZSH_THEME' not found" echo "[oh-my-zsh] theme '$ZSH_THEME' not found"
fi fi
fi fi
# set completion colors to be the same as `ls`, after theme has been loaded
[[ -z "$LS_COLORS" ]] || zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"

View file

@ -14,16 +14,18 @@ clipboard.
## `opswd` ## `opswd`
The `opswd` command is a wrapper around the `op` command. It takes a service The `opswd` command is a wrapper around the `op` command. It takes a service
name as an argument and copies the password for that service to the clipboard. name as an argument and copies the username, then the password for that service
to the clipboard, after confirmation on the user part.
If the service also contains a TOTP, it is copied to the clipboard after 10 seconds. If the service also contains a TOTP, it is copied to the clipboard after confirmation
Finally, after 20 seconds, the clipboard is cleared. on the user part. Finally, after 20 seconds, the clipboard is cleared.
The function has completion support, so you can use tab completion to select For example, `opswd github.com` will put your GitHub username into your clipboard. Then,
which service you want to get. it will ask for confirmation to continue, and copy the password to your clipboard. Finally,
if a TOTP is available, it will be copied to the clipboard after your confirmation.
For example, `opswd github.com` will put your GitHub password into your clipboard, and if This function has completion support, so you can use tab completion to select which
a TOTP is available, it will be copied to the clipboard after 10 seconds. service you want to get.
> NOTE: you need to be signed in for `opswd` to work. If you are using biometric unlock, > NOTE: you need to be signed in for `opswd` to work. If you are using biometric unlock,
> 1Password CLI will automatically prompt you to sign in. See: > 1Password CLI will automatically prompt you to sign in. See:

View file

@ -14,6 +14,17 @@ function opswd() {
# If not logged in, print error and return # If not logged in, print error and return
op user list > /dev/null || return op user list > /dev/null || return
local username
# Copy the username to the clipboard
if ! username=$(op item get "$service" --fields username 2>/dev/null); then
echo "error: could not obtain username for $service"
return 1
fi
echo -n "$username" | clipcopy
echo "✔ username for service $service copied to the clipboard. Press Enter to continue"
read
local password local password
# Copy the password to the clipboard # Copy the password to the clipboard
if ! password=$(op item get "$service" --fields password 2>/dev/null); then if ! password=$(op item get "$service" --fields password 2>/dev/null); then
@ -22,12 +33,13 @@ function opswd() {
fi fi
echo -n "$password" | clipcopy echo -n "$password" | clipcopy
echo "✔ password for $service copied to clipboard" echo "✔ password for $service copied to clipboard. Press Enter to continue"
read
# If there's a one time password, copy it to the clipboard after 10 seconds # If there's a one time password, copy it to the clipboard
local totp local totp
if totp=$(op item get --otp "$service" 2>/dev/null) && [[ -n "$totp" ]]; then if totp=$(op item get --otp "$service" 2>/dev/null) && [[ -n "$totp" ]]; then
sleep 10 && echo -n "$totp" | clipcopy echo -n "$totp" | clipcopy
echo "✔ TOTP for $service copied to clipboard" echo "✔ TOTP for $service copied to clipboard"
fi fi

View file

@ -15,8 +15,14 @@ Requirements: Python needs to be installed.
## Usage ## Usage
- `acs`: show all aliases by group. - `acs`: show all aliases by group
- `acs <keyword>`: filter aliases by `<keyword>` and highlight. - `acs -h/--help`: print help mesage
- `acs <keyword(s)>`: filter and highlight aliases by `<keyword>`
- `acs -g <group>/--group <group>`: show only aliases for group `<group>`. Multiple uses of the flag show all groups
- `acs --groups`: show only group names
![screenshot](https://cloud.githubusercontent.com/assets/3602957/11581913/cb54fb8a-9a82-11e5-846b-5a67f67ad9ad.png) ![screenshot](https://cloud.githubusercontent.com/assets/3602957/11581913/cb54fb8a-9a82-11e5-846b-5a67f67ad9ad.png)

View file

@ -1,11 +1,14 @@
# with lots of 3rd-party amazing aliases installed, just need something to explore it quickly. # Handle $0 according to the standard:
# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
# - acs: alias cheatsheet 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
# group alias by command, pass addition argv to grep. 0="${${(M)0:#/*}:-$PWD/$0}"
function acs(){
(( $+commands[python3] )) || { eval '
echo "[error] No python executable detected" function acs(){
return (( $+commands[python3] )) || {
echo "[error] No python executable detected"
return
}
alias | python3 "'"${0:h}"'/cheatsheet.py" "$@"
} }
alias | python3 ${functions_source[$0]:h}/cheatsheet.py $@ '
}

View file

@ -2,6 +2,7 @@
import sys import sys
import itertools import itertools
import termcolor import termcolor
import argparse
def parse(line): def parse(line):
left = line[0:line.find('=')].strip() left = line[0:line.find('=')].strip()
@ -14,6 +15,7 @@ def parse(line):
def cheatsheet(lines): def cheatsheet(lines):
exps = [ parse(line) for line in lines ] exps = [ parse(line) for line in lines ]
exps.sort(key=lambda exp:exp[2])
cheatsheet = {'_default': []} cheatsheet = {'_default': []}
for key, group in itertools.groupby(exps, lambda exp:exp[2]): for key, group in itertools.groupby(exps, lambda exp:exp[2]):
group_list = [ item for item in group ] group_list = [ item for item in group ]
@ -26,7 +28,7 @@ def cheatsheet(lines):
target_aliases.extend(group_list) target_aliases.extend(group_list)
return cheatsheet return cheatsheet
def pretty_print_group(key, aliases, highlight=None): def pretty_print_group(key, aliases, highlight=None, only_groupname=False):
if len(aliases) == 0: if len(aliases) == 0:
return return
group_hl_formatter = lambda g, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'red') for part in ('[%s]' % g).split(hl)]) group_hl_formatter = lambda g, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'red') for part in ('[%s]' % g).split(hl)])
@ -35,21 +37,33 @@ def pretty_print_group(key, aliases, highlight=None):
alias_formatter = lambda alias: termcolor.colored('\t%s = %s' % alias[0:2], 'green') alias_formatter = lambda alias: termcolor.colored('\t%s = %s' % alias[0:2], 'green')
if highlight and len(highlight)>0: if highlight and len(highlight)>0:
print (group_hl_formatter(key, highlight)) print (group_hl_formatter(key, highlight))
print ('\n'.join([alias_hl_formatter(alias, highlight) for alias in aliases])) if not only_groupname:
print ('\n'.join([alias_hl_formatter(alias, highlight) for alias in aliases]))
else: else:
print (group_formatter(key)) print (group_formatter(key))
print ('\n'.join([alias_formatter(alias) for alias in aliases])) if not only_groupname:
print ('\n'.join([alias_formatter(alias) for alias in aliases]))
print ('') print ('')
def pretty_print(cheatsheet, wfilter): def pretty_print(cheatsheet, wfilter, group_list=None, groups_only=False):
sorted_key = sorted(cheatsheet.keys()) sorted_key = sorted(cheatsheet.keys())
for key in sorted_key: for key in sorted_key:
if group_list and key not in group_list:
continue
aliases = cheatsheet.get(key) aliases = cheatsheet.get(key)
if not wfilter: if not wfilter:
pretty_print_group(key, aliases, wfilter) pretty_print_group(key, aliases, wfilter, groups_only)
else: else:
pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter) pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter)
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Pretty print aliases.", prog="acs")
parser.add_argument('filter', nargs="*", metavar="<keyword>", help="search aliases matching keywords")
parser.add_argument('-g', '--group', dest="group_list", action='append', help="only print aliases in given groups")
parser.add_argument('--groups', dest='groups_only', action='store_true', help="only print alias groups")
args = parser.parse_args()
lines = sys.stdin.readlines() lines = sys.stdin.readlines()
pretty_print(cheatsheet(lines), sys.argv[1] if len(sys.argv)>1 else None) group_list = args.group_list or None
wfilter = " ".join(args.filter) or None
pretty_print(cheatsheet(lines), wfilter, group_list, args.groups_only)

20
plugins/argocd/README.md Normal file
View file

@ -0,0 +1,20 @@
# Argo CD plugin
This plugin adds completion for the [Argo CD](https://argoproj.github.io/cd/) CLI.
To use it, add `argocd` to the plugins array in your zshrc file:
```zsh
plugins=(... argocd)
```
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/_argocd` completions script

View file

@ -0,0 +1,14 @@
# Autocompletion for argocd.
if (( ! $+commands[argocd] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `argocd`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_argocd" ]]; then
typeset -g -A _comps
autoload -Uz _argocd
_comps[argocd]=_argocd
fi
argocd completion zsh >| "$ZSH_CACHE_DIR/completions/_argocd" &|

View file

@ -6,22 +6,25 @@ Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable ve
### Installation ### Installation
1. Enable the plugin by adding it to your `plugins` definition in `~/.zshrc`. 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) plugins=(asdf)
``` ```
2. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following:
```
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
```
### Usage ### Usage
See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf: See the [asdf documentation](https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin) for information on how to use asdf:
``` ```
asdf plugin-add nodejs git@github.com:asdf-vm/asdf-nodejs.git asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf install nodejs 5.9.1 asdf install nodejs latest
asdf global nodejs latest
asdf local nodejs latest
``` ```

View file

@ -1,17 +1,18 @@
declare -a autojump_paths declare -a autojump_paths
autojump_paths=( autojump_paths=(
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
$HOME/.autojump/share/autojump/autojump.zsh # manual installation $HOME/.autojump/share/autojump/autojump.zsh # manual installation
$HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation $HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation /run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package /usr/share/autojump/autojump.zsh # Debian and Ubuntu package
/etc/profile.d/autojump.zsh # manual installation /etc/profile.d/autojump.zsh # manual installation
/etc/profile.d/autojump.sh # Gentoo installation /etc/profile.d/autojump.sh # Gentoo installation
/usr/local/share/autojump/autojump.zsh # FreeBSD installation /usr/local/share/autojump/autojump.zsh # FreeBSD installation
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation /usr/pkg/share/autojump/autojump.zsh # NetBSD installation
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default) /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs) /opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
) )
for file in $autojump_paths; do for file in $autojump_paths; do

View file

@ -1,7 +1,7 @@
# aws # aws
This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html) This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html)
and a few utilities to manage AWS profiles and display them in the prompt. and a few utilities to manage AWS profiles/regions and display them in the prompt.
To use it, add `aws` to the plugins array in your zshrc file. To use it, add `aws` to the plugins array in your zshrc file.
@ -12,10 +12,13 @@ plugins=(... aws)
## Plugin commands ## Plugin commands
* `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`. * `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`.
Run `asp` without arguments to clear the profile. Run `asp` without arguments to clear the profile.
* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection. * `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
* `asr [<region>]`: sets `$AWS_REGION` and `$AWS_DEFAULT_REGION` (legacy) to `<region>`.
Run `asr` without arguments to clear the profile.
* `acp [<profile>] [<mfa_token>]`: in addition to `asp` functionality, it actually changes * `acp [<profile>] [<mfa_token>]`: in addition to `asp` functionality, it actually changes
the profile by assuming the role specified in the `<profile>` configuration. It supports the profile by assuming the role specified in the `<profile>` configuration. It supports
MFA and sets `$AWS_ACCESS_KEY_ID`, `$AWS_SECRET_ACCESS_KEY` and `$AWS_SESSION_TOKEN`, if MFA and sets `$AWS_ACCESS_KEY_ID`, `$AWS_SECRET_ACCESS_KEY` and `$AWS_SESSION_TOKEN`, if
@ -25,25 +28,34 @@ plugins=(... aws)
* `agp`: gets the current value of `$AWS_PROFILE`. * `agp`: gets the current value of `$AWS_PROFILE`.
* `agr`: gets the current value of `$AWS_REGION`.
* `aws_change_access_key`: changes the AWS access key of a profile. * `aws_change_access_key`: changes the AWS access key of a profile.
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`). * `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
Used to provide completion for the `asp` function. Used to provide completion for the `asp` function.
* `aws_regions`: lists the available regions.
Used to provide completion for the `asr` function.
## Plugin options ## Plugin options
* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT. * Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT.
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
see the AWS profile prompt. see the AWS profile/region prompt.
## Theme ## Theme
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
the current `$AWS_PROFILE`. It uses two variables to control how that is shown: the current `$AWS_PROFILE` and `$AWS_REGION`. It uses four variables to control how that is shown:
* ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`. * ZSH_THEME_AWS_PROFILE_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`.
* ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`. * ZSH_THEME_AWS_PROFILE_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`.
* ZSH_THEME_AWS_REGION_PREFIX: sets the prefix of the AWS_REGION. Defaults to `<region:`.
* ZSH_THEME_AWS_REGION_SUFFIX: sets the suffix of the AWS_REGION. Defaults to `>`.
## Configuration ## Configuration

View file

@ -2,10 +2,14 @@ function agp() {
echo $AWS_PROFILE echo $AWS_PROFILE
} }
function agr() {
echo $AWS_REGION
}
# AWS profile selection # AWS profile selection
function asp() { function asp() {
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
echo AWS profile cleared. echo AWS profile cleared.
return return
fi fi
@ -22,11 +26,32 @@ function asp() {
export AWS_PROFILE=$1 export AWS_PROFILE=$1
export AWS_EB_PROFILE=$1 export AWS_EB_PROFILE=$1
export AWS_PROFILE_REGION=$(aws configure get region)
if [[ "$2" == "login" ]]; then if [[ "$2" == "login" ]]; then
aws sso login aws sso login
fi fi
} }
# AWS region selection
function asr() {
if [[ -z "$1" ]]; then
unset AWS_DEFAULT_REGION AWS_REGION
echo AWS region cleared.
return
fi
local -a available_regions
available_regions=($(aws_regions))
if [[ -z "${available_regions[(r)$1]}" ]]; then
echo "${fg[red]}Available regions: \n$(aws_regions)"
return 1
fi
export AWS_REGION=$1
export AWS_DEFAULT_REGION=$1
}
# AWS profile switch # AWS profile switch
function acp() { function acp() {
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
@ -145,11 +170,25 @@ function aws_change_access_key() {
AWS_PAGER="" aws iam list-access-keys AWS_PAGER="" aws iam list-access-keys
} }
function aws_profiles() { function aws_regions() {
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1 if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([-_[:alnum:]\.@]+)\][[:space:]]*$/\2/g' aws ec2 describe-regions |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
else
echo "You must specify a AWS profile."
fi
} }
function aws_profiles() {
aws --no-cli-pager configure list-profiles 2> /dev/null && return
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([^[:space:]]+)\][[:space:]]*$/\2/g'
}
function _aws_regions() {
reply=($(aws_regions))
}
compctl -K _aws_regions asr
function _aws_profiles() { function _aws_profiles() {
reply=($(aws_profiles)) reply=($(aws_profiles))
} }
@ -157,15 +196,22 @@ compctl -K _aws_profiles asp acp aws_change_access_key
# AWS prompt # AWS prompt
function aws_prompt_info() { function aws_prompt_info() {
[[ -n "$AWS_PROFILE" ]] || return local _aws_to_show
echo "${ZSH_THEME_AWS_PREFIX=<aws:}${AWS_PROFILE:gs/%/%%}${ZSH_THEME_AWS_SUFFIX=>}" local region="${AWS_REGION:-${AWS_DEFAULT_REGION:-$AWS_PROFILE_REGION}}"
if [[ -n $AWS_PROFILE ]];then
_aws_to_show+="${ZSH_THEME_AWS_PROFILE_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_PROFILE_SUFFIX:=>}"
fi
if [[ -n $AWS_REGION ]]; then
[[ -n $AWS_PROFILE ]] && _aws_to_show+=" "
_aws_to_show+="${ZSH_THEME_AWS_REGION_PREFIX:=<region:}${region}${ZSH_THEME_AWS_REGION_SUFFIX:=>}"
fi
echo "$_aws_to_show"
} }
if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; then if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; then
RPROMPT='$(aws_prompt_info)'"$RPROMPT" RPROMPT='$(aws_prompt_info)'"$RPROMPT"
fi fi
# Load awscli completions # Load awscli completions
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back # AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
@ -210,3 +256,4 @@ else
[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path [[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
unset _aws_zsh_completer_path _brew_prefix unset _aws_zsh_completer_path _brew_prefix
fi fi

49
plugins/azure/README.md Normal file
View file

@ -0,0 +1,49 @@
# azure
This plugin provides completion support for [azure cli](https://docs.microsoft.com/en-us/cli/azure/)
and a few utilities to manage azure subscriptions and display them in the prompt.
To use it, add `azure` to the plugins array in your zshrc file.
```zsh
plugins=(... azure)
```
## Plugin commands
* `az_subscriptions`: lists the available subscriptions in the `AZURE_CONFIG_DIR` (default: `~/.azure/`).
Used to provide completion for the `azss` function.
* `azgs`: gets the current value of `$azure_subscription`.
* `azss [<subscription>]`: sets the `$azure_subscription`.
NOTE : because azure keeps the state of active subscription in ${AZURE_CONFIG_DIR:-$HOME/.azure/azureProfile.json}, the prompt command requires `jq` to be enabled to parse the file. If jq is not in the path the prompt will show nothing
## Theme
The plugin creates an `azure_prompt_info` function that you can use in your theme, which displays
the current `$azure_subscription`. It uses two variables to control how that is shown:
- ZSH_THEME_AZURE_PREFIX: sets the prefix of the azure_subscription. Defaults to `<az:`.
- ZSH_THEME_azure_SUFFIX: sets the suffix of the azure_subscription. Defaults to `>`.
```
RPROMPT='$(azure_prompt_info)'
```
## Develop
On ubuntu get a working environment with :
` docker run -it -v $(pwd):/mnt -w /mnt ubuntu bash`
```
apt install -y curl jq zsh git vim
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl -sL https://aka.ms/InstallAzureCLIDeb | bash
```

View file

@ -0,0 +1,62 @@
# AZ Get Subscritions
function azgs() {
az account show --output tsv --query 'name' 2>/dev/null
}
# AZ Subscription Selection
alias azss="az account set --subscription"
function az_subscriptions() {
az account list --all --output tsv --query '[*].name' 2> /dev/null
}
function _az_subscriptions() {
reply=($(az_subscriptions))
}
compctl -K _az_subscriptions azss
# Azure prompt
function azure_prompt_info() {
[[ ! -f "${AZURE_CONFIG_DIR:-$HOME/.azure/azureProfile.json}" ]] && return
# azgs is too expensive, if we have jq, we enable the prompt
(( $+commands[jq] )) || return 1
azgs=$(jq -r '.subscriptions[] | select(.isDefault==true) .name' ${AZURE_CONFIG_DIR:-$HOME/.azure/azureProfile.json})
echo "${ZSH_THEME_AZURE_PREFIX:=<az:}${azgs}${ZSH_THEME_AZURE_SUFFIX:=>}"
}
# Load az completions
function _az-homebrew-installed() {
# check if Homebrew is installed
(( $+commands[brew] )) || return 1
# speculatively check default brew prefix
if [[ -d /usr/local ]]; then
_brew_prefix=/usr/local
elif [[ -d /opt/homebrew ]]; then
_brew_prefix=/opt/homebrew
else
# ok, it is not in the default prefix
# this call to brew is expensive (about 400 ms), so at least let's make it only once
_brew_prefix=$(brew --prefix)
fi
}
# get az.completion.sh location from $PATH
_az_zsh_completer_path="$commands[az_zsh_completer.sh]"
# otherwise check common locations
if [[ -z $_az_zsh_completer_path ]]; then
# Homebrew
if _az-homebrew-installed; then
_az_zsh_completer_path=$_brew_prefix/etc/bash_completion.d/az
# Linux
else
_az_zsh_completer_path=/etc/bash_completion.d/azure-cli
fi
fi
[[ -r $_az_zsh_completer_path ]] && autoload -U +X bashcompinit && bashcompinit && source $_az_zsh_completer_path
unset _az_zsh_completer_path _brew_prefix

View file

@ -1,44 +1,79 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
## setup ## ## Setup
[[ -o interactive ]] || return #interactive only! [[ -o interactive ]] || return # don't load on non-interactive shells
zmodload zsh/datetime || { print "can't load zsh/datetime"; return } # faster than date() [[ -z "$SSH_CLIENT" && -z "$SSH_TTY" ]] || return # don't load on a SSH connection
autoload -Uz add-zsh-hook || { print "can't add zsh hook!"; return }
(( ${+bgnotify_threshold} )) || bgnotify_threshold=5 #default 10 seconds zmodload zsh/datetime # faster than `date`
## definitions ## ## Zsh Hooks
if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom function override function bgnotify_begin {
function bgnotify_formatted { ## args: (exit_status, command, elapsed_seconds) bgnotify_timestamp=$EPOCHSECONDS
elapsed="$(( $3 % 60 ))s" bgnotify_lastcmd="${1:-$2}"
(( $3 >= 60 )) && elapsed="$((( $3 % 3600) / 60 ))m $elapsed" }
(( $3 >= 3600 )) && elapsed="$(( $3 / 3600 ))h $elapsed"
[ $1 -eq 0 ] && bgnotify "#win (took $elapsed)" "$2" || bgnotify "#fail (took $elapsed)" "$2" function bgnotify_end {
{
local exit_status=$?
local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
# check time elapsed
[[ $bgnotify_timestamp -gt 0 ]] || return
[[ $elapsed -ge $bgnotify_threshold ]] || return
# check if Terminal app is not active
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return
printf '\a' # beep sound
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
} always {
bgnotify_timestamp=0
} }
fi
currentAppId () {
if (( $+commands[osascript] )); then
osascript -e 'tell application (path to frontmost application as text) to id' 2>/dev/null
fi
} }
currentWindowId () { autoload -Uz add-zsh-hook
if hash osascript 2>/dev/null; then #osx add-zsh-hook preexec bgnotify_begin
osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0" add-zsh-hook precmd bgnotify_end
elif (hash notify-send 2>/dev/null || hash kdialog 2>/dev/null); then #ubuntu!
xprop -root 2> /dev/null | awk '/NET_ACTIVE_WINDOW/{print $5;exit} END{exit !$5}' || echo "0"
## Functions
# allow custom function override
(( ${+functions[bgnotify_formatted]} )) || \
function bgnotify_formatted {
local exit_status=$1
local cmd="$2"
# humanly readable elapsed time
local elapsed="$(( $3 % 60 ))s"
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
if [[ $1 -eq 0 ]]; then
bgnotify "#win (took $elapsed)" "$2"
else else
echo $EPOCHSECONDS #fallback for windows bgnotify "#fail (took $elapsed)" "$2"
fi fi
} }
bgnotify () { ## args: (title, subtitle) # for macOS, output is "app ID, window ID" (com.googlecode.iterm2, 116)
if hash terminal-notifier 2>/dev/null; then #osx function bgnotify_appid {
local term_id="$bgnotify_appid" if (( ${+commands[osascript]} )); then
osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null
elif (( ${+commands[xprop]} )); then
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
else
echo $EPOCHSECONDS
fi
}
function bgnotify {
# $1: title, $2: message
if (( ${+commands[terminal-notifier]} )); then # macOS
local term_id="${bgnotify_termid%%,*}" # remove window id
if [[ -z "$term_id" ]]; then if [[ -z "$term_id" ]]; then
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
iTerm.app) term_id='com.googlecode.iterm2' ;; iTerm.app) term_id='com.googlecode.iterm2' ;;
@ -46,48 +81,26 @@ bgnotify () { ## args: (title, subtitle)
esac esac
fi fi
## now call terminal-notifier, (hopefully with $term_id!)
if [[ -z "$term_id" ]]; then if [[ -z "$term_id" ]]; then
terminal-notifier -message "$2" -title "$1" >/dev/null terminal-notifier -message "$2" -title "$1" &>/dev/null
else else
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" &>/dev/null
fi fi
elif hash growlnotify 2>/dev/null; then #osx growl elif (( ${+commands[growlnotify]} )); then # macOS growl
growlnotify -m "$1" "$2" growlnotify -m "$1" "$2"
elif hash notify-send 2>/dev/null; then #ubuntu gnome! elif (( ${+commands[notify-send]} )); then # GNOME
notify-send "$1" "$2" notify-send "$1" "$2"
elif hash kdialog 2>/dev/null; then #ubuntu kde! elif (( ${+commands[kdialog]} )); then # KDE
kdialog --title "$1" --passivepopup "$2" 5 kdialog --title "$1" --passivepopup "$2" 5
elif hash notifu 2>/dev/null; then #cygwyn support! elif (( ${+commands[notifu]} )); then # cygwin
notifu /m "$2" /p "$1" notifu /m "$2" /p "$1"
fi fi
} }
## Defaults
## Zsh hooks ## # notify if command took longer than 5s by default
bgnotify_threshold=${bgnotify_threshold:-5}
bgnotify_begin() { # bgnotify_appid is slow in macOS and the terminal ID won't change, so cache it at startup
bgnotify_timestamp=$EPOCHSECONDS bgnotify_termid="$(bgnotify_appid)"
bgnotify_lastcmd="${1:-$2}"
bgnotify_appid="$(currentAppId)"
bgnotify_windowid=$(currentWindowId)
}
bgnotify_end() {
didexit=$?
elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
past_threshold=$(( elapsed >= bgnotify_threshold ))
if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then
if [[ $(currentAppId) != "$bgnotify_appid" || $(currentWindowId) != "$bgnotify_windowid" ]]; then
print -n "\a"
bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed"
fi
fi
bgnotify_timestamp=0 #reset it to 0!
}
## only enable if a local (non-ssh) connection
if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then
add-zsh-hook preexec bgnotify_begin
add-zsh-hook precmd bgnotify_end
fi

View file

@ -8,19 +8,28 @@ To use it, add `brew` to the plugins array of your zshrc file:
plugins=(... brew) plugins=(... brew)
``` ```
## Shellenv
If `brew` is not found in the PATH, this plugin will attempt to find it in common
locations, and execute `brew shellenv` to set the environment appropriately.
This plugin will also export `HOMEBREW_PREFIX="$(brew --prefix)"` if not previously
defined for convenience.
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|----------|---------------------------------------|---------------------------------------------------------------------| | -------- | --------------------------------------- | ------------------------------------------------------------------- |
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. | | `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. |
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. | | `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. | | `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. | | `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. | | `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
| `bubu` | `bubo && bubc` | Do the last two operations above. | | `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. |
| `buf` | `brew upgrade --formula` | Upgrade only formulas (not casks). | | `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. | | `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. | | `bubu` | `bubo && bubc` | Do the last two operations above. |
| `bfu` | `brew upgrade --formula` | Upgrade only formulas (not casks). |
| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
## Completion ## Completion

View file

@ -1,15 +1,46 @@
alias brewp='brew pin' if (( ! $+commands[brew] )); then
alias brewsp='brew list --pinned' if [[ -x /opt/homebrew/bin/brew ]]; then
alias bubo='brew update && brew outdated' BREW_LOCATION="/opt/homebrew/bin/brew"
alias bubc='brew upgrade && brew cleanup' elif [[ -x /usr/local/bin/brew ]]; then
alias bubu='bubo && bubc' BREW_LOCATION="/usr/local/bin/brew"
alias buf='brew upgrade --formula' elif [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
BREW_LOCATION="/home/linuxbrew/.linuxbrew/bin/brew"
elif [[ -x "$HOME/.linuxbrew/bin/brew" ]]; then
BREW_LOCATION="$HOME/.linuxbrew/bin/brew"
else
return
fi
# Only add Homebrew installation to PATH, MANPATH, and INFOPATH if brew is
# not already on the path, to prevent duplicate entries. This aligns with
# the behavior of the brew installer.sh post-install steps.
eval "$("$BREW_LOCATION" shellenv)"
unset BREW_LOCATION
fi
if [[ -z "$HOMEBREW_PREFIX" ]]; then
# Maintain compatability 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)"
fi
alias bcubc='brew upgrade --cask && brew cleanup'
alias bcubo='brew update && brew outdated --cask' alias bcubo='brew update && brew outdated --cask'
alias bcubc='brew upgrade --cask && brew cleanup' alias bcubc='brew upgrade --cask && brew cleanup'
alias brewp='brew pin'
alias brewsp='brew list --pinned'
alias bubc='brew upgrade && brew cleanup'
alias bugbc='brew upgrade --greedy && brew cleanup'
alias bubo='brew update && brew outdated'
alias bubu='bubo && bubc'
alias bubug='bubo && bugbc'
alias bfu='brew upgrade --formula'
alias buz='brew uninstall --zap'
function brews() { function brews() {
local formulae="$(brew leaves | xargs brew deps --installed --for-each)" local formulae="$(brew leaves | xargs brew deps --installed --for-each)"
local casks="$(brew list --cask)" local casks="$(brew list --cask 2>/dev/null)"
local blue="$(tput setaf 4)" local blue="$(tput setaf 4)"
local bold="$(tput bold)" local bold="$(tput bold)"

View file

@ -0,0 +1,26 @@
# Bridgetown plugin
This plugin adds some aliases and autocompletion for common [Bridgetown](https://bridgetownrb.com/) commands.
To use it, add `bridgetown` to the plugins array in your zshrc file:
```zsh
plugins=(... bridgetown)
```
## Aliases
| Alias | Command |
|-------|----------------------------|
| br | `bridgetown` |
| bra | `bin/bridgetown apply` |
| brb | `bin/bridgetown build` |
| brc | `bin/bridgetown console` |
| brclean | `bin/bridgetown clean` |
| brd | `bin/bridgetown deploy` |
| brdoc | `bin/bridgetown doctor` |
| brh | `bin/bridgetown help` |
| brn | `bridgetown new` |
| brp | `bridgetown plugins` |
| brpl | `bridgetown plugins list` |
| brs | `bin/bridgetown start` |

View file

@ -0,0 +1,12 @@
alias br='bridgetown'
alias bra='bin/bridgetown apply'
alias brb='bin/bridgetown build'
alias brc='bin/bridgetown console'
alias brclean='bin/bridgetown clean'
alias brd='bin/bridgetown deploy'
alias brdoc='bin/bridgetown doctor'
alias brh='bin/bridgetown help'
alias brn='bridgetown new'
alias brp='bridgetown plugins'
alias brpl='bridgetown plugins list'
alias brs='bin/bridgetown start'

View file

@ -1,10 +1,10 @@
# CakePHP 3 basic command completion # CakePHP 3 basic command completion
_cakephp3_get_command_list () { _cakephp3_get_command_list () {
bin/cake Completion commands bin/cake completion commands
} }
_cakephp3_get_sub_command_list () { _cakephp3_get_sub_command_list () {
bin/cake Completion subcommands ${words[2]} bin/cake completion subcommands ${words[2]}
} }
_cakephp3_get_3rd_argument () { _cakephp3_get_3rd_argument () {
@ -34,5 +34,5 @@ compdef _cakephp3 cake
#Alias #Alias
alias c3='bin/cake' alias c3='bin/cake'
alias c3cache='bin/cake orm_cache clear' alias c3cache='bin/cake schema_cache clear'
alias c3migrate='bin/cake migrations migrate' alias c3migrate='bin/cake migrations migrate'

View file

@ -1,3 +0,0 @@
# cargo
**Deprecated: use the [`rust`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/rust) plugin instead.**

View file

@ -1,7 +0,0 @@
print ${(%):-'%F{yellow}The `cargo` plugin is deprecated and has been moved to the `rust` plugin.'}
print ${(%):-'Please update your .zshrc to use the `%Brust%b` plugin instead.%f'}
(( ${fpath[(Ie)$ZSH/plugins/rust]} )) || {
fpath=("$ZSH/plugins/rust" $fpath)
source "$ZSH/plugins/rust/rust.plugin.zsh"
}

View file

@ -1,6 +1,6 @@
#compdef coffee #compdef coffee
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - https://github.com/zsh-users # Copyright (c) 2011 GitHub zsh-users - https://github.com/zsh-users
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

View file

@ -23,7 +23,7 @@ colorize_check_requirements() {
if [[ ${available_tools[(Ie)$ZSH_COLORIZE_TOOL]} -eq 0 ]]; then if [[ ${available_tools[(Ie)$ZSH_COLORIZE_TOOL]} -eq 0 ]]; then
echo "ZSH_COLORIZE_TOOL '$ZSH_COLORIZE_TOOL' not recognized. Available options are 'pygmentize' and 'chroma'." >&2 echo "ZSH_COLORIZE_TOOL '$ZSH_COLORIZE_TOOL' not recognized. Available options are 'pygmentize' and 'chroma'." >&2
return 1 return 1
elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then elif ! (( $+commands[$ZSH_COLORIZE_TOOL] )); then
echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2 echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2
return 1 return 1
fi fi

View file

@ -35,9 +35,11 @@ plugins=(... common-aliases)
| mv | `mv -i` | Move a file | | mv | `mv -i` | Move a file |
| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file | | zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form | | dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
| duf | `du -sh` | Display the size of files in current location in human-readable form | | duf\* | `du -sh` | Display the size of files in current location in human-readable form |
| t | `tail -f` | Shorthand for tail which outputs the last part of a file | | t | `tail -f` | Shorthand for tail which outputs the last part of a file |
\* Only if the [`duf`](https://github.com/muesli/duf) command isn't installed.
### find and grep ### find and grep
| Alias | Command | Description | | Alias | Command | Description |
@ -66,12 +68,15 @@ These aliases are expanded in any position in the command line, meaning you can
end of the command you've typed. Examples: end of the command you've typed. Examples:
Quickly pipe to less: Quickly pipe to less:
```zsh ```zsh
$ ls -l /var/log L $ ls -l /var/log L
# will run # will run
$ ls -l /var/log | less $ ls -l /var/log | less
``` ```
Silences stderr output: Silences stderr output:
```zsh ```zsh
$ find . -type f NE $ find . -type f NE
# will run # will run

View file

@ -35,7 +35,7 @@ alias -g NUL="> /dev/null 2>&1"
alias -g P="2>&1| pygmentize -l pytb" alias -g P="2>&1| pygmentize -l pytb"
alias dud='du -d 1 -h' alias dud='du -d 1 -h'
alias duf='du -sh *' (( $+commands[duf] )) || alias duf='du -sh *'
(( $+commands[fd] )) || alias fd='find . -type d -name' (( $+commands[fd] )) || alias fd='find . -type d -name'
alias ff='find . -type f -name' alias ff='find . -type f -name'

View file

@ -1,7 +1,7 @@
# `copybuffer` plugin # `copybuffer` plugin
This plugin binds the ctrl-o keyboard shortcut to a command that copies the text This plugin adds the <kbd>ctrl-o</kbd> keyboard shortcut to copy the current text
that is currently typed in the command line ($BUFFER) to the system clipboard. in the command line to the system clipboard.
This is useful if you type a command - and before you hit enter to execute it - want This is useful if you type a command - and before you hit enter to execute it - want
to copy it maybe so you can paste it into a script, gist or whatnot. to copy it maybe so you can paste it into a script, gist or whatnot.

View file

@ -1,3 +0,0 @@
# copydir plugin
This plugin is deprecated. Use the [`copypath` plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copypath) instead.

View file

@ -1,7 +0,0 @@
echo ${(%):-'%F{yellow}The `%Bcopydir%b` plugin is deprecated. Use the `%Bcopypath%b` plugin instead.%f'}
source "$ZSH/plugins/copypath/copypath.plugin.zsh"
# TODO: 2022-02-22: Remove deprecated copydir function.
function copydir {
copypath
}

View file

@ -21,7 +21,7 @@ Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh
| ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- | | ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- |
| `age` | `apt-get` | Command line tool for handling packages | | `age` | `apt-get` | Command line tool for handling packages |
| `api` | `aptitude` | Same functionality as `apt-get`, provides extra options | | `api` | `aptitude` | Same functionality as `apt-get`, provides extra options |
| `acs` | `apt-cache search` | Command line tool for searching apt software package cache | | `acse` | `apt-cache search` | Command line tool for searching apt software package cache |
| `aps` | `aptitude search` | Searches installed packages using aptitude | | `aps` | `aptitude search` | Searches installed packages using aptitude |
| `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format | | `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format |
| `afs` | `apt-file search --regexp` | Search file in packages | | `afs` | `apt-file search --regexp` | Search file in packages |
@ -30,26 +30,25 @@ Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh
## Superuser Operations Aliases ## Superuser Operations Aliases
| Alias | Command | Description | | Alias | Command | Description |
| -------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | | -------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| `aac` | `sudo $apt_pref autoclean` | Clears out the local repository of retrieved package files | | `aac` | `sudo $apt_pref autoclean` | Clears out the local repository of retrieved package files |
| `aar` | `sudo $apt_pref autoremove` | Removes packages installed automatically that are no longer needed | | `aar` | `sudo $apt_pref autoremove` | Removes packages installed automatically that are no longer needed |
| `abd` | `sudo $apt_pref build-dep` | Installs all dependencies for building packages | | `abd` | `sudo $apt_pref build-dep` | Installs all dependencies for building packages |
| `ac` | `sudo $apt_pref clean` | Clears out the local repository of retrieved package files except lock files | | `ac` | `sudo $apt_pref clean` | Clears out the local repository of retrieved package files except lock files |
| `ad` | `sudo $apt_pref update` | Updates the package lists for upgrades for packages | | `ad` | `sudo $apt_pref update` | Updates the package lists for upgrades for packages |
| `adg` | `sudo $apt_pref update && sudo $apt_pref $apt_upgr` | Update and upgrade packages | | `adg` | `sudo $apt_pref update && sudo $apt_pref $apt_upgr` | Update and upgrade packages |
| `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list | | `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list |
| `adu` | `sudo $apt_pref update && sudo $apt_pref dist-upgrade` | Smart upgrade that handles dependencies | | `adu` | `sudo $apt_pref update && sudo $apt_pref dist-upgrade` | Smart upgrade that handles dependencies |
| `afu` | `sudo apt-file update` | Update the files in packages | | `afu` | `sudo apt-file update` | Update the files in packages |
| `ai` | `sudo $apt_pref install` | Command-line tool to install package | | `ai` | `sudo $apt_pref install` | Command-line tool to install package |
| `ail` | `sed -e 's/ */ /g' -e 's/ *//' \| cut -s -d ' ' -f 1 \| xargs sudo $apt_pref install` | Install all packages given on the command line while using only the first word of each line | | `ail` | `sed -e 's/ */ /g' -e 's/ *//' \| cut -s -d ' ' -f 1 \| xargs sudo $apt_pref install` | Install all packages given on the command line while using only the first word of each line |
| `alu` | `sudo apt update && apt list -u && sudo apt upgrade` | Update, list and upgrade packages | | `alu` | `sudo apt update && apt list -u && sudo apt upgrade` | Update, list and upgrade packages |
| `ap` | `sudo $apt_pref purge` | Removes packages along with configuration files | | `ap` | `sudo $apt_pref purge` | Removes packages along with configuration files |
| `ar` | `sudo $apt_pref remove` | Removes packages, keeps the configuration files | | `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades |
| `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades | | `di` | `sudo dpkg -i` | Install all .deb files in the current directory |
| `di` | `sudo dpkg -i` | Install all .deb files in the current directory | | `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory |
| `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory | | `kclean` | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use |
| `kclean` | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use |
## Aliases - Commands using `su` ## Aliases - Commands using `su`

View file

@ -26,7 +26,7 @@ alias age='apt-get'
alias api='aptitude' alias api='aptitude'
# Some self-explanatory aliases # Some self-explanatory aliases
alias acs="apt-cache search" alias acse="apt-cache search"
alias aps='aptitude search' alias aps='aptitude search'
alias as="aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search" alias as="aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search"
@ -51,11 +51,10 @@ if [[ $use_sudo -eq 1 ]]; then
alias au="sudo $apt_pref $apt_upgr" alias au="sudo $apt_pref $apt_upgr"
alias ai="sudo $apt_pref install" alias ai="sudo $apt_pref install"
# Install all packages given on the command line while using only the first word of each line: # Install all packages given on the command line while using only the first word of each line:
# acs ... | ail # acse ... | ail
alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | xargs sudo $apt_pref install" alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | xargs sudo $apt_pref install"
alias ap="sudo $apt_pref purge" alias ap="sudo $apt_pref purge"
alias ar="sudo $apt_pref remove"
alias aar="sudo $apt_pref autoremove" alias aar="sudo $apt_pref autoremove"
# apt-get only # apt-get only
@ -89,22 +88,17 @@ else
alias afu="su -lc '$apt-file update'" alias afu="su -lc '$apt-file update'"
alias au="su -lc '$apt_pref $apt_upgr' root" alias au="su -lc '$apt_pref $apt_upgr' root"
function ai() { function ai() {
cmd="su -lc 'aptitude -P install $@' root" cmd="su -lc '$apt_pref install $@' root"
print "$cmd" print "$cmd"
eval "$cmd" eval "$cmd"
} }
function ap() { function ap() {
cmd="su -lc '$apt_pref -P purge $@' root" cmd="su -lc '$apt_pref purge $@' root"
print "$cmd"
eval "$cmd"
}
function ar() {
cmd="su -lc '$apt_pref -P remove $@' root"
print "$cmd" print "$cmd"
eval "$cmd" eval "$cmd"
} }
function aar() { function aar() {
cmd="su -lc '$apt_pref -P autoremove $@' root" cmd="su -lc '$apt_pref autoremove $@' root"
print "$cmd" print "$cmd"
eval "$cmd" eval "$cmd"
} }
@ -147,7 +141,6 @@ apt_pref_compdef au "$apt_upgr"
apt_pref_compdef ai "install" apt_pref_compdef ai "install"
apt_pref_compdef ail "install" apt_pref_compdef ail "install"
apt_pref_compdef ap "purge" apt_pref_compdef ap "purge"
apt_pref_compdef ar "remove"
apt_pref_compdef aar "autoremove" apt_pref_compdef aar "autoremove"
apt_pref_compdef ads "dselect-upgrade" apt_pref_compdef ads "dselect-upgrade"

View file

@ -1,6 +1,6 @@
# Dnote Plugin # Dnote Plugin
This plugin adds auto-completion for [Dnote](https://dnote.io) project. This plugin adds auto-completion for [Dnote](https://www.getdnote.com/), a simple command line notebook.
To use it, add `dnote` to the plugins array in your zshrc file: To use it, add `dnote` to the plugins array in your zshrc file:

View file

@ -11,22 +11,23 @@ plugins=(... docker-compose)
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|-----------|--------------------------------|------------------------------------------------------------------| |-----------|--------------------------------|----------------------------------------------------------------------------------|
| dco | `docker-compose` | Docker-compose main command | | dco | `docker-compose` | Docker-compose main command |
| dcb | `docker-compose build` | Build containers | | dcb | `docker-compose build` | Build containers |
| dce | `docker-compose exec` | Execute command inside a container | | dce | `docker-compose exec` | Execute command inside a container |
| dcps | `docker-compose ps` | List containers | | dcps | `docker-compose ps` | List containers |
| dcrestart | `docker-compose restart` | Restart container | | dcrestart | `docker-compose restart` | Restart container |
| dcrm | `docker-compose rm` | Remove container | | dcrm | `docker-compose rm` | Remove container |
| dcr | `docker-compose run` | Run a command in container | | dcr | `docker-compose run` | Run a command in container |
| dcstop | `docker-compose stop` | Stop a container | | dcstop | `docker-compose stop` | Stop a container |
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service | | dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers | | dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon | | dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
| dcdn | `docker-compose down` | Stop and remove containers | | dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
| dcl | `docker-compose logs` | Show logs of container | | dcdn | `docker-compose down` | Stop and remove containers |
| dclf | `docker-compose logs -f` | Show logs and follow output | | dcl | `docker-compose logs` | Show logs of container |
| dcpull | `docker-compose pull` | Pull image of a service | | dclf | `docker-compose logs -f` | Show logs and follow output |
| dcstart | `docker-compose start` | Start a container | | dcpull | `docker-compose pull` | Pull image of a service |
| dck | `docker-compose kill` | Kills containers | | dcstart | `docker-compose start` | Start a container |
| dck | `docker-compose kill` | Kills containers |

View file

@ -12,6 +12,7 @@ alias dcstop="$dccmd stop"
alias dcup="$dccmd up" alias dcup="$dccmd up"
alias dcupb="$dccmd up --build" alias dcupb="$dccmd up --build"
alias dcupd="$dccmd up -d" alias dcupd="$dccmd up -d"
alias dcupdb="$dccmd up -d --build"
alias dcdn="$dccmd down" alias dcdn="$dccmd down"
alias dcl="$dccmd logs" alias dcl="$dccmd logs"
alias dclf="$dccmd logs -f" alias dclf="$dccmd logs -f"

View file

@ -335,9 +335,9 @@ _docker-machine() {
'--tls-ca-key[Private key to generate certificates]:file:_files' \ '--tls-ca-key[Private key to generate certificates]:file:_files' \
'--tls-client-cert[Client cert to use for TLS]:file:_files' \ '--tls-client-cert[Client cert to use for TLS]:file:_files' \
'--tls-client-key[Private key used in client TLS auth]:file:_files' \ '--tls-client-key[Private key used in client TLS auth]:file:_files' \
'--github-api-token[Token to use for requests to the Github API]' \ '--github-api-token[Token to use for requests to the GitHub API]' \
'--native-ssh[Use the native (Go-based) SSH implementation.]' \ '--native-ssh[Use the native (Go-based) SSH implementation.]' \
'--bugsnag-api-token[BugSnag API token for crash reporting]' \ '--bugsnag-api-token[Bugsnag API token for crash reporting]' \
'(- :)'{-v,--version}'[Print the version]' \ '(- :)'{-v,--version}'[Print the version]' \
"(-): :->command" \ "(-): :->command" \
"(-)*:: :->option-or-argument" && ret=0 "(-)*:: :->option-or-argument" && ret=0

View file

@ -13,18 +13,15 @@ https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
## Settings ## Settings
By default, the completion doesn't allow option-stacking, meaning if you try to By default, the completion doesn't allow option-stacking, meaning if you try to complete
complete `docker run -it <TAB>` it won't work, because you're _stacking_ the `docker run -it <TAB>` it won't work, because you're _stacking_ the `-i` and `-t` options.
`-i` and `-t` options.
[You can enable it](https://github.com/docker/cli/commit/b10fb43048) by **adding [You can enable it](https://github.com/docker/cli/commit/b10fb43048) by **adding the lines below to your zshrc
the lines below to your zshrc file**, but be aware of the side effects: file**, but be aware of the side effects:
> This enables Zsh to understand commands like `docker run -it > This enables Zsh to understand commands like `docker run -it ubuntu`. However, by enabling this, this also
> ubuntu`. However, by enabling this, this also makes Zsh complete > makes Zsh complete `docker run -u<tab>` with `docker run -uapprox` which is not valid. The users have to put
> `docker run -u<tab>` with `docker run -uapprox` which is not valid. The > the space or the equal sign themselves before trying to complete.
> users have to put the space or the equal sign themselves before trying
> to complete.
> >
> Therefore, this behavior is disabled by default. To enable it: > Therefore, this behavior is disabled by default. To enable it:
> >
@ -35,39 +32,38 @@ the lines below to your zshrc file**, but be aware of the side effects:
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
| :------ | :-------------------------- | :--------------------------------------------------------------------------------------- | | :------ | :---------------------------- | :--------------------------------------------------------------------------------------- |
| dbl | `docker build` | Build an image from a Dockerfile | | dbl | `docker build` | Build an image from a Dockerfile |
| dcin | `docker container inspect` | Display detailed information on one or more containers | | dcin | `docker container inspect` | Display detailed information on one or more containers |
| dlo | `docker container logs` | Fetch the logs of a docker container | | dcls | `docker container ls` | List all the running docker containers |
| dcls | `docker container ls` | List all the running docker containers | | dclsa | `docker container ls -a` | List all running and stopped containers |
| dclsa | `docker container ls -a` | List all running and stopped containers | | dib | `docker image build` | Build an image from a Dockerfile (same as docker build) |
| dpo | `docker container port` | List port mappings or a specific mapping for the container | | dii | `docker image inspect` | Display detailed information on one or more images |
| dpu | `docker pull` | Pull an image or a repository from a registry | | dils | `docker image ls` | List docker images |
| dr | `docker container run` | Create a new container and start it using the specified command | | dipu | `docker image push` | Push an image or repository to a remote registry |
| drit | `docker container run -it` | Create a new container and start it in an interactive shell | | dirm | `docker image rm` | Remove one or more images |
| drm | `docker container rm` | Remove the specified container(s) | | dit | `docker image tag` | Add a name and tag to a particular image |
| drm! | `docker container rm -f` | Force the removal of a running container (uses SIGKILL) | | dlo | `docker container logs` | Fetch the logs of a docker container |
| dst | `docker container start` | Start one or more stopped containers | | dnc | `docker network create` | Create a new network |
| dstp | `docker container stop` | Stop one or more running containers | | dncn | `docker network connect` | Connect a container to a network |
| dtop | `docker top` | Display the running processes of a container | | dndcn | `docker network disconnect` | Disconnect a container from a network |
| dxc | `docker container exec` | Run a new command in a running container | | dni | `docker network inspect` | Return information about one or more networks |
| dxcit | `docker container exec -it` | Run a new command in a running container in an interactive shell | | dnls | `docker network ls` | List all networks the engine daemon knows about, including those spanning multiple hosts |
| | | **Docker Images** | | dnrm | `docker network rm` | Remove one or more networks |
| dib | `docker image build` | Build an image from a Dockerfile (same as docker build) | | dpo | `docker container port` | List port mappings or a specific mapping for the container |
| dii | `docker image inspect` | Display detailed information on one or more images | | dpu | `docker pull` | Pull an image or a repository from a registry |
| dils | `docker image ls` | List docker images | | dr | `docker container run` | Create a new container and start it using the specified command |
| dip | `docker image push` | Push an image or repository to a remote registry | | drit | `docker container run -it` | Create a new container and start it in an interactive shell |
| dirm | `docker image rm` | Remove one or more images | | drm | `docker container rm` | Remove the specified container(s) |
| dit | `docker image tag` | Add a name and tag to a particular image | | drm! | `docker container rm -f` | Force the removal of a running container (uses SIGKILL) |
| | | **Docker Network** | | dst | `docker container start` | Start one or more stopped containers |
| dnc | `docker network create` | Create a new network | | drs | `docker container restart` | Restart one or more containers
| dncn | `docker network connect` | Connect a container to a network | | dsta | `docker stop $(docker ps -q)` | Stop all running containers |
| dndcn | `docker network disconnect` | Disconnect a container from a network | | dstp | `docker container stop` | Stop one or more running containers |
| dni | `docker network inspect` | Return information about one or more networks | | dtop | `docker top` | Display the running processes of a container |
| dnls | `docker network ls` | List all networks the engine daemon knows about, including those spanning multiple hosts | | dvi | `docker volume inspect` | Display detailed information about one or more volumes |
| dnrm | `docker network rm` | Remove one or more networks | | dvls | `docker volume ls` | List all the volumes known to docker |
| | | **Docker Volume** | | dvprune | `docker volume prune` | Cleanup dangling volumes |
| dvi | `docker volume inspect` | Display detailed information about one or more volumes | | dxc | `docker container exec` | Run a new command in a running container |
| dvls | `docker volume ls` | List all the volumes known to docker | | dxcit | `docker container exec -it` | Run a new command in a running container in an interactive shell |
| dvprune | `docker volume prune` | Cleanup dangling volumes |

View file

@ -567,7 +567,7 @@ __docker_container_commands() {
"cp:Copy files/folders between a container and the local filesystem" "cp:Copy files/folders between a container and the local filesystem"
"create:Create a new container" "create:Create a new container"
"diff:Inspect changes on a container's filesystem" "diff:Inspect changes on a container's filesystem"
"exec:Run a command in a running container" "exec:Execute a command in a running container"
"export:Export a container's filesystem as a tar archive" "export:Export a container's filesystem as a tar archive"
"inspect:Display detailed information on one or more containers" "inspect:Display detailed information on one or more containers"
"kill:Kill one or more running containers" "kill:Kill one or more running containers"
@ -579,7 +579,7 @@ __docker_container_commands() {
"rename:Rename a container" "rename:Rename a container"
"restart:Restart one or more containers" "restart:Restart one or more containers"
"rm:Remove one or more containers" "rm:Remove one or more containers"
"run:Run a command in a new container" "run:Create and run a new container from an image"
"start:Start one or more stopped containers" "start:Start one or more stopped containers"
"stats:Display a live stream of container(s) resource usage statistics" "stats:Display a live stream of container(s) resource usage statistics"
"stop:Stop one or more running containers" "stop:Stop one or more running containers"
@ -650,6 +650,7 @@ __docker_container_subcommand() {
"($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports" "($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports"
"($help)--pid=[PID namespace to use]:PID namespace:__docker_complete_pid" "($help)--pid=[PID namespace to use]:PID namespace:__docker_complete_pid"
"($help)--privileged[Give extended privileges to this container]" "($help)--privileged[Give extended privileges to this container]"
"($help -q --quiet)"{-q,--quiet}"[Suppress the pull output]"
"($help)--read-only[Mount the container's root filesystem as read only]" "($help)--read-only[Mount the container's root filesystem as read only]"
"($help)*--security-opt=[Security options]:security option: " "($help)*--security-opt=[Security options]:security option: "
"($help)*--shm-size=[Size of '/dev/shm' (format is '<number><unit>')]:shm size: " "($help)*--shm-size=[Size of '/dev/shm' (format is '<number><unit>')]:shm size: "
@ -802,7 +803,7 @@ __docker_container_subcommand() {
"($help -a --all)"{-a,--all}"[Show all containers]" \ "($help -a --all)"{-a,--all}"[Show all containers]" \
"($help)--before=[Show only container created before...]:containers:__docker_complete_containers" \ "($help)--before=[Show only container created before...]:containers:__docker_complete_containers" \
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_ps_filters" \ "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_ps_filters" \
"($help)--format=[Pretty-print containers using a Go template]:template: " \ "($help)--format=[Format the output using the given Go template]:template: " \
"($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \
"($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
@ -907,7 +908,7 @@ __docker_container_subcommand() {
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \ "($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \
"($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--format=[Format the output using the given Go template]:template: " \
"($help)--no-stream[Disable streaming stats and only pull the first result]" \ "($help)--no-stream[Disable streaming stats and only pull the first result]" \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help -)*:containers:__docker_complete_running_containers" && ret=0 "($help -)*:containers:__docker_complete_running_containers" && ret=0
@ -973,8 +974,8 @@ __docker_image_commands() {
"load:Load an image from a tar archive or STDIN" "load:Load an image from a tar archive or STDIN"
"ls:List images" "ls:List images"
"prune:Remove unused images" "prune:Remove unused images"
"pull:Pull an image or a repository from a registry" "pull:Download an image from a registry"
"push:Push an image or a repository to a registry" "push:Upload an image to a registry"
"rm:Remove one or more images" "rm:Remove one or more images"
"save:Save one or more images to a tar archive (streamed to STDOUT by default)" "save:Save one or more images to a tar archive (streamed to STDOUT by default)"
"tag:Tag an image into a repository" "tag:Tag an image into a repository"
@ -1060,7 +1061,7 @@ __docker_image_subcommand() {
"($help -a --all)"{-a,--all}"[Show all images]" \ "($help -a --all)"{-a,--all}"[Show all images]" \
"($help)--digests[Show digests]" \ "($help)--digests[Show digests]" \
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \ "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \
"($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--format=[Format the output using the given Go template]:template: " \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
"($help -): :__docker_complete_repositories" && ret=0 "($help -): :__docker_complete_repositories" && ret=0
@ -1082,7 +1083,7 @@ __docker_image_subcommand() {
(push) (push)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \ "($help -a --all-tags)"{-a,--all-tags}"[Push all tags of an image to the repository]" \
"($help)--disable-content-trust[Skip image signing]" \ "($help)--disable-content-trust[Skip image signing]" \
"($help -): :__docker_complete_images" && ret=0 "($help -): :__docker_complete_images" && ret=0
;; ;;
@ -1292,7 +1293,7 @@ __docker_network_subcommand() {
$opts_help \ $opts_help \
"($help)--no-trunc[Do not truncate the output]" \ "($help)--no-trunc[Do not truncate the output]" \
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \
"($help)--format=[Pretty-print networks using a Go template]:template: " \ "($help)--format=[Format the output using the given Go template]:template: " \
"($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0 "($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0
;; ;;
(prune) (prune)
@ -2050,7 +2051,7 @@ __docker_service_subcommand() {
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_service_complete_ls_filters" \ "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_service_complete_ls_filters" \
"($help)--format=[Pretty-print services using a Go template]:template: " \ "($help)--format=[Format the output using the given Go template]:template: " \
"($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0
;; ;;
(rm|remove) (rm|remove)
@ -2253,7 +2254,7 @@ __docker_stack_subcommand() {
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_services_filters" \ "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_services_filters" \
"($help)--format=[Pretty-print services using a Go template]:template: " \ "($help)--format=[Format the output using the given Go template]:template: " \
"($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \ "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \
"($help -):stack:__docker_complete_stacks" && ret=0 "($help -):stack:__docker_complete_stacks" && ret=0
;; ;;
@ -2520,7 +2521,7 @@ __docker_volume_subcommand() {
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_volume_complete_ls_filters" \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_volume_complete_ls_filters" \
"($help)--format=[Pretty-print volumes using a Go template]:template: " \ "($help)--format=[Format the output using the given Go template]:template: " \
"($help -q --quiet)"{-q,--quiet}"[Only display volume names]" && ret=0 "($help -q --quiet)"{-q,--quiet}"[Only display volume names]" && ret=0
;; ;;
(prune) (prune)
@ -2582,10 +2583,8 @@ __docker_context_subcommand() {
(create) (create)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help)--default-stack-orchestrator=[Default orchestrator for stack operations to use with this context]:default-stack-orchestrator:(swarm kubernetes all)" \
"($help)--description=[Description of the context]:description:" \ "($help)--description=[Description of the context]:description:" \
"($help)--docker=[Set the docker endpoint]:docker:" \ "($help)--docker=[Set the docker endpoint]:docker:" \
"($help)--kubernetes=[Set the kubernetes endpoint]:kubernetes:" \
"($help)--from=[Create context from a named context]:from:__docker_complete_contexts" \ "($help)--from=[Create context from a named context]:from:__docker_complete_contexts" \
"($help -):name: " && ret=0 "($help -):name: " && ret=0
;; ;;
@ -2607,10 +2606,8 @@ __docker_context_subcommand() {
(update) (update)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
"($help)--default-stack-orchestrator=[Default orchestrator for stack operations to use with this context]:default-stack-orchestrator:(swarm kubernetes all)" \
"($help)--description=[Description of the context]:description:" \ "($help)--description=[Description of the context]:description:" \
"($help)--docker=[Set the docker endpoint]:docker:" \ "($help)--docker=[Set the docker endpoint]:docker:" \
"($help)--kubernetes=[Set the kubernetes endpoint]:kubernetes:" \
"($help -):name:" && ret=0 "($help -):name:" && ret=0
;; ;;
esac esac
@ -2734,9 +2731,6 @@ __docker_subcommand() {
"($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \ "($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \
"($help)--bip=[Network bridge IP]:IP address: " \ "($help)--bip=[Network bridge IP]:IP address: " \
"($help)--cgroup-parent=[Parent cgroup for all containers]:cgroup: " \ "($help)--cgroup-parent=[Parent cgroup for all containers]:cgroup: " \
"($help)--cluster-advertise=[Address or interface name to advertise]:Instance to advertise (host\:port): " \
"($help)--cluster-store=[URL of the distributed storage backend]:Cluster Store:->cluster-store" \
"($help)*--cluster-store-opt=[Cluster store options]:Cluster options:->cluster-store-options" \
"($help)--config-file=[Path to daemon configuration file]:Config File:_files" \ "($help)--config-file=[Path to daemon configuration file]:Config File:_files" \
"($help)--containerd=[Path to containerd socket]:socket:_files -g \"*.sock\"" \ "($help)--containerd=[Path to containerd socket]:socket:_files -g \"*.sock\"" \
"($help)--containerd-namespace=[Containerd namespace to use]:containerd namespace:" \ "($help)--containerd-namespace=[Containerd namespace to use]:containerd namespace:" \
@ -2778,7 +2772,7 @@ __docker_subcommand() {
"($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \ "($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \
"($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \ "($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \
"($help)--raw-logs[Full timestamps without ANSI coloring]" \ "($help)--raw-logs[Full timestamps without ANSI coloring]" \
"($help)*--registry-mirror=[Preferred Docker registry mirror]:registry mirror: " \ "($help)*--registry-mirror=[Preferred registry mirror]:registry mirror: " \
"($help)--seccomp-profile=[Path to seccomp profile]:path:_files -g \"*.json\"" \ "($help)--seccomp-profile=[Path to seccomp profile]:path:_files -g \"*.json\"" \
"($help -s --storage-driver)"{-s=,--storage-driver=}"[Storage driver to use]:driver:(aufs btrfs devicemapper overlay overlay2 vfs zfs)" \ "($help -s --storage-driver)"{-s=,--storage-driver=}"[Storage driver to use]:driver:(aufs btrfs devicemapper overlay overlay2 vfs zfs)" \
"($help)--selinux-enabled[Enable selinux support]" \ "($help)--selinux-enabled[Enable selinux support]" \
@ -2795,22 +2789,6 @@ __docker_subcommand() {
"($help)--validate[Validate daemon configuration and exit]" && ret=0 "($help)--validate[Validate daemon configuration and exit]" && ret=0
case $state in case $state in
(cluster-store)
if compset -P '*://'; then
_message 'host:port' && ret=0
else
store=('consul' 'etcd' 'zk')
_describe -t cluster-store "Cluster Store" store -qS "://" && ret=0
fi
;;
(cluster-store-options)
if compset -P '*='; then
_files && ret=0
else
opts=('discovery.heartbeat' 'discovery.ttl' 'kv.cacertfile' 'kv.certfile' 'kv.keyfile' 'kv.path')
_describe -t cluster-store-opts "Cluster Store Options" opts -qS "=" && ret=0
fi
;;
(users-groups) (users-groups)
if compset -P '*:'; then if compset -P '*:'; then
_groups && ret=0 _groups && ret=0
@ -3095,6 +3073,7 @@ _docker() {
_arguments $(__docker_arguments) -C \ _arguments $(__docker_arguments) -C \
"(: -)"{-h,--help}"[Print usage]" \ "(: -)"{-h,--help}"[Print usage]" \
"($help)--config[Location of client config files]:path:_directories" \ "($help)--config[Location of client config files]:path:_directories" \
"($help -c --context)"{-c=,--context=}"[Execute the command in a docker context]:context:__docker_complete_contexts" \
"($help -D --debug)"{-D,--debug}"[Enable debug mode]" \ "($help -D --debug)"{-D,--debug}"[Enable debug mode]" \
"($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \ "($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \
"($help -l --log-level)"{-l=,--log-level=}"[Logging level]:level:(debug info warn error fatal)" \ "($help -l --log-level)"{-l=,--log-level=}"[Logging level]:level:(debug info warn error fatal)" \
@ -3110,7 +3089,8 @@ _docker() {
local host=${opt_args[-H]}${opt_args[--host]} local host=${opt_args[-H]}${opt_args[--host]}
local config=${opt_args[--config]} local config=${opt_args[--config]}
local docker_options="${host:+--host $host} ${config:+--config $config}" local context=${opt_args[-c]}${opt_args[--context]}
local docker_options="${host:+--host $host} ${config:+--config $config} ${context:+--context $context} "
case $state in case $state in
(command) (command)

View file

@ -1,39 +1,33 @@
alias dbl='docker build' alias dbl='docker build'
alias dpu='docker pull'
alias dtop='docker top'
# docker containers
alias dcin='docker container inspect' alias dcin='docker container inspect'
alias dlo='docker container logs'
alias dcls='docker container ls' alias dcls='docker container ls'
alias dclsa='docker container ls -a' alias dclsa='docker container ls -a'
alias dpo='docker container port'
alias dr='docker container run'
alias drit='docker container run -it'
alias drm='docker container rm'
alias 'drm!'='docker container rm -f'
alias dst='docker container start'
alias dstp='docker container stop'
alias dxc='docker container exec'
alias dxcit='docker container exec -it'
# docker images
alias dib='docker image build' alias dib='docker image build'
alias dii='docker image inspect' alias dii='docker image inspect'
alias dils='docker image ls' alias dils='docker image ls'
alias dip='docker image push' alias dipu='docker image push'
alias dirm='docker image rm' alias dirm='docker image rm'
alias dit='docker image tag' alias dit='docker image tag'
alias dlo='docker container logs'
# docker network
alias dnc='docker network create' alias dnc='docker network create'
alias dncn='docker network connect' alias dncn='docker network connect'
alias dndcn='docker network disconnect' alias dndcn='docker network disconnect'
alias dni='docker network inspect' alias dni='docker network inspect'
alias dnls='docker network ls' alias dnls='docker network ls'
alias dnrm='docker network rm' alias dnrm='docker network rm'
alias dpo='docker container port'
# docker volume alias dpu='docker pull'
alias dr='docker container run'
alias drit='docker container run -it'
alias drm='docker container rm'
alias 'drm!'='docker container rm -f'
alias dst='docker container start'
alias drs='docker container restart'
alias dsta='docker stop $(docker ps -q)'
alias dstp='docker container stop'
alias dtop='docker top'
alias dvi='docker volume inspect' alias dvi='docker volume inspect'
alias dvls='docker volume ls' alias dvls='docker volume ls'
alias dvprune='docker volume prune' alias dvprune='docker volume prune'
alias dxc='docker container exec'
alias dxcit='docker container exec -it'

View file

@ -4,6 +4,14 @@
# #
# Author: https://github.com/HalisCz # Author: https://github.com/HalisCz
if [ $commands[doctl] ]; then if (( ! $+commands[doctl] )); then
source <(doctl completion zsh) return
fi fi
if [[ ! -f "$ZSH_CACHE_DIR/completions/_doctl" ]]; then
typeset -g -A _comps
autoload -Uz _doctl
_comps[doctl]=_doctl
fi
doctl completion zsh >| "$ZSH_CACHE_DIR/completions/_doctl" &|

View file

@ -17,6 +17,7 @@ plugins=(... dotnet)
| dt | dotnet test | Run unit tests using the test runner specified in a .NET project. | | dt | dotnet test | Run unit tests using the test runner specified in a .NET project. |
| dw | dotnet watch | Watch for source file changes and restart the dotnet command. | | dw | dotnet watch | Watch for source file changes and restart the dotnet command. |
| dwr | dotnet watch run | Watch for source file changes and restart the `run` command. | | dwr | dotnet watch run | Watch for source file changes and restart the `run` command. |
| dwt | dotnet watch test| Watch for source file changes and restart the `test` command. |
| ds | dotnet sln | Modify Visual Studio solution files. | | ds | dotnet sln | Modify Visual Studio solution files. |
| da | dotnet add | Add a package or reference to a .NET project. | | da | dotnet add | Add a package or reference to a .NET project. |
| dp | dotnet pack | Create a NuGet package. | | dp | dotnet pack | Create a NuGet package. |

View file

@ -26,6 +26,7 @@ alias dr='dotnet run'
alias dt='dotnet test' alias dt='dotnet test'
alias dw='dotnet watch' alias dw='dotnet watch'
alias dwr='dotnet watch run' alias dwr='dotnet watch run'
alias dwt='dotnet watch test'
alias ds='dotnet sln' alias ds='dotnet sln'
alias da='dotnet add' alias da='dotnet add'
alias dp='dotnet pack' alias dp='dotnet pack'

View file

@ -25,6 +25,6 @@ The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that
| e | `emacs` | Same as emacs alias | | e | `emacs` | Same as emacs alias |
| te | `$EMACS_LAUNCHER -nw` | Open terminal emacsclient | | te | `$EMACS_LAUNCHER -nw` | Open terminal emacsclient |
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs | | eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
| eframe | `emacsclient --alternate-editor "" --create-frame` | Create new X frame | | eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
| efile | - | Print the path to the file open in the current buffer | | efile | - | Print the path to the file open in the current buffer |
| ecd | - | Print the directory of the file open in the the current buffer | | ecd | - | Print the directory of the file open in the the current buffer |

View file

@ -32,7 +32,7 @@ alias te="$EMACS_PLUGIN_LAUNCHER -nw"
# same than M-x eval but from outside Emacs. # same than M-x eval but from outside Emacs.
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval" alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
# create a new X frame # create a new X frame
alias eframe='emacsclient --alternate-editor "" --create-frame' alias eframe='emacsclient --alternate-editor="" --create-frame'
# Emacs ANSI Term tracking # Emacs ANSI Term tracking
if [[ -n "$INSIDE_EMACS" ]]; then if [[ -n "$INSIDE_EMACS" ]]; then

View file

@ -11,15 +11,15 @@ emacsfun() {
esac esac
# Check if there are suitable frames # Check if there are suitable frames
frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null)" frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null |sed 's/.*\x07//g' )"
# Only create another X frame if there isn't one present # Only create another X frame if there isn't one present
if [ -z "$frames" -o "$frames" = nil ]; then if [ -z "$frames" -o "$frames" = nil ]; then
emacsclient --alternate-editor "" --create-frame "$@" emacsclient --alternate-editor="" --create-frame "$@"
return $? return $?
fi fi
emacsclient --alternate-editor "" "$@" emacsclient --alternate-editor="" "$@"
} }
# Adapted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh # Adapted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh

View file

@ -56,7 +56,7 @@ typeset -gAH emoji_groups
# def country_iso(_all_names, _omz_name): # def country_iso(_all_names, _omz_name):
# """ Using the external library country_converter, # """ Using the external library country_converter,
# this funciton can detect the ISO2 and ISO3 codes # this function can detect the ISO2 and ISO3 codes
# of the country. It takes as argument the array # of the country. It takes as argument the array
# with all the names of the emoji, and returns that array.""" # with all the names of the emoji, and returns that array."""
# omz_no_underscore = re.sub(r'_', r' ', _omz_name) # omz_no_underscore = re.sub(r'_', r' ', _omz_name)
@ -96,7 +96,7 @@ def name_to_omz(_name, _group, _subgroup, _status):
# Special treatment by status # Special treatment by status
# Enables us to have every emoji combination, # Enables us to have every emoji combination,
# even the one that are not officially sanctionned # even the one that are not officially sanctionned
# and are implemeted by, say, only one vendor # and are implemented by, say, only one vendor
if _status == "unqualified": if _status == "unqualified":
shortname += "_unqualified" shortname += "_unqualified"
elif _status == "minimally-qualified": elif _status == "minimally-qualified":

View file

@ -10,10 +10,11 @@ plugins=(... encode64)
## Functions and Aliases ## Functions and Aliases
| Function | Alias | Description | | Function | Alias | Description |
| ---------- | ----- | ------------------------------ | | -------------- | ------ | -------------------------------------- |
| `encode64` | `e64` | Encodes given data to base64 | | `encode64` | `e64` | Encodes given data to base64 |
| `decode64` | `d64` | Decodes given data from base64 | | `encodefile64` | `ef64` | Encodes given file's content to base64 |
| `decode64` | `d64` | Decodes given data from base64 |
## Usage and examples ## Usage and examples
@ -37,6 +38,20 @@ plugins=(... encode64)
b2gtbXktenNo== b2gtbXktenNo==
``` ```
### Encoding a file
Encode a file's contents to base64 and save output to text file.
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
- From parameter
```console
$ encodefile64 ohmyzsh.icn
ohmyzsh.icn's content encoded in base64 and saved as ohmyzsh.icn.txt
$ ef64 "oh-my-zsh"
ohmyzsh.icn's content encoded in base64 and saved as ohmyzsh.icn.txt
```
### Decoding ### Decoding
- From parameter - From parameter

View file

@ -6,6 +6,15 @@ encode64() {
fi fi
} }
encodefile64() {
if [[ $# -eq 0 ]]; then
echo "You must provide a filename"
else
base64 -i $1 -o $1.txt
echo "${1}'s content encoded in base64 and saved as ${1}.txt"
fi
}
decode64() { decode64() {
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
cat | base64 --decode cat | base64 --decode
@ -14,4 +23,5 @@ decode64() {
fi fi
} }
alias e64=encode64 alias e64=encode64
alias ef64=encodefile64
alias d64=decode64 alias d64=decode64

View file

@ -1,10 +1,10 @@
# extract plugin # extract plugin
This plugin defines a function called `extract` that extracts the archive file This plugin defines a function called `extract` that extracts the archive file you pass it, and it supports a
you pass it, and it supports a wide variety of archive filetypes. wide variety of archive filetypes.
This way you don't have to know what specific command extracts a file, you just This way you don't have to know what specific command extracts a file, you just do `extract <filename>` and
do `extract <filename>` and the function takes care of the rest. the function takes care of the rest.
To use it, add `extract` to the plugins array in your zshrc file: To use it, add `extract` to the plugins array in your zshrc file:
@ -15,7 +15,7 @@ plugins=(... extract)
## Supported file extensions ## Supported file extensions
| Extension | Description | | Extension | Description |
|:------------------|:-------------------------------------| | :---------------- | :----------------------------------- |
| `7z` | 7zip file | | `7z` | 7zip file |
| `Z` | Z archive (LZW) | | `Z` | Z archive (LZW) |
| `apk` | Android app file | | `apk` | Android app file |
@ -32,6 +32,7 @@ plugins=(... extract)
| `lrz` | LRZ archive | | `lrz` | LRZ archive |
| `lz4` | LZ4 archive | | `lz4` | LZ4 archive |
| `lzma` | LZMA archive | | `lzma` | LZMA archive |
| `obscpio` | cpio archive used on OBS |
| `rar` | WinRAR archive | | `rar` | WinRAR archive |
| `rpm` | RPM package | | `rpm` | RPM package |
| `sublime-package` | Sublime Text package | | `sublime-package` | Sublime Text package |
@ -55,6 +56,7 @@ plugins=(... extract)
| `xz` | LZMA2 archive | | `xz` | LZMA2 archive |
| `zip` | Zip archive | | `zip` | Zip archive |
| `zst` | Zstandard file (zstd) | | `zst` | Zstandard file (zstd) |
| `zpaq` | Zpaq file |
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for more information
more information regarding archive formats. regarding archive formats.

View file

@ -3,5 +3,5 @@
_arguments \ _arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \ '(-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|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)(-.)'" \ "*::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)(-.)'" \
&& return 0 && return 0

View file

@ -29,57 +29,93 @@ EOF
local success=0 local success=0
local extract_dir="${1:t:r}" local extract_dir="${1:t:r}"
local file="$1" full_path="${1:A}" local file="$1" full_path="${1:A}"
# Create an extraction directory based on the file name
command mkdir -p "$extract_dir"
builtin cd -q "$extract_dir"
case "${file:l}" in case "${file:l}" in
(*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$file" | tar xv } || tar zxvf "$file" ;; (*.tar.gz|*.tgz)
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$file" ;; (( $+commands[pigz] )) && { tar -I pigz -xvf "$full_path" } || tar zxvf "$full_path" ;;
(*.tar.bz2|*.tbz|*.tbz2)
(( $+commands[pbzip2] )) && { tar -I pbzip2 -xvf "$full_path" } || tar xvjf "$full_path" ;;
(*.tar.xz|*.txz) (*.tar.xz|*.txz)
(( $+commands[pixz] )) && { tar -I pixz -xvf "$full_path" } || {
tar --xz --help &> /dev/null \ tar --xz --help &> /dev/null \
&& tar --xz -xvf "$file" \ && tar --xz -xvf "$full_path" \
|| xzcat "$file" | tar xvf - ;; || xzcat "$full_path" | tar xvf - } ;;
(*.tar.zma|*.tlz) (*.tar.zma|*.tlz)
tar --lzma --help &> /dev/null \ tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$file" \ && tar --lzma -xvf "$full_path" \
|| lzcat "$file" | tar xvf - ;; || lzcat "$full_path" | tar xvf - ;;
(*.tar.zst|*.tzst) (*.tar.zst|*.tzst)
tar --zstd --help &> /dev/null \ tar --zstd --help &> /dev/null \
&& tar --zstd -xvf "$file" \ && tar --zstd -xvf "$full_path" \
|| zstdcat "$file" | tar xvf - ;; || zstdcat "$full_path" | tar xvf - ;;
(*.tar) tar xvf "$file" ;; (*.tar) tar xvf "$full_path" ;;
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$file" ;; (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;;
(*.tar.lz4) lz4 -c -d "$file" | tar xvf - ;; (*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$file" ;; (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
(*.gz) (( $+commands[pigz] )) && pigz -dk "$file" || gunzip -k "$file" ;; (*.gz) (( $+commands[pigz] )) && pigz -dk "$full_path" || gunzip -k "$full_path" ;;
(*.bz2) bunzip2 "$file" ;; (*.bz2) bunzip2 "$full_path" ;;
(*.xz) unxz "$file" ;; (*.xz) unxz "$full_path" ;;
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$file" ;; (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
(*.lz4) lz4 -d "$file" ;; (*.lz4) lz4 -d "$full_path" ;;
(*.lzma) unlzma "$file" ;; (*.lzma) unlzma "$full_path" ;;
(*.z) uncompress "$file" ;; (*.z) uncompress "$full_path" ;;
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$file" -d "$extract_dir" ;; (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$full_path" ;;
(*.rar) unrar x -ad "$file" ;; (*.rar) unrar x -ad "$full_path" ;;
(*.rpm) (*.rpm)
command mkdir -p "$extract_dir" && builtin cd -q "$extract_dir" \ rpm2cpio "$full_path" | cpio --quiet -id ;;
&& rpm2cpio "$full_path" | cpio --quiet -id ;; (*.7z) 7za x "$full_path" ;;
(*.7z) 7za x "$file" ;;
(*.deb) (*.deb)
command mkdir -p "$extract_dir/control" "$extract_dir/data" command mkdir -p "control" "data"
builtin cd -q "$extract_dir"; ar vx "$full_path" > /dev/null ar vx "$full_path" > /dev/null
builtin cd -q control; extract ../control.tar.* builtin cd -q control; extract ../control.tar.*
builtin cd -q ../data; extract ../data.tar.* builtin cd -q ../data; extract ../data.tar.*
builtin cd -q ..; command rm *.tar.* debian-binary ;; builtin cd -q ..; command rm *.tar.* debian-binary ;;
(*.zst) unzstd "$file" ;; (*.zst) unzstd "$full_path" ;;
(*.cab) cabextract -d "$extract_dir" "$file" ;; (*.cab) cabextract "$full_path" ;;
(*.cpio) cpio -idmvF "$file" ;; (*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
(*.zpaq) zpaq x "$full_path" ;;
(*) (*)
echo "extract: '$file' cannot be extracted" >&2 echo "extract: '$file' cannot be extracted" >&2
success=1 ;; success=1 ;;
esac esac
(( success = success > 0 ? success : $? )) (( success = success > 0 ? success : $? ))
(( success == 0 && remove_archive == 0 )) && rm "$full_path" (( success == 0 && remove_archive == 0 )) && command rm "$full_path"
shift shift
# Go back to original working directory in case we ran cd previously # Go back to original working directory
builtin cd -q "$pwd" builtin cd -q "$pwd"
# If content of extract dir is a single directory, move its contents up
# Glob flags:
# - D: include files starting with .
# - N: no error if directory is empty
# - Y2: at most give 2 files
local -a content
content=("${extract_dir}"/*(DNY2))
if [[ ${#content} -eq 1 && -d "${content[1]}" ]]; then
# The extracted folder (${content[1]}) may have the same name as $extract_dir
# If so, we need to rename it to avoid conflicts in a 3-step process
#
# 1. Move and rename the extracted folder to a temporary random name
# 2. Delete the empty folder
# 3. Rename the extracted folder to the original name
if [[ "${content[1]:t}" == "$extract_dir" ]]; then
# =(:) gives /tmp/zsh<random>, with :t it gives zsh<random>
local tmp_dir==(:); tmp_dir="${tmp_dir:t}"
command mv -f "${content[1]}" "$tmp_dir" \
&& command rmdir "$extract_dir" \
&& command mv -f "$tmp_dir" "$extract_dir"
else
command mv -f "${content[1]}" . \
&& command rmdir "$extract_dir"
fi
elif [[ ${#content} -eq 0 ]]; then
command rmdir "$extract_dir"
fi
done done
} }

View file

@ -10,7 +10,7 @@ plugins=(... fasd)
## Installation ## Installation
Please find detailed installation guide [`here`](https://github.com/clvv/fasd#install) Please find detailed installation guide [`here`](https://github.com/whjvenyl/fasd#install)
## Aliases ## Aliases

View file

@ -1,37 +0,0 @@
#compdef flutter
#autoload
local -a _1st_arguments
_1st_arguments=(
"analyze":"Analyze the project's Dart code."
"assemble":"Assemble and build flutter resources."
"attach":"Attach to a running application."
"build":"Flutter build commands."
"channel":"List or switch flutter channels."
"clean":"Delete the build/ and .dart_tool/ directories."
"config":"Configure Flutter settings."
"create":"Create a new Flutter project."
"devices":"List all connected devices."
"doctor":"Show information about the installed tooling."
"drive":"Runs Flutter Driver tests for the current project."
"emulators":"List, launch and create emulators."
"format":" Format one or more dart files."
"help":"Display help information for flutter."
"install":"Install a Flutter app on an attached device."
"logs":"Show log output for running Flutter apps."
"make-host-app-editable":"Moves host apps from generated directories to non-generated directories so that they can be edited by developers."
"precache":"Populates the Flutter tool's cache of binary artifacts."
"pub":"Commands for managing Flutter packages."
"run":"Run your Flutter app on an attached device."
"screenshot":"Take a screenshot from a connected device."
"test":"Run Flutter unit tests for the current project."
"upgrade":"Upgrade your copy of Flutter."
"version":"List or switch flutter versions."
)
_arguments -C '*:: :->subcmds'
if (( CURRENT == 1 )); then
_describe -t commands "flutter command" _1st_arguments
return
fi

View file

@ -12,3 +12,18 @@ alias flrd="flutter run --debug"
alias flrp="flutter run --profile" alias flrp="flutter run --profile"
alias flrr="flutter run --release" alias flrr="flutter run --release"
alias flupgrd="flutter upgrade" alias flupgrd="flutter upgrade"
# COMPLETION FUNCTION
if (( ! $+commands[flutter] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `flutter`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_flutter" ]]; then
typeset -g -A _comps
autoload -Uz _flutter
_comps[flutter]=_flutter
fi
flutter zsh-completion >| "$ZSH_CACHE_DIR/completions/_flutter" &|

9
plugins/fluxcd/README.md Normal file
View file

@ -0,0 +1,9 @@
# FluxCD plugin
This plugin adds completion for [FluxCD](https://fluxcd.io), an open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.
To use it, add `fluxcd` to the plugins array in your zshrc file:
```zsh
plugins=(... fluxcd)
```

View file

@ -0,0 +1,14 @@
# Autocompletion for the FluxCD CLI (flux).
if (( ! $+commands[flux] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `flux`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_flux" ]]; then
typeset -g -A _comps
autoload -Uz _flux
_comps[flux]=_flux
fi
flux completion zsh >| "$ZSH_CACHE_DIR/completions/_flux" &|

View file

@ -13,12 +13,11 @@ ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔" ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
function fossil_prompt_info() { function fossil_prompt_info() {
local info=$(fossil branch 2>&1) local branch=$(fossil branch current 2>&1)
# if we're not in a fossil repo, don't show anything # if we're not in a fossil repo, don't show anything
! command grep -q "use --repo" <<< "$info" || return ! command grep -q "use --repo" <<< "$branch" || return
local branch=$(echo $info | grep "* " | sed 's/* //g')
local changes=$(fossil changes) local changes=$(fossil changes)
local dirty="$ZSH_THEME_FOSSIL_PROMPT_CLEAN" local dirty="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"

View file

@ -37,7 +37,7 @@ function _frontend() {
'lodash: Search in Lo-Dash website' 'lodash: Search in Lo-Dash website'
'mdn: Search in MDN website' 'mdn: Search in MDN website'
'nodejs: Search in NodeJS website' 'nodejs: Search in NodeJS website'
'npmjs: Search in NPMJS website' 'npmjs: Search in npmjs website'
'packagephobia: Search in Packagephobia website' 'packagephobia: Search in Packagephobia website'
'qunit: Search in Qunit website' 'qunit: Search in Qunit website'
'reactjs: Search in React website' 'reactjs: Search in React website'

View file

@ -9,6 +9,7 @@ function fzf_setup_using_base_dir() {
"${HOME}/.nix-profile/share/fzf" "${HOME}/.nix-profile/share/fzf"
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf" "${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
"/usr/local/opt/fzf" "/usr/local/opt/fzf"
"/opt/homebrew/opt/fzf"
"/usr/share/fzf" "/usr/share/fzf"
"/usr/local/share/examples/fzf" "/usr/local/share/examples/fzf"
) )
@ -59,8 +60,8 @@ function fzf_setup_using_base_dir() {
function fzf_setup_using_debian() { function fzf_setup_using_debian() {
if (( ! $+commands[dpkg] )) || ! dpkg -s fzf &>/dev/null; then if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
# Either not a debian based distro, or no fzf installed # Not a debian based distro
return 1 return 1
fi fi
@ -71,11 +72,19 @@ function fzf_setup_using_debian() {
case $PREFIX in case $PREFIX in
*com.termux*) *com.termux*)
if [[ ! -f "${PREFIX}/bin/fzf" ]]; then
# fzf not installed
return 1
fi
# Support Termux package # Support Termux package
completions="${PREFIX}/share/fzf/completion.zsh" completions="${PREFIX}/share/fzf/completion.zsh"
key_bindings="${PREFIX}/share/fzf/key-bindings.zsh" key_bindings="${PREFIX}/share/fzf/key-bindings.zsh"
;; ;;
*) *)
if [[ ! -d /usr/share/doc/fzf/examples ]]; then
# fzf not installed
return 1
fi
# Determine completion file path: first bullseye/sid, then buster/stretch # Determine completion file path: first bullseye/sid, then buster/stretch
completions="/usr/share/doc/fzf/examples/completion.zsh" completions="/usr/share/doc/fzf/examples/completion.zsh"
[[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf" [[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf"
@ -178,7 +187,7 @@ function fzf_setup_using_macports() {
(( $+commands[fzf] )) || return 1 (( $+commands[fzf] )) || return 1
# The fzf-zsh-completion package installs the auto-completion in # The fzf-zsh-completion package installs the auto-completion in
local completions="/opt/local/share/zsh/site-functions/fzf" local completions="/opt/local/share/fzf/shell/completion.zsh"
# The fzf-zsh-completion package installs the key-bindings file in # The fzf-zsh-completion package installs the key-bindings file in
local key_bindings="/opt/local/share/fzf/shell/key-bindings.zsh" local key_bindings="/opt/local/share/fzf/shell/key-bindings.zsh"

View file

@ -1,21 +0,0 @@
# `gb` plugin
> A project based build tool for the Go programming language.
See https://getgb.io for the full `gb` documentation
* * * *
- Adds completion support for all `gb` commands.
- Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor).
To use it, add `gb` to your plugins array:
```sh
plugins=(... gb)
```
## Caveats
The `git` plugin defines an alias `gb` that usually conflicts with the `gb` program.
If you're having trouble with it, remove it by adding `unalias gb` at the end of your
zshrc file.

View file

@ -1,111 +0,0 @@
#compdef gb
#autoload
_gb () {
local ret=1 state
_arguments -C ':command:->command' '*::options:->options' && ret=0
case $state in
(command)
local -a subcommands
subcommands=(
"build:build a package"
"doc:show documentation for a package or symbol"
"env:print project environment variables"
"generate:generate Go files by processing source"
"help:displays the help"
"info:info returns information about this project"
"list:list the packages named by the importpaths"
"test:test packages"
"vendor:manage your vendored dependencies"
)
_describe -t subcommands 'gb subcommands' subcommands && ret=0
;;
(options)
case $line[1] in
(build)
_arguments \
-f'[ignore cached packages]' \
-F'[do not cache packages]' \
-q'[decreases verbosity]' \
-P'[the number of build jobs to run in parallel]' \
-R'[sets the base of the project root search path]' \
-dotfile'[output a dot formatted file of the build steps]' \
-ldflags'["flag list" arguments to pass to the linker]' \
-gcflags'["arg list" arguments to pass to the compiler]' \
-race'[enable data race detection]' \
-tags'["tag list" additional build tags]'
;;
(list)
_arguments \
-f'[alternate format for the list, using the syntax of package template]' \
-s'[read format template from STDIN]' \
-json'[prints output in structured JSON format]'
;;
(test)
_arguments \
-v'[print output from test subprocess]' \
-ldflags'["flag list" arguments to pass to the linker]' \
-gcflags'["arg list" arguments to pass to the compiler]' \
-race'[enable data race detection]' \
-tags'["tag list" additional build tags]'
;;
(vendor)
_gb-vendor
esac
;;
esac
return ret
}
_gb-vendor () {
local curcontext="$curcontext" state line
_arguments -C ':command:->command' '*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'delete:deletes a local dependency'
'fetch:fetch a remote dependency'
'list:lists dependencies, one per line'
'purge:remove all unreferenced dependencies'
'restore:restore dependencies from the manifest'
'update:update a local dependency'
)
_describe -t subcommands 'gb vendor subcommands' subcommands && ret=0
;;
(options)
case $line[1] in
(delete)
_arguments \
-all'[remove all dependencies]'
;;
(fetch)
_arguments \
-branch'[fetch from a particular branch]' \
-no-recurse'[do not fetch recursively]' \
-tag'[fetch the specified tag]' \
-revision'[fetch the specific revision from the branch (if supplied)]' \
-precaire'[allow the use of insecure protocols]' \
;;
(list)
_arguments \
-f'[controls the template used for printing each manifest entry]'
;;
(restore)
_arguments \
-precaire'[allow the use of insecure protocols]'
;;
(update)
_arguments \
-all'[update all dependencies in the manifest or supply a given dependency]' \
-precaire'[allow the use of insecure protocols]'
;;
esac
;;
esac
}
_gb

View file

@ -10,8 +10,11 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk" "/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/usr/share/google-cloud-sdk" "/usr/share/google-cloud-sdk"
"/snap/google-cloud-sdk/current" "/snap/google-cloud-sdk/current"
"/usr/lib64/google-cloud-sdk/" "/snap/google-cloud-cli/current"
"/usr/lib/google-cloud-sdk"
"/usr/lib64/google-cloud-sdk"
"/opt/google-cloud-sdk" "/opt/google-cloud-sdk"
"/opt/local/libexec/google-cloud-sdk"
) )
for gcloud_sdk_location in $search_locations; do for gcloud_sdk_location in $search_locations; do
@ -20,15 +23,28 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
break break
fi fi
done done
unset search_locations gcloud_sdk_location
fi fi
if (( ${+CLOUDSDK_HOME} )); then if (( ${+CLOUDSDK_HOME} )); then
# Only source this if gcloud isn't already on the path
if (( ! $+commands[gcloud] )); then if (( ! $+commands[gcloud] )); then
# Only source this if GCloud isn't already on the path
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
source "${CLOUDSDK_HOME}/path.zsh.inc" source "${CLOUDSDK_HOME}/path.zsh.inc"
fi fi
fi fi
source "${CLOUDSDK_HOME}/completion.zsh.inc"
# Look for completion file in different paths
for comp_file (
"${CLOUDSDK_HOME}/completion.zsh.inc" # default location
"/usr/share/google-cloud-sdk/completion.zsh.inc" # apt-based location
); do
if [[ -f "${comp_file}" ]]; then
source "${comp_file}"
break
fi
done
unset comp_file
export CLOUDSDK_HOME export CLOUDSDK_HOME
fi fi

View file

@ -2,7 +2,8 @@
: ${GIT_AUTO_FETCH_INTERVAL:=60} : ${GIT_AUTO_FETCH_INTERVAL:=60}
# Necessary for the git-fetch-all function # Necessary for the git-fetch-all function
zmodload zsh/datetime zsh/stat zmodload zsh/datetime
zmodload -F zsh/stat b:zstat # only zstat command, not stat command
function git-fetch-all { function git-fetch-all {
( (
@ -27,6 +28,7 @@ function git-fetch-all {
# Fetch all remotes (avoid ssh passphrase prompt) # Fetch all remotes (avoid ssh passphrase prompt)
date -R &>! "$gitdir/FETCH_LOG" date -R &>! "$gitdir/FETCH_LOG"
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \ GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
GIT_TERMINAL_PROMPT=0 \
command git fetch --all 2>/dev/null &>> "$gitdir/FETCH_LOG" command git fetch --all 2>/dev/null &>> "$gitdir/FETCH_LOG"
) &| ) &|
} }

View file

@ -51,7 +51,7 @@ __gitex_remote_names() {
local expl local expl
declare -a remote_names declare -a remote_names
remote_names=(${(f)"$(_call_program remotes git remote 2>/dev/null)"}) remote_names=(${(f)"$(_call_program remotes git remote 2>/dev/null)"})
__git_command_successful || return __gitex_command_successful || return
_wanted remote-names expl remote-name compadd $* - $remote_names _wanted remote-names expl remote-name compadd $* - $remote_names
} }
@ -59,7 +59,7 @@ __gitex_tag_names() {
local expl local expl
declare -a tag_names declare -a tag_names
tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
__git_command_successful || return __gitex_command_successful || return
_wanted tag-names expl tag-name compadd $* - $tag_names _wanted tag-names expl tag-name compadd $* - $tag_names
} }
@ -68,7 +68,7 @@ __gitex_branch_names() {
local expl local expl
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return __gitex_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names _wanted branch-names expl branch-name compadd $* - $branch_names
} }
@ -76,7 +76,7 @@ __gitex_specific_branch_names() {
local expl local expl
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/}) branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
__git_command_successful || return __gitex_command_successful || return
_wanted branch-names expl branch-name compadd - $branch_names _wanted branch-names expl branch-name compadd - $branch_names
} }
@ -100,7 +100,7 @@ __gitex_submodule_names() {
local expl local expl
declare -a submodule_names declare -a submodule_names
submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) # ' submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) # '
__git_command_successful || return __gitex_command_successful || return
_wanted submodule-names expl submodule-name compadd $* - $submodule_names _wanted submodule-names expl submodule-name compadd $* - $submodule_names
} }
@ -109,7 +109,7 @@ __gitex_author_names() {
local expl local expl
declare -a author_names declare -a author_names
author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"}) author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
__git_command_successful || return __gitex_command_successful || return
_wanted author-names expl author-name compadd $* - $author_names _wanted author-names expl author-name compadd $* - $author_names
} }

View file

@ -45,6 +45,7 @@ The symbols are as follows:
| ●n | there are `n` staged files | | ●n | there are `n` staged files |
| ✖n | there are `n` unmerged files | | ✖n | there are `n` unmerged files |
| ✚n | there are `n` unstaged files | | ✚n | there are `n` unstaged files |
| -n | there are `n` deleted files |
| ⚑n | there are `n` stashed changes | | ⚑n | there are `n` stashed changes |
| … | there are some untracked files | | … | there are some untracked files |
@ -59,6 +60,7 @@ The symbols are as follows:
## Customisation ## Customisation
- Set the variable `ZSH_THEME_GIT_PROMPT_CACHE` to any value in order to enable caching. - Set the variable `ZSH_THEME_GIT_PROMPT_CACHE` to any value in order to enable caching.
- Set the variable `ZSH_THEME_GIT_SHOW_UPSTREAM` to any value to display the upstream branch.
- You may also change a number of variables (whose name start with `ZSH_THEME_GIT_PROMPT_`) - You may also change a number of variables (whose name start with `ZSH_THEME_GIT_PROMPT_`)
to change the appearance of the prompt. Take a look at the bottom of the [plugin file](git-prompt.plugin.zsh)` to change the appearance of the prompt. Take a look at the bottom of the [plugin file](git-prompt.plugin.zsh)`
to see what variables are available. to see what variables are available.

View file

@ -47,12 +47,19 @@ function update_current_git_vars() {
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7] GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
GIT_STASHED=$__CURRENT_GIT_STATUS[8] GIT_STASHED=$__CURRENT_GIT_STATUS[8]
GIT_CLEAN=$__CURRENT_GIT_STATUS[9] GIT_CLEAN=$__CURRENT_GIT_STATUS[9]
GIT_DELETED=$__CURRENT_GIT_STATUS[10]
if [ -z ${ZSH_THEME_GIT_SHOW_UPSTREAM+x} ]; then
GIT_UPSTREAM=
else
GIT_UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null) && GIT_UPSTREAM="${ZSH_THEME_GIT_PROMPT_UPSTREAM_SEPARATOR}${GIT_UPSTREAM}"
fi
} }
git_super_status() { git_super_status() {
precmd_update_git_vars precmd_update_git_vars
if [ -n "$__CURRENT_GIT_STATUS" ]; then if [ -n "$__CURRENT_GIT_STATUS" ]; then
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}" STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH$GIT_UPSTREAM%{${reset_color}%}"
if [ "$GIT_BEHIND" -ne "0" ]; then if [ "$GIT_BEHIND" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}" STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}"
fi fi
@ -69,6 +76,9 @@ git_super_status() {
if [ "$GIT_CHANGED" -ne "0" ]; then if [ "$GIT_CHANGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}" STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
fi fi
if [ "$GIT_DELETED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_DELETED$GIT_DELETED%{${reset_color}%}"
fi
if [ "$GIT_UNTRACKED" -ne "0" ]; then if [ "$GIT_UNTRACKED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED$GIT_UNTRACKED%{${reset_color}%}" STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED$GIT_UNTRACKED%{${reset_color}%}"
fi fi
@ -91,11 +101,13 @@ ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%G%}" ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%G%}"
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}" ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}"
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%G%}" ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%G%}"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[blue]%}%{-%G%}"
ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}" ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}"
ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}" ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%}%{…%G%}" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%}%{…%G%}"
ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[blue]%}%{⚑%G%}" ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[blue]%}%{⚑%G%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}"
ZSH_THEME_GIT_PROMPT_UPSTREAM_SEPARATOR="->"
# Set the prompt. # Set the prompt.
RPROMPT='$(git_super_status)' RPROMPT='$(git_super_status)'

View file

@ -44,7 +44,7 @@ if po.returncode != 0:
sys.exit(0) # Not a git repository sys.exit(0) # Not a git repository
# collect git status information # collect git status information
untracked, staged, changed, conflicts = [], [], [], [] untracked, staged, changed, deleted, conflicts = [], [], [], [], []
ahead, behind = 0, 0 ahead, behind = 0, 0
status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
for st in status: for st in status:
@ -75,13 +75,15 @@ for st in status:
else: else:
if st[1] == 'M': if st[1] == 'M':
changed.append(st) changed.append(st)
if st[1] == 'D':
deleted.append(st)
if st[0] == 'U': if st[0] == 'U':
conflicts.append(st) conflicts.append(st)
elif st[0] != ' ': elif st[0] != ' ':
staged.append(st) staged.append(st)
stashed = get_stash() stashed = get_stash()
if not changed and not staged and not conflicts and not untracked: if not changed and not deleted and not staged and not conflicts and not untracked:
clean = 1 clean = 1
else: else:
clean = 0 clean = 0
@ -95,6 +97,7 @@ out = ' '.join([
str(len(changed)), str(len(changed)),
str(len(untracked)), str(len(untracked)),
str(stashed), str(stashed),
str(clean) str(clean),
str(len(deleted))
]) ])
print(out, end='') print(out, end='')

View file

@ -10,185 +10,201 @@ plugins=(... git)
## Aliases ## Aliases
| Alias | Command | | Alias | Command |
|:---------------------|:---------------------------------------------------------------------------------------------------------------------------------| | :------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| g | git | | g | git |
| ga | git add | | ga | git add |
| gaa | git add --all | | gaa | git add --all |
| gapa | git add --patch | | gapa | git add --patch |
| gau | git add --update | | gau | git add --update |
| gav | git add --verbose | | gav | git add --verbose |
| gap | git apply | | gap | git apply |
| gapt | git apply --3way | | gapt | git apply --3way |
| gb | git branch | | gb | git branch |
| gba | git branch -a | | gba | git branch --all |
| gbd | git branch -d | | gbd | git branch --delete |
| gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*($(git_main_branch)\|$(git_develop_branch))\s*$)" \| xargs git branch -d 2>/dev/null | | gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*(<span>$</span>(git_main_branch)\|<span>$</span>(git_develop_branch))\s*<span>$</span>)" \| xargs git branch --delete 2>/dev/null |
| gbD | git branch -D | | gbD | git branch --delete --force |
| gbl | git blame -b -w | | gbg | git branch -vv | grep ": gone\]" |
| gbnm | git branch --no-merged | | gbgd | local res=$(git branch -vv | grep ": gone\]" | awk '{print $1}') && [[ $res ]] && echo $res | xargs git branch -d |
| gbr | git branch --remote | | gbgD | local res=$(git branch -vv | grep ": gone\]" | awk '{print $1}') && [[ $res ]] && echo $res | xargs git branch -D |
| gbs | git bisect | | gbl | git blame -b -w |
| gbsb | git bisect bad | | gbnm | git branch --no-merged |
| gbsg | git bisect good | | gbr | git branch --remote |
| gbsr | git bisect reset | | gbs | git bisect |
| gbss | git bisect start | | gbsb | git bisect bad |
| gc | git commit -v | | gbsg | git bisect good |
| gc! | git commit -v --amend | | gbsr | git bisect reset |
| gcn! | git commit -v --no-edit --amend | | gbss | git bisect start |
| gca | git commit -v -a | | gc | git commit --verbose |
| gca! | git commit -v -a --amend | | gc! | git commit --verbose --amend |
| gcan! | git commit -v -a --no-edit --amend | | gcn! | git commit --verbose --no-edit --amend |
| gcans! | git commit -v -a -s --no-edit --amend | | gca | git commit --verbose --all |
| gcam | git commit -a -m | | gca! | git commit --verbose --all --amend |
| gcas | git commit -a -s | | gcan! | git commit --verbose --all --no-edit --amend |
| gcasm | git commit -a -s -m | | gcans! | git commit --verbose --all --signoff --no-edit --amend |
| gcsm | git commit -s -m | | gcam | git commit --all --message |
| gcb | git checkout -b | | gcas | git commit --all --signoff |
| gcf | git config --list | | gcasm | git commit --all --signoff --message |
| gcl | git clone --recurse-submodules | | gcsm | git commit --signoff --message |
| gccd | git clone --recurse-submodules "$@" && cd "$(basename $_ .git)" | | gcb | git checkout -b |
| gclean | git clean -id | | gcf | git config --list |
| gpristine | git reset --hard && git clean -dffx | | gcl | git clone --recurse-submodules |
| gcm | git checkout $(git_main_branch) | | gccd | git clone --recurse-submodules "<span>$</span>@" && cd "<span>$</span>(basename <span>$</span>\_ .git)" |
| gcd | git checkout $(git_develop_branch) | | gclean | git clean --interactive -d |
| gcmsg | git commit -m | | gpristine | git reset --hard && git clean -dffx |
| gco | git checkout | | gcm | git checkout $(git_main_branch) |
| gcor | git checkout --recurse-submodules | | gcd | git checkout $(git_develop_branch) |
| gcount | git shortlog -sn | | gcmsg | git commit --message |
| gcp | git cherry-pick | | gco | git checkout |
| gcpa | git cherry-pick --abort | | gcor | git checkout --recurse-submodules |
| gcpc | git cherry-pick --continue | | gcount | git shortlog --summary -n |
| gcs | git commit -S | | gcp | git cherry-pick |
| gd | git diff | | gcpa | git cherry-pick --abort |
| gdca | git diff --cached | | gcpc | git cherry-pick --continue |
| gdcw | git diff --cached --word-diff | | gcs | git commit -S |
| gdct | git describe --tags $(git rev-list --tags --max-count=1) | | gcss | git commit -S -s |
| gds | git diff --staged | | gcssm | git commit -S -s -m |
| gdt | git diff-tree --no-commit-id --name-only -r | | gd | git diff |
| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)&ast;.lock" | | gdca | git diff --cached |
| gdup | git diff @{upstream} | | gdcw | git diff --cached --word-diff |
| gdv | git diff -w $@ \| view - | | gdct | git describe --tags $(git rev-list --tags --max-count=1) |
| gdw | git diff --word-diff | | gds | git diff --staged |
| gf | git fetch | | gdt | git diff-tree --no-commit-id --name-only -r |
| gfa | git fetch --all --prune | | gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)\*.lock" |
| gfg | git ls-files \| grep | | gdup | git diff @{upstream} |
| gfo | git fetch origin | | gdv | git diff -w $@ \| view - |
| gg | git gui citool | | gdw | git diff --word-diff |
| gga | git gui citool --amend | | gf | git fetch |
| ggf | git push --force origin $(current_branch) | | gfa | git fetch --all --prune |
| ggfl | git push --force-with-lease origin $(current_branch) | | gfg | git ls-files \| grep |
| ggl | git pull origin $(current_branch) | | gfo | git fetch origin |
| ggp | git push origin $(current_branch) | | gg | git gui citool |
| ggpnp | ggl && ggp | | gga | git gui citool --amend |
| ggpull | git pull origin "$(git_current_branch)" | | ggf | git push --force origin $(current_branch) |
| ggpur | ggu | | ggfl | git push --force-with-lease origin $(current_branch) |
| ggpush | git push origin "$(git_current_branch)" | | ggl | git pull origin $(current_branch) |
| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) | | ggp | git push origin $(current_branch) |
| ggu | git pull --rebase origin $(current_branch) | | ggpnp | ggl && ggp |
| gpsup | git push --set-upstream origin $(git_current_branch) | | ggpull | git pull origin "$(git_current_branch)" |
| ghh | git help | | ggpur | ggu |
| gignore | git update-index --assume-unchanged | | ggpush | git push origin "$(git_current_branch)" |
| gignored | git ls-files -v \| grep "^[[:lower:]]" | | ggsup | git branch --set-upstream-to=origin/$(git_current_branch) |
| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk | | ggu | git pull --rebase origin $(current_branch) |
| gk | gitk --all --branches &! | | gpsup | git push --set-upstream origin $(git_current_branch) |
| gke | gitk --all $(git log -g --pretty=%h) &! | | gpsupf | git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes (git version >= 2.30) |
| gl | git pull | | gpsupf | git push --set-upstream origin $(git_current_branch) --force-with-lease (git version < 2.30) |
| glg | git log --stat | | ghh | git help |
| glgp | git log --stat -p | | gignore | git update-index --assume-unchanged |
| glgg | git log --graph | | gignored | git ls-files -v \| grep "^[[:lower:]]" |
| glgga | git log --graph --decorate --all | | git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk |
| glgm | git log --graph --max-count=10 | | gk | gitk --all --branches &! |
| glo | git log --oneline --decorate | | gke | gitk --all $(git log --walk-reflogs --pretty=%h) &! |
| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' | | gl | git pull |
| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat | | glg | git log --stat |
| glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' | | glgp | git log --stat --patch |
| glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short | | glgg | git log --graph |
| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all | | glgga | git log --graph --decorate --all |
| glog | git log --oneline --decorate --graph | | glgm | git log --graph --max-count=10 |
| gloga | git log --oneline --decorate --graph --all | | glo | git log --oneline --decorate |
| glp | git log --pretty=\<format\> | | glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' |
| gm | git merge | | glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat |
| gmom | git merge origin/$(git_main_branch) | | glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' |
| gmtl | git mergetool --no-prompt | | glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short |
| gmtlvim | git mergetool --no-prompt --tool=vimdiff | | glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all |
| gmum | git merge upstream/$(git_main_branch) | | glog | git log --oneline --decorate --graph |
| gma | git merge --abort | | gloga | git log --oneline --decorate --graph --all |
| gp | git push | | glp | git log --pretty=\<format\> |
| gpd | git push --dry-run | | gm | git merge |
| gpf | git push --force-with-lease | | gmom | git merge origin/$(git_main_branch) |
| gpf! | git push --force | | gmtl | git mergetool --no-prompt |
| gpoat | git push origin --all && git push origin --tags | | gmtlvim | git mergetool --no-prompt --tool=vimdiff |
| gpr | git pull --rebase | | gmum | git merge upstream/$(git_main_branch) |
| gpu | git push upstream | | gma | git merge --abort |
| gpv | git push -v | | gp | git push |
| gr | git remote | | gpd | git push --dry-run |
| gra | git remote add | | gpf | git push --force-with-lease --force-if-includes (git version >= 2.30) |
| grb | git rebase | | gpf | git push --force-with-lease (git version < 2.30) |
| grba | git rebase --abort | | gpf! | git push --force |
| grbc | git rebase --continue | | gpoat | git push origin --all && git push origin --tags |
| grbd | git rebase $(git_develop_branch) | | gpod | git push origin --delete |
| grbi | git rebase -i | | gpr | git pull --rebase |
| grbm | git rebase $(git_main_branch) | | gpu | git push upstream |
| grbom | git rebase origin/$(git_main_branch) | | gpv | git push --verbose |
| grbo | git rebase --onto | | gr | git remote |
| grbs | git rebase --skip | | gra | git remote add |
| grev | git revert | | grb | git rebase |
| grh | git reset | | grba | git rebase --abort |
| grhh | git reset --hard | | grbc | git rebase --continue |
| groh | git reset origin/$(git_current_branch) --hard | | grbd | git rebase $(git_develop_branch) |
| grm | git rm | | grbi | git rebase --interactive |
| grmc | git rm --cached | | grbm | git rebase $(git_main_branch) |
| grmv | git remote rename | | grbom | git rebase origin/$(git_main_branch) |
| grrm | git remote remove | | grbo | git rebase --onto |
| grs | git restore | | grbs | git rebase --skip |
| grset | git remote set-url | | grev | git revert |
| grss | git restore --source | | grh | git reset |
| grst | git restore --staged | | grhh | git reset --hard |
| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" | | groh | git reset origin/$(git_current_branch) --hard |
| gru | git reset -- | | grm | git rm |
| grup | git remote update | | grmc | git rm --cached |
| grv | git remote -v | | grmv | git remote rename |
| gsb | git status -sb | | grrm | git remote remove |
| gsd | git svn dcommit | | grs | git restore |
| gsh | git show | | grset | git remote set-url |
| gsi | git submodule init | | grss | git restore --source |
| gsps | git show --pretty=short --show-signature | | grst | git restore --staged |
| gsr | git svn rebase | | grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
| gss | git status -s | | gru | git reset -- |
| gst | git status | | grup | git remote update |
| gsta | git stash push | | grv | git remote --verbose |
| gsta | git stash save | | gsb | git status --short -b |
| gstaa | git stash apply | | gsd | git svn dcommit |
| gstc | git stash clear | | gsh | git show |
| gstd | git stash drop | | gsi | git submodule init |
| gstl | git stash list | | gsps | git show --pretty=short --show-signature |
| gstp | git stash pop | | gsr | git svn rebase |
| gsts | git stash show --text | | gss | git status --short |
| gstu | git stash --include-untracked | | gst | git status |
| gstall | git stash --all | | gsta | git stash push (git version >= 2.13) |
| gsu | git submodule update | | gsta | git stash save (git version < 2.13) |
| gsw | git switch | | gstaa | git stash apply |
| gswc | git switch -c | | gstc | git stash clear |
| gswm | git switch $(git_main_branch) | | gstd | git stash drop |
| gswd | git switch $(git_develop_branch) | | gstl | git stash list |
| gts | git tag -s | | gstp | git stash pop |
| gtv | git tag \| sort -V | | gsts | git stash show --text |
| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl | | gstu | git stash --include-untracked |
| gunignore | git update-index --no-assume-unchanged | | gstall | git stash --all |
| gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 | | gsu | git submodule update |
| gup | git pull --rebase | | gsw | git switch |
| gupv | git pull --rebase -v | | gswc | git switch -c |
| gupa | git pull --rebase --autostash | | gswm | git switch $(git_main_branch) |
| gupav | git pull --rebase --autostash -v | | gswd | git switch $(git_develop_branch) |
| glum | git pull upstream $(git_main_branch) | | gts | git tag -s |
| gwch | git whatchanged -p --abbrev-commit --pretty=medium | | gtv | git tag \| sort -V |
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" | | gtl | gtl(){ git tag --sort=-v:refname -n --list ${1}\* }; noglob gtl |
| gam | git am | | gunignore | git update-index --no-assume-unchanged |
| gamc | git am --continue | | gunwip | git log --max-count=1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 |
| gams | git am --skip | | gup | git pull --rebase |
| gama | git am --abort | | gupv | git pull --rebase --verbose |
| gamscp | git am --show-current-patch | | gupa | git pull --rebase --autostash |
| gupav | git pull --rebase --autostash --verbose |
| gupom | git pull --rebase origin $(git_main_branch) |
| gupomi | git pull --rebase=interactive origin $(git_main_branch) |
| glum | git pull upstream $(git_main_branch) |
| gluc | git pull upstream $(git_current_branch) |
| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]" |
| gam | git am |
| gamc | git am --continue |
| gams | git am --skip |
| gama | git am --abort |
| gamscp | git am --show-current-patch |
| gwt | git worktree |
| gwtls | git worktree list |
| gwtmv | git worktree move |
| gwtrm | git worktree remove |
### Main branch preference ### Main branch preference
@ -220,7 +236,7 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa
### Current ### Current
| Command | Description | | Command | Description |
|:-----------------------|:---------------------------------------------------------------------------------------------------------| | :--------------------- | :------------------------------------------------------------------------------------------------------- |
| `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote | | `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote |
| current_branch | Return the name of the current branch | | current_branch | Return the name of the current branch |
| git_current_user_name | Returns the `user.name` config value | | git_current_user_name | Returns the `user.name` config value |
@ -233,13 +249,13 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa
These features allow to pause a branch development and switch to another one (_"Work in Progress"_, or wip). When you want to go back to work, just unwip it. These features allow to pause a branch development and switch to another one (_"Work in Progress"_, or wip). When you want to go back to work, just unwip it.
| Command | Description | | Command | Description |
|:-----------------|:------------------------------------------------| | :--------------- | :---------------------------------------------- |
| work_in_progress | Echoes a warning if the current branch is a wip | | work_in_progress | Echoes a warning if the current branch is a wip |
| gwip | Commit wip branch | | gwip | Commit wip branch |
| gunwip | Uncommit wip branch | | gunwip | Uncommit wip branch |
### Deprecated functions ### Deprecated functions
| Command | Description | Reason | | Command | Description | Reason |
|:-----------------------|:----------------------------------------|:----------------------------------------------------------------| | :----------------- | :-------------------------------------- | :-------------------------------------------------------------- |
| current_repository | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias) | | current_repository | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias) |

View file

@ -31,7 +31,7 @@ function work_in_progress() {
function git_main_branch() { function git_main_branch() {
command git rev-parse --git-dir &>/dev/null || return command git rev-parse --git-dir &>/dev/null || return
local ref local ref
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk}; do for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}; do
if command git show-ref -q --verify $ref; then if command git show-ref -q --verify $ref; then
echo ${ref:t} echo ${ref:t}
return return
@ -69,10 +69,13 @@ alias gap='git apply'
alias gapt='git apply --3way' alias gapt='git apply --3way'
alias gb='git branch' alias gb='git branch'
alias gba='git branch -a' alias gba='git branch --all'
alias gbd='git branch -d' alias gbd='git branch --delete'
alias gbda='git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch -d 2>/dev/null' alias gbda='git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null'
alias gbD='git branch -D' alias gbD='git branch --delete --force'
alias gbg='git branch -vv | grep ": gone\]"'
alias gbgd='local res=$(gbg | awk '"'"'{print $1}'"'"') && [[ $res ]] && echo $res | xargs git branch -d'
alias gbgD='local res=$(gbg | awk '"'"'{print $1}'"'"') && [[ $res ]] && echo $res | xargs git branch -D'
alias gbl='git blame -b -w' alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged' alias gbnm='git branch --no-merged'
alias gbr='git branch --remote' alias gbr='git branch --remote'
@ -82,17 +85,17 @@ alias gbsg='git bisect good'
alias gbsr='git bisect reset' alias gbsr='git bisect reset'
alias gbss='git bisect start' alias gbss='git bisect start'
alias gc='git commit -v' alias gc='git commit --verbose'
alias gc!='git commit -v --amend' alias gc!='git commit --verbose --amend'
alias gcn!='git commit -v --no-edit --amend' alias gcn!='git commit --verbose --no-edit --amend'
alias gca='git commit -v -a' alias gca='git commit --verbose --all'
alias gca!='git commit -v -a --amend' alias gca!='git commit --verbose --all --amend'
alias gcan!='git commit -v -a --no-edit --amend' alias gcan!='git commit --verbose --all --no-edit --amend'
alias gcans!='git commit -v -a -s --no-edit --amend' alias gcans!='git commit --verbose --all --signoff --no-edit --amend'
alias gcam='git commit -a -m' alias gcam='git commit --all --message'
alias gcsm='git commit -s -m' alias gcsm='git commit --signoff --message'
alias gcas='git commit -a -s' alias gcas='git commit --all --signoff'
alias gcasm='git commit -a -s -m' alias gcasm='git commit --all --signoff --message'
alias gcb='git checkout -b' alias gcb='git checkout -b'
alias gcf='git config --list' alias gcf='git config --list'
@ -103,20 +106,20 @@ function gccd() {
compdef _git gccd=git-clone compdef _git gccd=git-clone
alias gcl='git clone --recurse-submodules' alias gcl='git clone --recurse-submodules'
alias gclean='git clean -id' alias gclean='git clean --interactive -d'
alias gpristine='git reset --hard && git clean -dffx' alias gpristine='git reset --hard && git clean --force -dfx'
alias gcm='git checkout $(git_main_branch)' alias gcm='git checkout $(git_main_branch)'
alias gcd='git checkout $(git_develop_branch)' alias gcd='git checkout $(git_develop_branch)'
alias gcmsg='git commit -m' alias gcmsg='git commit --message'
alias gco='git checkout' alias gco='git checkout'
alias gcor='git checkout --recurse-submodules' alias gcor='git checkout --recurse-submodules'
alias gcount='git shortlog -sn' alias gcount='git shortlog --summary --numbered'
alias gcp='git cherry-pick' alias gcp='git cherry-pick'
alias gcpa='git cherry-pick --abort' alias gcpa='git cherry-pick --abort'
alias gcpc='git cherry-pick --continue' alias gcpc='git cherry-pick --continue'
alias gcs='git commit -S' alias gcs='git commit --gpg-sign'
alias gcss='git commit -S -s' alias gcss='git commit --gpg-sign --signoff'
alias gcssm='git commit -S -s -m' alias gcssm='git commit --gpg-sign --signoff --message'
alias gd='git diff' alias gd='git diff'
alias gdca='git diff --cached' alias gdca='git diff --cached'
@ -199,6 +202,9 @@ alias ggpush='git push origin "$(git_current_branch)"'
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
alias gpsup='git push --set-upstream origin $(git_current_branch)' alias gpsup='git push --set-upstream origin $(git_current_branch)'
is-at-least 2.30 "$git_version" \
&& alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes' \
|| alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease'
alias ghh='git help' alias ghh='git help'
@ -207,11 +213,11 @@ alias gignored='git ls-files -v | grep "^[[:lower:]]"'
alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
alias gk='\gitk --all --branches &!' alias gk='\gitk --all --branches &!'
alias gke='\gitk --all $(git log -g --pretty=%h) &!' alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
alias gl='git pull' alias gl='git pull'
alias glg='git log --stat' alias glg='git log --stat'
alias glgp='git log --stat -p' alias glgp='git log --stat --patch'
alias glgg='git log --graph' alias glgg='git log --graph'
alias glgga='git log --graph --decorate --all' alias glgga='git log --graph --decorate --all'
alias glgm='git log --graph --max-count=10' alias glgm='git log --graph --max-count=10'
@ -234,12 +240,15 @@ alias gma='git merge --abort'
alias gp='git push' alias gp='git push'
alias gpd='git push --dry-run' alias gpd='git push --dry-run'
alias gpf='git push --force-with-lease' is-at-least 2.30 "$git_version" \
&& alias gpf='git push --force-with-lease --force-if-includes' \
|| alias gpf='git push --force-with-lease'
alias gpf!='git push --force' alias gpf!='git push --force'
alias gpoat='git push origin --all && git push origin --tags' alias gpoat='git push origin --all && git push origin --tags'
alias gpod='git push origin --delete'
alias gpr='git pull --rebase' alias gpr='git pull --rebase'
alias gpu='git push upstream' alias gpu='git push upstream'
alias gpv='git push -v' alias gpv='git push --verbose'
alias gr='git remote' alias gr='git remote'
alias gra='git remote add' alias gra='git remote add'
@ -247,7 +256,7 @@ alias grb='git rebase'
alias grba='git rebase --abort' alias grba='git rebase --abort'
alias grbc='git rebase --continue' alias grbc='git rebase --continue'
alias grbd='git rebase $(git_develop_branch)' alias grbd='git rebase $(git_develop_branch)'
alias grbi='git rebase -i' alias grbi='git rebase --interactive'
alias grbm='git rebase $(git_main_branch)' alias grbm='git rebase $(git_main_branch)'
alias grbom='git rebase origin/$(git_main_branch)' alias grbom='git rebase origin/$(git_main_branch)'
alias grbo='git rebase --onto' alias grbo='git rebase --onto'
@ -267,15 +276,15 @@ alias grst='git restore --staged'
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
alias gru='git reset --' alias gru='git reset --'
alias grup='git remote update' alias grup='git remote update'
alias grv='git remote -v' alias grv='git remote --verbose'
alias gsb='git status -sb' alias gsb='git status --short --branch'
alias gsd='git svn dcommit' alias gsd='git svn dcommit'
alias gsh='git show' alias gsh='git show'
alias gsi='git submodule init' alias gsi='git submodule init'
alias gsps='git show --pretty=short --show-signature' alias gsps='git show --pretty=short --show-signature'
alias gsr='git svn rebase' alias gsr='git svn rebase'
alias gss='git status -s' alias gss='git status --short'
alias gst='git status' alias gst='git status'
# use the default stash push on git 2.13 and newer # use the default stash push on git 2.13 and newer
@ -293,24 +302,33 @@ alias gstu='gsta --include-untracked'
alias gstall='git stash --all' alias gstall='git stash --all'
alias gsu='git submodule update' alias gsu='git submodule update'
alias gsw='git switch' alias gsw='git switch'
alias gswc='git switch -c' alias gswc='git switch --create'
alias gswm='git switch $(git_main_branch)' alias gswm='git switch $(git_main_branch)'
alias gswd='git switch $(git_develop_branch)' alias gswd='git switch $(git_develop_branch)'
alias gts='git tag -s' alias gts='git tag --sign'
alias gtv='git tag | sort -V' alias gtv='git tag | sort -V'
alias gtl='gtl(){ git tag --sort=-v:refname -n -l "${1}*" }; noglob gtl' alias gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl'
alias gunignore='git update-index --no-assume-unchanged' alias gunignore='git update-index --no-assume-unchanged'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' alias gunwip='git log --max-count=1 | grep -q -c "\--wip--" && git reset HEAD~1'
alias gup='git pull --rebase' alias gup='git pull --rebase'
alias gupv='git pull --rebase -v' alias gupv='git pull --rebase --verbose'
alias gupa='git pull --rebase --autostash' alias gupa='git pull --rebase --autostash'
alias gupav='git pull --rebase --autostash -v' alias gupav='git pull --rebase --autostash --verbose'
alias gupom='git pull --rebase origin $(git_main_branch)'
alias gupomi='git pull --rebase=interactive origin $(git_main_branch)'
alias glum='git pull upstream $(git_main_branch)' alias glum='git pull upstream $(git_main_branch)'
alias gluc='git pull upstream $(git_current_branch)'
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"' alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
alias gwt='git worktree'
alias gwta='git worktree add'
alias gwtls='git worktree list'
alias gwtmv='git worktree move'
alias gwtrm='git worktree remove'
alias gam='git am' alias gam='git am'
alias gamc='git am --continue' alias gamc='git am --continue'

View file

@ -49,6 +49,11 @@
# and git-switch completion (e.g., completing "foo" when "origin/foo" # and git-switch completion (e.g., completing "foo" when "origin/foo"
# exists). # exists).
# #
# GIT_COMPLETION_SHOW_ALL_COMMANDS
#
# When set to "1" suggest all commands, including plumbing commands
# which are hidden by default (e.g. "cat-file" on "git ca<TAB>").
#
# GIT_COMPLETION_SHOW_ALL # GIT_COMPLETION_SHOW_ALL
# #
# When set to "1" suggest all options, including options which are # When set to "1" suggest all options, including options which are
@ -321,19 +326,19 @@ __gitcomp_builtin_apply_default=" --exclude= --include= --no-add --stat --numsta
__gitcomp_builtin_archive_default=" --output= --remote= --exec= --no-output -- --no-remote --no-exec" __gitcomp_builtin_archive_default=" --output= --remote= --exec= --no-output -- --no-remote --no-exec"
__gitcomp_builtin_bisect__helper_default=" --bisect-reset --bisect-next-check --bisect-terms --bisect-start --bisect-next --bisect-state --bisect-log --bisect-replay --bisect-skip --bisect-visualize --bisect-run --no-log --log" __gitcomp_builtin_bisect__helper_default=" --bisect-reset --bisect-next-check --bisect-terms --bisect-start --bisect-next --bisect-state --bisect-log --bisect-replay --bisect-skip --bisect-visualize --bisect-run --no-log --log"
__gitcomp_builtin_blame_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev" __gitcomp_builtin_blame_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev"
__gitcomp_builtin_branch_default=" --verbose --quiet --track --set-upstream-to= --unset-upstream --color --remotes --contains --no-contains --abbrev --all --delete --move --copy --list --show-current --create-reflog --edit-description --merged --no-merged --column --sort= --points-at= --ignore-case --format= -- --no-verbose --no-quiet --no-track --no-set-upstream-to --no-unset-upstream --no-color --no-remotes --no-abbrev --no-all --no-delete --no-move --no-copy --no-list --no-show-current --no-create-reflog --no-edit-description --no-column --no-sort --no-points-at --no-ignore-case --no-format" __gitcomp_builtin_branch_default=" --verbose --quiet --track --set-upstream-to= --unset-upstream --color --remotes --contains --no-contains --abbrev --all --delete --move --copy --list --show-current --create-reflog --edit-description --merged --no-merged --column --sort= --points-at= --ignore-case --recurse-submodules --format= -- --no-verbose --no-quiet --no-track --no-set-upstream-to --no-unset-upstream --no-color --no-remotes --no-abbrev --no-all --no-delete --no-move --no-copy --no-list --no-show-current --no-create-reflog --no-edit-description --no-column --no-sort --no-points-at --no-ignore-case --no-recurse-submodules --no-format"
__gitcomp_builtin_bugreport_default=" --output-directory= --suffix= --no-output-directory -- --no-suffix" __gitcomp_builtin_bugreport_default=" --output-directory= --suffix= --no-output-directory -- --no-suffix"
__gitcomp_builtin_cat_file_default=" --textconv --filters --path= --allow-unknown-type --buffer --batch --batch-check --follow-symlinks --batch-all-objects --unordered --no-path -- --no-allow-unknown-type --no-buffer --no-follow-symlinks --no-batch-all-objects --no-unordered" __gitcomp_builtin_cat_file_default=" --allow-unknown-type --batch --batch-check --batch-command --batch-all-objects --buffer --follow-symlinks --unordered --textconv --filters --path= --no-allow-unknown-type -- --no-buffer --no-follow-symlinks --no-unordered --no-path"
__gitcomp_builtin_check_attr_default=" --all --cached --stdin --no-all -- --no-cached --no-stdin" __gitcomp_builtin_check_attr_default=" --all --cached --stdin --no-all -- --no-cached --no-stdin"
__gitcomp_builtin_check_ignore_default=" --quiet --verbose --stdin --non-matching --no-index --index -- --no-quiet --no-verbose --no-stdin --no-non-matching" __gitcomp_builtin_check_ignore_default=" --quiet --verbose --stdin --non-matching --no-index --index -- --no-quiet --no-verbose --no-stdin --no-non-matching"
__gitcomp_builtin_check_mailmap_default=" --stdin --no-stdin" __gitcomp_builtin_check_mailmap_default=" --stdin --no-stdin"
__gitcomp_builtin_checkout_default=" --guess --overlay --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-guess -- --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul" __gitcomp_builtin_checkout_default=" --guess --overlay --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-guess -- --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_checkout__worker_default=" --prefix= --no-prefix" __gitcomp_builtin_checkout__worker_default=" --prefix= --no-prefix"
__gitcomp_builtin_checkout_index_default=" --all --force --quiet --no-create --index --stdin --temp --prefix= --stage= --create -- --no-all --no-force --no-quiet --no-index --no-stdin --no-temp --no-prefix" __gitcomp_builtin_checkout_index_default=" --all --ignore-skip-worktree-bits --force --quiet --no-create --index --stdin --temp --prefix= --stage= --create -- --no-all --no-ignore-skip-worktree-bits --no-force --no-quiet --no-index --no-stdin --no-temp --no-prefix"
__gitcomp_builtin_cherry_default=" --abbrev --verbose --no-abbrev -- --no-verbose" __gitcomp_builtin_cherry_default=" --abbrev --verbose --no-abbrev -- --no-verbose"
__gitcomp_builtin_cherry_pick_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --ff --allow-empty --allow-empty-message --keep-redundant-commits --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign --no-ff --no-allow-empty --no-allow-empty-message --no-keep-redundant-commits" __gitcomp_builtin_cherry_pick_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --ff --allow-empty --allow-empty-message --keep-redundant-commits --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign --no-ff --no-allow-empty --no-allow-empty-message --no-keep-redundant-commits"
__gitcomp_builtin_clean_default=" --quiet --dry-run --interactive --exclude= --no-quiet -- --no-dry-run --no-interactive" __gitcomp_builtin_clean_default=" --quiet --dry-run --interactive --exclude= --no-quiet -- --no-dry-run --no-interactive"
__gitcomp_builtin_clone_default=" --verbose --quiet --progress --reject-shallow --no-checkout --bare --mirror --local --no-hardlinks --shared --recurse-submodules --jobs= --template= --reference= --reference-if-able= --dissociate --origin= --branch= --upload-pack= --depth= --shallow-since= --shallow-exclude= --single-branch --no-tags --shallow-submodules --separate-git-dir= --config= --server-option= --ipv4 --ipv6 --filter= --remote-submodules --sparse --checkout --hardlinks --tags -- --no-verbose --no-quiet --no-progress --no-reject-shallow --no-bare --no-mirror --no-local --no-shared --no-recurse-submodules --no-recursive --no-jobs --no-template --no-reference --no-reference-if-able --no-dissociate --no-origin --no-branch --no-upload-pack --no-depth --no-shallow-since --no-shallow-exclude --no-single-branch --no-shallow-submodules --no-separate-git-dir --no-config --no-server-option --no-ipv4 --no-ipv6 --no-filter --no-remote-submodules --no-sparse" __gitcomp_builtin_clone_default=" --verbose --quiet --progress --reject-shallow --no-checkout --bare --mirror --local --no-hardlinks --shared --recurse-submodules --jobs= --template= --reference= --reference-if-able= --dissociate --origin= --branch= --upload-pack= --depth= --shallow-since= --shallow-exclude= --single-branch --no-tags --shallow-submodules --separate-git-dir= --config= --server-option= --ipv4 --ipv6 --filter= --also-filter-submodules --remote-submodules --sparse --checkout --hardlinks --tags -- --no-verbose --no-quiet --no-progress --no-reject-shallow --no-bare --no-mirror --no-local --no-shared --no-recurse-submodules --no-recursive --no-jobs --no-template --no-reference --no-reference-if-able --no-dissociate --no-origin --no-branch --no-upload-pack --no-depth --no-shallow-since --no-shallow-exclude --no-single-branch --no-shallow-submodules --no-separate-git-dir --no-config --no-server-option --no-ipv4 --no-ipv6 --no-filter --no-also-filter-submodules --no-remote-submodules --no-sparse"
__gitcomp_builtin_column_default=" --command= --mode --raw-mode= --width= --indent= --nl= --padding= --no-command -- --no-mode --no-raw-mode --no-width --no-indent --no-nl --no-padding" __gitcomp_builtin_column_default=" --command= --mode --raw-mode= --width= --indent= --nl= --padding= --no-command -- --no-mode --no-raw-mode --no-width --no-indent --no-nl --no-padding"
__gitcomp_builtin_commit_default=" --quiet --verbose --file= --author= --date= --message= --reedit-message= --reuse-message= --fixup= --squash= --reset-author --trailer= --signoff --template= --edit --cleanup= --status --gpg-sign --all --include --interactive --patch --only --no-verify --dry-run --short --branch --ahead-behind --porcelain --long --null --amend --no-post-rewrite --untracked-files --pathspec-from-file= --pathspec-file-nul --verify --post-rewrite -- --no-quiet --no-verbose --no-file --no-author --no-date --no-message --no-reedit-message --no-reuse-message --no-fixup --no-squash --no-reset-author --no-signoff --no-template --no-edit --no-cleanup --no-status --no-gpg-sign --no-all --no-include --no-interactive --no-patch --no-only --no-dry-run --no-short --no-branch --no-ahead-behind --no-porcelain --no-long --no-null --no-amend --no-untracked-files --no-pathspec-from-file --no-pathspec-file-nul" __gitcomp_builtin_commit_default=" --quiet --verbose --file= --author= --date= --message= --reedit-message= --reuse-message= --fixup= --squash= --reset-author --trailer= --signoff --template= --edit --cleanup= --status --gpg-sign --all --include --interactive --patch --only --no-verify --dry-run --short --branch --ahead-behind --porcelain --long --null --amend --no-post-rewrite --untracked-files --pathspec-from-file= --pathspec-file-nul --verify --post-rewrite -- --no-quiet --no-verbose --no-file --no-author --no-date --no-message --no-reedit-message --no-reuse-message --no-fixup --no-squash --no-reset-author --no-signoff --no-template --no-edit --no-cleanup --no-status --no-gpg-sign --no-all --no-include --no-interactive --no-patch --no-only --no-dry-run --no-short --no-branch --no-ahead-behind --no-porcelain --no-long --no-null --no-amend --no-untracked-files --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_commit_graph_default=" --object-dir= --no-object-dir" __gitcomp_builtin_commit_graph_default=" --object-dir= --no-object-dir"
@ -346,31 +351,33 @@ __gitcomp_builtin_describe_default=" --contains --debug --all --tags --long --fi
__gitcomp_builtin_difftool_default=" --gui --dir-diff --no-prompt --symlinks --tool= --tool-help --trust-exit-code --extcmd= --no-index --index -- --no-gui --no-dir-diff --no-symlinks --no-tool --no-tool-help --no-trust-exit-code --no-extcmd" __gitcomp_builtin_difftool_default=" --gui --dir-diff --no-prompt --symlinks --tool= --tool-help --trust-exit-code --extcmd= --no-index --index -- --no-gui --no-dir-diff --no-symlinks --no-tool --no-tool-help --no-trust-exit-code --no-extcmd"
__gitcomp_builtin_env__helper_default=" --type= --default= --exit-code --no-default -- --no-exit-code" __gitcomp_builtin_env__helper_default=" --type= --default= --exit-code --no-default -- --no-exit-code"
__gitcomp_builtin_fast_export_default=" --progress= --signed-tags= --tag-of-filtered-object= --reencode= --export-marks= --import-marks= --import-marks-if-exists= --fake-missing-tagger --full-tree --use-done-feature --no-data --refspec= --anonymize --anonymize-map= --reference-excluded-parents --show-original-ids --mark-tags --data -- --no-progress --no-signed-tags --no-tag-of-filtered-object --no-reencode --no-export-marks --no-import-marks --no-import-marks-if-exists --no-fake-missing-tagger --no-full-tree --no-use-done-feature --no-refspec --no-anonymize --no-reference-excluded-parents --no-show-original-ids --no-mark-tags" __gitcomp_builtin_fast_export_default=" --progress= --signed-tags= --tag-of-filtered-object= --reencode= --export-marks= --import-marks= --import-marks-if-exists= --fake-missing-tagger --full-tree --use-done-feature --no-data --refspec= --anonymize --anonymize-map= --reference-excluded-parents --show-original-ids --mark-tags --data -- --no-progress --no-signed-tags --no-tag-of-filtered-object --no-reencode --no-export-marks --no-import-marks --no-import-marks-if-exists --no-fake-missing-tagger --no-full-tree --no-use-done-feature --no-refspec --no-anonymize --no-reference-excluded-parents --no-show-original-ids --no-mark-tags"
__gitcomp_builtin_fetch_default=" --verbose --quiet --all --set-upstream --append --atomic --upload-pack= --force --multiple --tags --jobs= --prefetch --prune --prune-tags --recurse-submodules --dry-run --write-fetch-head --keep --update-head-ok --progress --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --negotiate-only --filter= --auto-maintenance --auto-gc --show-forced-updates --write-commit-graph --stdin --no-verbose -- --no-quiet --no-all --no-set-upstream --no-append --no-atomic --no-upload-pack --no-force --no-multiple --no-tags --no-jobs --no-prefetch --no-prune --no-prune-tags --no-recurse-submodules --no-dry-run --no-write-fetch-head --no-keep --no-update-head-ok --no-progress --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-negotiate-only --no-filter --no-auto-maintenance --no-auto-gc --no-show-forced-updates --no-write-commit-graph --no-stdin" __gitcomp_builtin_fetch_default=" --verbose --quiet --all --set-upstream --append --atomic --upload-pack= --force --multiple --tags --jobs= --prefetch --prune --prune-tags --recurse-submodules --dry-run --write-fetch-head --keep --update-head-ok --progress --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --refetch --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --negotiate-only --filter= --auto-maintenance --auto-gc --show-forced-updates --write-commit-graph --stdin --no-verbose -- --no-quiet --no-all --no-set-upstream --no-append --no-atomic --no-upload-pack --no-force --no-multiple --no-tags --no-jobs --no-prefetch --no-prune --no-prune-tags --no-recurse-submodules --no-dry-run --no-write-fetch-head --no-keep --no-update-head-ok --no-progress --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-negotiate-only --no-filter --no-auto-maintenance --no-auto-gc --no-show-forced-updates --no-write-commit-graph --no-stdin"
__gitcomp_builtin_fmt_merge_msg_default=" --log --message= --into-name= --file= --no-log -- --no-message --no-into-name --no-file" __gitcomp_builtin_fmt_merge_msg_default=" --log --message= --into-name= --file= --no-log -- --no-message --no-into-name --no-file"
__gitcomp_builtin_for_each_ref_default=" --shell --perl --python --tcl --count= --format= --color --sort= --points-at= --merged --no-merged --contains --no-contains --ignore-case -- --no-shell --no-perl --no-python --no-tcl --no-count --no-format --no-color --no-sort --no-points-at --no-ignore-case" __gitcomp_builtin_for_each_ref_default=" --shell --perl --python --tcl --count= --format= --color --sort= --points-at= --merged --no-merged --contains --no-contains --ignore-case -- --no-shell --no-perl --no-python --no-tcl --no-count --no-format --no-color --no-sort --no-points-at --no-ignore-case"
__gitcomp_builtin_for_each_repo_default=" --config= --no-config" __gitcomp_builtin_for_each_repo_default=" --config= --no-config"
__gitcomp_builtin_format_patch_default=" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor" __gitcomp_builtin_format_patch_default=" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
__gitcomp_builtin_fsck_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects" __gitcomp_builtin_fsck_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
__gitcomp_builtin_fsck_objects_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects" __gitcomp_builtin_fsck_objects_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
__gitcomp_builtin_fsmonitor__daemon_default=""
__gitcomp_builtin_gc_default=" --quiet --prune --aggressive --keep-largest-pack --no-quiet -- --no-prune --no-aggressive --no-keep-largest-pack" __gitcomp_builtin_gc_default=" --quiet --prune --aggressive --keep-largest-pack --no-quiet -- --no-prune --no-aggressive --no-keep-largest-pack"
__gitcomp_builtin_grep_default=" --cached --no-index --untracked --exclude-standard --recurse-submodules --invert-match --ignore-case --word-regexp --text --textconv --recursive --max-depth= --extended-regexp --basic-regexp --fixed-strings --perl-regexp --line-number --column --full-name --files-with-matches --name-only --files-without-match --only-matching --count --color --break --heading --context= --before-context= --after-context= --threads= --show-function --function-context --and --or --not --quiet --all-match --index -- --no-cached --no-untracked --no-exclude-standard --no-recurse-submodules --no-invert-match --no-ignore-case --no-word-regexp --no-text --no-textconv --no-recursive --no-extended-regexp --no-basic-regexp --no-fixed-strings --no-perl-regexp --no-line-number --no-column --no-full-name --no-files-with-matches --no-name-only --no-files-without-match --no-only-matching --no-count --no-color --no-break --no-heading --no-context --no-before-context --no-after-context --no-threads --no-show-function --no-function-context --no-or --no-quiet --no-all-match" __gitcomp_builtin_grep_default=" --cached --no-index --untracked --exclude-standard --recurse-submodules --invert-match --ignore-case --word-regexp --text --textconv --recursive --max-depth= --extended-regexp --basic-regexp --fixed-strings --perl-regexp --line-number --column --full-name --files-with-matches --name-only --files-without-match --only-matching --count --color --break --heading --context= --before-context= --after-context= --threads= --show-function --function-context --and --or --not --quiet --all-match --index -- --no-cached --no-untracked --no-exclude-standard --no-recurse-submodules --no-invert-match --no-ignore-case --no-word-regexp --no-text --no-textconv --no-recursive --no-extended-regexp --no-basic-regexp --no-fixed-strings --no-perl-regexp --no-line-number --no-column --no-full-name --no-files-with-matches --no-name-only --no-files-without-match --no-only-matching --no-count --no-color --no-break --no-heading --no-context --no-before-context --no-after-context --no-threads --no-show-function --no-function-context --no-or --no-quiet --no-all-match"
__gitcomp_builtin_hash_object_default=" --stdin --stdin-paths --no-filters --literally --path= --filters -- --no-stdin --no-stdin-paths --no-literally --no-path" __gitcomp_builtin_hash_object_default=" --stdin --stdin-paths --no-filters --literally --path= --filters -- --no-stdin --no-stdin-paths --no-literally --no-path"
__gitcomp_builtin_help_default=" --all --man --web --info --verbose --guides --config --no-man -- --no-web --no-info --no-verbose" __gitcomp_builtin_help_default=" --all --external-commands --aliases --man --web --info --verbose --guides --config --no-external-commands -- --no-aliases --no-man --no-web --no-info --no-verbose"
__gitcomp_builtin_hook_default=""
__gitcomp_builtin_init_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format" __gitcomp_builtin_init_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
__gitcomp_builtin_init_db_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format" __gitcomp_builtin_init_db_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
__gitcomp_builtin_interpret_trailers_default=" --in-place --trim-empty --where= --if-exists= --if-missing= --only-trailers --only-input --unfold --parse --no-divider --trailer= --divider -- --no-in-place --no-trim-empty --no-where --no-if-exists --no-if-missing --no-only-trailers --no-only-input --no-unfold --no-trailer" __gitcomp_builtin_interpret_trailers_default=" --in-place --trim-empty --where= --if-exists= --if-missing= --only-trailers --only-input --unfold --parse --no-divider --trailer= --divider -- --no-in-place --no-trim-empty --no-where --no-if-exists --no-if-missing --no-only-trailers --no-only-input --no-unfold --no-trailer"
__gitcomp_builtin_log_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate" __gitcomp_builtin_log_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
__gitcomp_builtin_ls_files_default=" --cached --deleted --modified --others --ignored --stage --killed --directory --eol --empty-directory --unmerged --resolve-undo --exclude= --exclude-from= --exclude-per-directory= --exclude-standard --full-name --recurse-submodules --error-unmatch --with-tree= --abbrev --debug --deduplicate --sparse --no-cached -- --no-deleted --no-modified --no-others --no-ignored --no-stage --no-killed --no-directory --no-eol --no-empty-directory --no-unmerged --no-resolve-undo --no-exclude-per-directory --no-recurse-submodules --no-error-unmatch --no-with-tree --no-abbrev --no-debug --no-deduplicate --no-sparse" __gitcomp_builtin_ls_files_default=" --cached --deleted --modified --others --ignored --stage --killed --directory --eol --empty-directory --unmerged --resolve-undo --exclude= --exclude-from= --exclude-per-directory= --exclude-standard --full-name --recurse-submodules --error-unmatch --with-tree= --abbrev --debug --deduplicate --sparse --no-cached -- --no-deleted --no-modified --no-others --no-ignored --no-stage --no-killed --no-directory --no-eol --no-empty-directory --no-unmerged --no-resolve-undo --no-exclude-per-directory --no-recurse-submodules --no-error-unmatch --no-with-tree --no-abbrev --no-debug --no-deduplicate --no-sparse"
__gitcomp_builtin_ls_remote_default=" --quiet --upload-pack= --tags --heads --refs --get-url --sort= --symref --server-option= --no-quiet -- --no-upload-pack --no-tags --no-heads --no-refs --no-get-url --no-sort --no-symref --no-server-option" __gitcomp_builtin_ls_remote_default=" --quiet --upload-pack= --tags --heads --refs --get-url --sort= --symref --server-option= --no-quiet -- --no-upload-pack --no-tags --no-heads --no-refs --no-get-url --no-sort --no-symref --no-server-option"
__gitcomp_builtin_ls_tree_default=" --long --name-only --name-status --full-name --full-tree --abbrev --no-long -- --no-name-only --no-name-status --no-full-name --no-full-tree --no-abbrev" __gitcomp_builtin_ls_tree_default=" --long --name-only --name-status --object-only --full-name --full-tree --format= --abbrev --no-full-name -- --no-full-tree --no-abbrev"
__gitcomp_builtin_merge_default=" --stat --summary --log --squash --commit --edit --cleanup= --ff --ff-only --rerere-autoupdate --verify-signatures --strategy= --strategy-option= --message= --file --into-name= --verbose --quiet --abort --quit --continue --allow-unrelated-histories --progress --gpg-sign --autostash --overwrite-ignore --signoff --no-verify --verify -- --no-stat --no-summary --no-log --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-rerere-autoupdate --no-verify-signatures --no-strategy --no-strategy-option --no-message --no-into-name --no-verbose --no-quiet --no-abort --no-quit --no-continue --no-allow-unrelated-histories --no-progress --no-gpg-sign --no-autostash --no-overwrite-ignore --no-signoff" __gitcomp_builtin_merge_default=" --stat --summary --log --squash --commit --edit --cleanup= --ff --ff-only --rerere-autoupdate --verify-signatures --strategy= --strategy-option= --message= --file --into-name= --verbose --quiet --abort --quit --continue --allow-unrelated-histories --progress --gpg-sign --autostash --overwrite-ignore --signoff --no-verify --verify -- --no-stat --no-summary --no-log --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-rerere-autoupdate --no-verify-signatures --no-strategy --no-strategy-option --no-message --no-into-name --no-verbose --no-quiet --no-abort --no-quit --no-continue --no-allow-unrelated-histories --no-progress --no-gpg-sign --no-autostash --no-overwrite-ignore --no-signoff"
__gitcomp_builtin_merge_base_default=" --all --octopus --independent --is-ancestor --fork-point --no-all" __gitcomp_builtin_merge_base_default=" --all --octopus --independent --is-ancestor --fork-point --no-all"
__gitcomp_builtin_merge_file_default=" --stdout --diff3 --zdiff3 --ours --theirs --union --marker-size= --quiet --no-stdout -- --no-diff3 --no-zdiff3 --no-ours --no-theirs --no-union --no-marker-size --no-quiet" __gitcomp_builtin_merge_file_default=" --stdout --diff3 --zdiff3 --ours --theirs --union --marker-size= --quiet --no-stdout -- --no-diff3 --no-zdiff3 --no-ours --no-theirs --no-union --no-marker-size --no-quiet"
__gitcomp_builtin_mktree_default=" --missing --batch --no-missing -- --no-batch" __gitcomp_builtin_mktree_default=" --missing --batch --no-missing -- --no-batch"
__gitcomp_builtin_multi_pack_index_default=" --object-dir= --no-object-dir" __gitcomp_builtin_multi_pack_index_default=" --object-dir= --no-object-dir"
__gitcomp_builtin_mv_default=" --verbose --dry-run --sparse --no-verbose -- --no-dry-run --no-sparse" __gitcomp_builtin_mv_default=" --verbose --dry-run --sparse --no-verbose -- --no-dry-run --no-sparse"
__gitcomp_builtin_name_rev_default=" --name-only --tags --refs= --exclude= --all --stdin --undefined --always --no-name-only -- --no-tags --no-refs --no-exclude --no-all --no-stdin --no-undefined --no-always" __gitcomp_builtin_name_rev_default=" --name-only --tags --refs= --exclude= --all --stdin --annotate-stdin --undefined --always --no-name-only -- --no-tags --no-refs --no-exclude --no-all --no-stdin --no-annotate-stdin --no-undefined --no-always"
__gitcomp_builtin_notes_default=" --ref= --no-ref" __gitcomp_builtin_notes_default=" --ref= --no-ref"
__gitcomp_builtin_pack_objects_default=" --quiet --progress --all-progress --all-progress-implied --index-version= --max-pack-size= --local --incremental --window= --window-memory= --depth= --reuse-delta --reuse-object --delta-base-offset --threads= --non-empty --revs --unpacked --all --reflog --indexed-objects --stdin-packs --stdout --include-tag --keep-unreachable --pack-loose-unreachable --unpack-unreachable --sparse --thin --shallow --honor-pack-keep --keep-pack= --compression= --keep-true-parents --use-bitmap-index --write-bitmap-index --filter= --missing= --exclude-promisor-objects --delta-islands --uri-protocol= --no-quiet -- --no-progress --no-all-progress --no-all-progress-implied --no-local --no-incremental --no-window --no-depth --no-reuse-delta --no-reuse-object --no-delta-base-offset --no-threads --no-non-empty --no-revs --no-stdin-packs --no-stdout --no-include-tag --no-keep-unreachable --no-pack-loose-unreachable --no-unpack-unreachable --no-sparse --no-thin --no-shallow --no-honor-pack-keep --no-keep-pack --no-compression --no-keep-true-parents --no-use-bitmap-index --no-write-bitmap-index --no-filter --no-exclude-promisor-objects --no-delta-islands --no-uri-protocol" __gitcomp_builtin_pack_objects_default=" --quiet --progress --all-progress --all-progress-implied --index-version= --max-pack-size= --local --incremental --window= --window-memory= --depth= --reuse-delta --reuse-object --delta-base-offset --threads= --non-empty --revs --unpacked --all --reflog --indexed-objects --stdin-packs --stdout --include-tag --keep-unreachable --pack-loose-unreachable --unpack-unreachable --sparse --thin --shallow --honor-pack-keep --keep-pack= --compression= --keep-true-parents --use-bitmap-index --write-bitmap-index --filter= --missing= --exclude-promisor-objects --delta-islands --uri-protocol= --no-quiet -- --no-progress --no-all-progress --no-all-progress-implied --no-local --no-incremental --no-window --no-depth --no-reuse-delta --no-reuse-object --no-delta-base-offset --no-threads --no-non-empty --no-revs --no-stdin-packs --no-stdout --no-include-tag --no-keep-unreachable --no-pack-loose-unreachable --no-unpack-unreachable --no-sparse --no-thin --no-shallow --no-honor-pack-keep --no-keep-pack --no-compression --no-keep-true-parents --no-use-bitmap-index --no-write-bitmap-index --no-filter --no-exclude-promisor-objects --no-delta-islands --no-uri-protocol"
__gitcomp_builtin_pack_refs_default=" --all --prune --no-all -- --no-prune" __gitcomp_builtin_pack_refs_default=" --all --prune --no-all -- --no-prune"
@ -383,12 +390,12 @@ __gitcomp_builtin_range_diff_default=" --creation-factor= --no-dual-color --note
__gitcomp_builtin_read_tree_default=" --index-output= --empty --verbose --trivial --aggressive --reset --prefix= --exclude-per-directory= --dry-run --no-sparse-checkout --debug-unpack --recurse-submodules --quiet --sparse-checkout -- --no-empty --no-verbose --no-trivial --no-aggressive --no-reset --no-dry-run --no-debug-unpack --no-recurse-submodules --no-quiet" __gitcomp_builtin_read_tree_default=" --index-output= --empty --verbose --trivial --aggressive --reset --prefix= --exclude-per-directory= --dry-run --no-sparse-checkout --debug-unpack --recurse-submodules --quiet --sparse-checkout -- --no-empty --no-verbose --no-trivial --no-aggressive --no-reset --no-dry-run --no-debug-unpack --no-recurse-submodules --no-quiet"
__gitcomp_builtin_rebase_default=" --onto= --keep-base --no-verify --quiet --verbose --no-stat --signoff --committer-date-is-author-date --reset-author-date --ignore-whitespace --whitespace= --force-rebase --no-ff --continue --skip --abort --quit --edit-todo --show-current-patch --apply --merge --interactive --rerere-autoupdate --empty= --autosquash --gpg-sign --autostash --exec= --rebase-merges --fork-point --strategy= --strategy-option= --root --reschedule-failed-exec --reapply-cherry-picks --verify --stat --ff -- --no-onto --no-keep-base --no-quiet --no-verbose --no-signoff --no-committer-date-is-author-date --no-reset-author-date --no-ignore-whitespace --no-whitespace --no-force-rebase --no-rerere-autoupdate --no-autosquash --no-gpg-sign --no-autostash --no-exec --no-rebase-merges --no-fork-point --no-strategy --no-strategy-option --no-root --no-reschedule-failed-exec --no-reapply-cherry-picks" __gitcomp_builtin_rebase_default=" --onto= --keep-base --no-verify --quiet --verbose --no-stat --signoff --committer-date-is-author-date --reset-author-date --ignore-whitespace --whitespace= --force-rebase --no-ff --continue --skip --abort --quit --edit-todo --show-current-patch --apply --merge --interactive --rerere-autoupdate --empty= --autosquash --gpg-sign --autostash --exec= --rebase-merges --fork-point --strategy= --strategy-option= --root --reschedule-failed-exec --reapply-cherry-picks --verify --stat --ff -- --no-onto --no-keep-base --no-quiet --no-verbose --no-signoff --no-committer-date-is-author-date --no-reset-author-date --no-ignore-whitespace --no-whitespace --no-force-rebase --no-rerere-autoupdate --no-autosquash --no-gpg-sign --no-autostash --no-exec --no-rebase-merges --no-fork-point --no-strategy --no-strategy-option --no-root --no-reschedule-failed-exec --no-reapply-cherry-picks"
__gitcomp_builtin_receive_pack_default=" --quiet --no-quiet" __gitcomp_builtin_receive_pack_default=" --quiet --no-quiet"
__gitcomp_builtin_reflog_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate" __gitcomp_builtin_reflog_default=""
__gitcomp_builtin_remote_default=" --verbose --no-verbose" __gitcomp_builtin_remote_default=" --verbose --no-verbose"
__gitcomp_builtin_repack_default=" --quiet --local --write-bitmap-index --delta-islands --unpack-unreachable= --keep-unreachable --window= --window-memory= --depth= --threads= --max-pack-size= --pack-kept-objects --keep-pack= --geometric= --write-midx --no-quiet -- --no-local --no-write-bitmap-index --no-delta-islands --no-unpack-unreachable --no-keep-unreachable --no-window --no-window-memory --no-depth --no-threads --no-max-pack-size --no-pack-kept-objects --no-keep-pack --no-geometric --no-write-midx" __gitcomp_builtin_repack_default=" --quiet --local --write-bitmap-index --delta-islands --unpack-unreachable= --keep-unreachable --window= --window-memory= --depth= --threads= --max-pack-size= --pack-kept-objects --keep-pack= --geometric= --write-midx --no-quiet -- --no-local --no-write-bitmap-index --no-delta-islands --no-unpack-unreachable --no-keep-unreachable --no-window --no-window-memory --no-depth --no-threads --no-max-pack-size --no-pack-kept-objects --no-keep-pack --no-geometric --no-write-midx"
__gitcomp_builtin_replace_default=" --list --delete --edit --graft --convert-graft-file --raw --format= --no-raw -- --no-format" __gitcomp_builtin_replace_default=" --list --delete --edit --graft --convert-graft-file --raw --format= --no-raw -- --no-format"
__gitcomp_builtin_rerere_default=" --rerere-autoupdate --no-rerere-autoupdate" __gitcomp_builtin_rerere_default=" --rerere-autoupdate --no-rerere-autoupdate"
__gitcomp_builtin_reset_default=" --quiet --mixed --soft --hard --merge --keep --recurse-submodules --patch --intent-to-add --pathspec-from-file= --pathspec-file-nul --no-quiet -- --no-mixed --no-soft --no-hard --no-merge --no-keep --no-recurse-submodules --no-patch --no-intent-to-add --no-pathspec-from-file --no-pathspec-file-nul" __gitcomp_builtin_reset_default=" --quiet --no-refresh --mixed --soft --hard --merge --keep --recurse-submodules --patch --intent-to-add --pathspec-from-file= --pathspec-file-nul --refresh -- --no-quiet --no-mixed --no-soft --no-hard --no-merge --no-keep --no-recurse-submodules --no-patch --no-intent-to-add --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_restore_default=" --source= --staged --worktree --ignore-unmerged --overlay --quiet --recurse-submodules --progress --merge --conflict= --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-source -- --no-staged --no-worktree --no-ignore-unmerged --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul" __gitcomp_builtin_restore_default=" --source= --staged --worktree --ignore-unmerged --overlay --quiet --recurse-submodules --progress --merge --conflict= --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-source -- --no-staged --no-worktree --no-ignore-unmerged --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_revert_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign" __gitcomp_builtin_revert_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign"
__gitcomp_builtin_rm_default=" --dry-run --quiet --cached --ignore-unmatch --sparse --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-quiet --no-cached --no-ignore-unmatch --no-sparse --no-pathspec-from-file --no-pathspec-file-nul" __gitcomp_builtin_rm_default=" --dry-run --quiet --cached --ignore-unmatch --sparse --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-quiet --no-cached --no-ignore-unmatch --no-sparse --no-pathspec-from-file --no-pathspec-file-nul"
@ -416,7 +423,7 @@ __gitcomp_builtin_verify_tag_default=" --verbose --raw --format= --no-verbose --
__gitcomp_builtin_version_default=" --build-options --no-build-options" __gitcomp_builtin_version_default=" --build-options --no-build-options"
__gitcomp_builtin_whatchanged_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate" __gitcomp_builtin_whatchanged_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
__gitcomp_builtin_write_tree_default=" --missing-ok --prefix= --no-missing-ok -- --no-prefix" __gitcomp_builtin_write_tree_default=" --missing-ok --prefix= --no-missing-ok -- --no-prefix"
__gitcomp_builtin_send_email_default="--cc= --smtp-server= --identity= --smtp-ssl --sender= --from= --cc-cover --no-to-cover --sendmail-cmd= --signed-off-cc --signed-off-by-cc --in-reply-to= --no-cc --confirm= --no-bcc --to= --annotate --smtp-encryption= --relogin-delay= --to-cmd= --smtp-domain= --smtp-auth= --bcc= --quiet --subject= --chain-reply-to --cc-cmd= --no-format-patch --transfer-encoding= --smtp-user= --reply-to= --force --dry-run --no-identity --no-validate --8bit-encoding= --to-cover --compose --thread --format-patch --no-thread --smtp-server-option= --compose-encoding= --smtp-server-port= --no-smtp-auth --no-signed-off-cc --no-signed-off-by-cc --smtp-debug= --no-suppress-from --suppress-from --no-to --dump-aliases --xmailer --no-annotate --no-cc-cover --smtp-pass= --smtp-ssl-cert-path= --no-chain-reply-to --suppress-cc= --validate --batch-size= --envelope-sender= --no-xmailer --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor" __gitcomp_builtin_send_email_default="--sender= --from= --smtp-auth= --8bit-encoding= --no-format-patch --no-bcc --no-suppress-from --no-annotate --relogin-delay= --no-cc --no-signed-off-cc --no-signed-off-by-cc --no-chain-reply-to --smtp-debug= --smtp-domain= --chain-reply-to --dry-run --compose --bcc= --smtp-user= --thread --cc-cover --identity= --to= --reply-to= --no-cc-cover --suppress-cc= --to-cmd= --smtp-server= --smtp-ssl-cert-path= --no-thread --smtp-server-option= --quiet --batch-size= --envelope-sender= --smtp-ssl --no-to --validate --format-patch --suppress-from --cc= --compose-encoding= --to-cover --in-reply-to= --annotate --smtp-encryption= --cc-cmd= --smtp-server-port= --smtp-pass= --signed-off-cc --signed-off-by-cc --no-xmailer --subject= --no-to-cover --confirm= --transfer-encoding= --no-smtp-auth --sendmail-cmd= --no-validate --no-identity --dump-aliases --xmailer --force --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
__gitcomp_builtin_get_default () __gitcomp_builtin_get_default ()
{ {
@ -2841,6 +2848,10 @@ _git_restore ()
--*) --*)
__gitcomp_builtin restore __gitcomp_builtin restore
;; ;;
*)
if __git rev-parse --verify --quiet HEAD >/dev/null; then
__git_complete_index_file "--modified"
fi
esac esac
} }
@ -2942,9 +2953,37 @@ _git_show_branch ()
__git_complete_revlist __git_complete_revlist
} }
__gitcomp_directories ()
{
local _tmp_dir _tmp_completions _found=0
# Get the directory of the current token; this differs from dirname
# in that it keeps up to the final trailing slash. If no slash found
# that's fine too.
[[ "$cur" =~ .*/ ]]
_tmp_dir=$BASH_REMATCH
# Find possible directory completions, adding trailing '/' characters,
# de-quoting, and handling unusual characters.
while IFS= read -r -d $'\0' c ; do
# If there are directory completions, find ones that start
# with "$cur", the current token, and put those in COMPREPLY
if [[ $c == "$cur"* ]]; then
COMPREPLY+=("$c/")
_found=1
fi
done < <(git ls-tree -z -d --name-only HEAD $_tmp_dir)
if [[ $_found == 0 ]] && [[ "$cur" =~ /$ ]]; then
# No possible further completions any deeper, so assume we're at
# a leaf directory and just consider it complete
__gitcomp_direct_append "$cur "
fi
}
_git_sparse_checkout () _git_sparse_checkout ()
{ {
local subcommands="list init set disable" local subcommands="list init set disable add reapply"
local subcommand="$(__git_find_on_cmdline "$subcommands")" local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then if [ -z "$subcommand" ]; then
__gitcomp "$subcommands" __gitcomp "$subcommands"
@ -2952,14 +2991,14 @@ _git_sparse_checkout ()
fi fi
case "$subcommand,$cur" in case "$subcommand,$cur" in
init,--*) *,--*)
__gitcomp_opts "--cone" __gitcomp_builtin sparse-checkout_$subcommand "" "--"
;;
set,--*)
__gitcomp_opts "--stdin"
;;
*)
;; ;;
set,*|add,*)
if [ "$(__git config core.sparseCheckoutCone)" == "true" ] ||
[ -n "$(__git_find_on_cmdline --cone)" ]; then
__gitcomp_directories
fi
esac esac
} }
@ -3411,7 +3450,13 @@ __git_main ()
then then
__gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST" __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
else else
__gitcomp_nl "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)" local list_cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config
if test "${GIT_COMPLETION_SHOW_ALL_COMMANDS-}" = "1"
then
list_cmds=builtins,$list_cmds
fi
__gitcomp_nl "$(__git --list-cmds=$list_cmds)"
fi fi
;; ;;
esac esac
@ -3589,9 +3634,9 @@ if ! git --list-cmds=main >/dev/null 2>&1; then
__git_cmds[list-complete]="apply blame cherry config difftool fsck help instaweb mergetool prune reflog remote repack replace request-pull send-email show-branch stage whatchanged" __git_cmds[list-complete]="apply blame cherry config difftool fsck help instaweb mergetool prune reflog remote repack replace request-pull send-email show-branch stage whatchanged"
__git_cmds[list-guide]="attributes cli core-tutorial credentials cvs-migration diffcore everyday faq glossary hooks ignore mailmap modules namespaces remote-helpers repository-layout revisions submodules tutorial tutorial-2 workflows" __git_cmds[list-guide]="attributes cli core-tutorial credentials cvs-migration diffcore everyday faq glossary hooks ignore mailmap modules namespaces remote-helpers repository-layout revisions submodules tutorial tutorial-2 workflows"
__git_cmds[list-mainporcelain]="add am archive bisect branch bundle checkout cherry-pick citool clean clone commit describe diff fetch format-patch gc grep gui init log maintenance merge mv notes pull push range-diff rebase reset restore revert rm shortlog show sparse-checkout stash status submodule switch tag worktree gitk" __git_cmds[list-mainporcelain]="add am archive bisect branch bundle checkout cherry-pick citool clean clone commit describe diff fetch format-patch gc grep gui init log maintenance merge mv notes pull push range-diff rebase reset restore revert rm shortlog show sparse-checkout stash status submodule switch tag worktree gitk"
__git_cmds[main]="add add--interactive am annotate apply archimport archive bisect bisect--helper blame branch bugreport bundle cat-file check-attr check-ignore check-mailmap check-ref-format checkout checkout--worker checkout-index cherry cherry-pick citool clean clone column commit commit-graph commit-tree config count-objects credential credential-cache credential-cache--daemon credential-gnome-keyring credential-libsecret credential-store cvsexportcommit cvsimport cvsserver daemon describe diff diff-files diff-index diff-tree difftool difftool--helper env--helper fast-export fast-import fetch fetch-pack filter-branch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects gc get-tar-commit-id grep gui gui--askpass hash-object help http-backend http-fetch http-push imap-send index-pack init init-db instaweb interpret-trailers log ls-files ls-remote ls-tree mailinfo mailsplit maintenance merge merge-base merge-file merge-index merge-octopus merge-one-file merge-ours merge-recursive merge-recursive-ours merge-recursive-theirs merge-resolve merge-subtree merge-tree mergetool mktag mktree multi-pack-index mv mw name-rev notes p4 pack-objects pack-redundant pack-refs patch-id pickaxe prune prune-packed pull push quiltimport range-diff read-tree rebase receive-pack reflog remote remote-ext remote-fd remote-ftp remote-ftps remote-http remote-https remote-mediawiki repack replace request-pull rerere reset restore rev-list rev-parse revert rm send-email send-pack sh-i18n--envsubst shell shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace submodule submodule--helper subtree svn switch symbolic-ref tag unpack-file unpack-objects update-index update-ref update-server-info upload-archive upload-archive--writer upload-pack var verify-commit verify-pack verify-tag version web--browse whatchanged worktree write-tree" __git_cmds[main]="add add--interactive am annotate apply archimport archive bisect bisect--helper blame branch bugreport bundle cat-file check-attr check-ignore check-mailmap check-ref-format checkout checkout--worker checkout-index cherry cherry-pick citool clean clone column commit commit-graph commit-tree config count-objects credential credential-cache credential-cache--daemon credential-store cvsexportcommit cvsimport cvsserver daemon describe diff diff-files diff-index diff-tree difftool difftool--helper env--helper fast-export fast-import fetch fetch-pack filter-branch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc get-tar-commit-id grep gui gui--askpass hash-object help hook http-backend http-fetch http-push imap-send index-pack init init-db instaweb interpret-trailers legacy-rebase legacy-stash log ls-files ls-remote ls-tree mailinfo mailsplit maintenance merge merge-base merge-file merge-index merge-octopus merge-one-file merge-ours merge-recursive merge-recursive-ours merge-recursive-theirs merge-resolve merge-subtree merge-tree mergetool mktag mktree multi-pack-index mv name-rev notes p4 pack-objects pack-redundant pack-refs patch-id pickaxe prune prune-packed pull push quiltimport range-diff read-tree rebase rebase--helper receive-pack reflog relink remote remote-ext remote-fd remote-ftp remote-ftps remote-http remote-https remote-testsvn repack replace request-pull rerere reset restore rev-list rev-parse revert rm send-email send-pack serve sh-i18n--envsubst shell shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace submodule submodule--helper svn switch symbolic-ref tag unpack-file unpack-objects update-index update-ref update-server-info upload-archive upload-archive--writer upload-pack var verify-commit verify-pack verify-tag version web--browse whatchanged worktree write-tree"
__git_cmds[others]="" __git_cmds[others]=""
__git_cmds[parseopt]="add am apply archive bisect--helper blame branch bugreport cat-file check-attr check-ignore check-mailmap checkout checkout--worker checkout-index cherry cherry-pick clean clone column commit commit-graph config count-objects credential-cache credential-cache--daemon credential-store describe difftool env--helper fast-export fetch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects gc grep hash-object help init init-db interpret-trailers log ls-files ls-remote ls-tree merge merge-base merge-file mktree multi-pack-index mv name-rev notes pack-objects pack-refs pickaxe prune prune-packed pull push range-diff read-tree rebase receive-pack reflog remote repack replace rerere reset restore revert rm send-pack shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace switch symbolic-ref tag update-index update-ref update-server-info upload-pack verify-commit verify-pack verify-tag version whatchanged write-tree " __git_cmds[parseopt]="add am apply archive bisect--helper blame branch bugreport cat-file check-attr check-ignore check-mailmap checkout checkout--worker checkout-index cherry cherry-pick clean clone column commit commit-graph config count-objects credential-cache credential-cache--daemon credential-store describe difftool env--helper fast-export fetch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc grep hash-object help hook init init-db interpret-trailers log ls-files ls-remote ls-tree merge merge-base merge-file mktree multi-pack-index mv name-rev notes pack-objects pack-refs pickaxe prune prune-packed pull push range-diff read-tree rebase receive-pack reflog remote repack replace rerere reset restore revert rm send-pack shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace switch symbolic-ref tag update-index update-ref update-server-info upload-pack verify-commit verify-pack verify-tag version whatchanged write-tree "
# Override __git # Override __git
__git () __git ()

View file

@ -66,6 +66,11 @@
# git always compare HEAD to @{upstream} # git always compare HEAD to @{upstream}
# svn always compare HEAD to your SVN upstream # svn always compare HEAD to your SVN upstream
# #
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
# find one, or @{upstream} otherwise. Once you have set
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
# setting the bash.showUpstream config variable.
#
# You can change the separator between the branch name and the above # You can change the separator between the branch name and the above
# state symbols by setting GIT_PS1_STATESEPARATOR. The default separator # state symbols by setting GIT_PS1_STATESEPARATOR. The default separator
# is SP. # is SP.
@ -79,11 +84,6 @@
# single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted # single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted
# by setting GIT_PS1_OMITSPARSESTATE. # by setting GIT_PS1_OMITSPARSESTATE.
# #
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
# find one, or @{upstream} otherwise. Once you have set
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
# setting the bash.showUpstream config variable.
#
# If you would like to see more information about the identity of # If you would like to see more information about the identity of
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE # commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
# to one of these values: # to one of these values:
@ -115,7 +115,7 @@ __git_ps1_show_upstream ()
{ {
local key value local key value
local svn_remote svn_url_pattern count n local svn_remote svn_url_pattern count n
local upstream=git legacy="" verbose="" name="" local upstream_type=git legacy="" verbose="" name=""
svn_remote=() svn_remote=()
# get some config options from git-config # get some config options from git-config
@ -132,7 +132,7 @@ __git_ps1_show_upstream ()
svn-remote.*.url) svn-remote.*.url)
svn_remote[$((${#svn_remote[@]} + 1))]="$value" svn_remote[$((${#svn_remote[@]} + 1))]="$value"
svn_url_pattern="$svn_url_pattern\\|$value" svn_url_pattern="$svn_url_pattern\\|$value"
upstream=svn+git # default upstream is SVN if available, else git upstream_type=svn+git # default upstream type is SVN if available, else git
;; ;;
esac esac
done <<< "$output" done <<< "$output"
@ -141,16 +141,16 @@ __git_ps1_show_upstream ()
local option local option
for option in ${GIT_PS1_SHOWUPSTREAM}; do for option in ${GIT_PS1_SHOWUPSTREAM}; do
case "$option" in case "$option" in
git|svn) upstream="$option" ;; git|svn) upstream_type="$option" ;;
verbose) verbose=1 ;; verbose) verbose=1 ;;
legacy) legacy=1 ;; legacy) legacy=1 ;;
name) name=1 ;; name) name=1 ;;
esac esac
done done
# Find our upstream # Find our upstream type
case "$upstream" in case "$upstream_type" in
git) upstream="@{upstream}" ;; git) upstream_type="@{upstream}" ;;
svn*) svn*)
# get the upstream from the "git-svn-id: ..." in a commit message # get the upstream from the "git-svn-id: ..." in a commit message
# (git-svn uses essentially the same procedure internally) # (git-svn uses essentially the same procedure internally)
@ -167,12 +167,12 @@ __git_ps1_show_upstream ()
if [[ -z "$svn_upstream" ]]; then if [[ -z "$svn_upstream" ]]; then
# default branch name for checkouts with no layout: # default branch name for checkouts with no layout:
upstream=${GIT_SVN_ID:-git-svn} upstream_type=${GIT_SVN_ID:-git-svn}
else else
upstream=${svn_upstream#/} upstream_type=${svn_upstream#/}
fi fi
elif [[ "svn+git" = "$upstream" ]]; then elif [[ "svn+git" = "$upstream_type" ]]; then
upstream="@{upstream}" upstream_type="@{upstream}"
fi fi
;; ;;
esac esac
@ -180,11 +180,11 @@ __git_ps1_show_upstream ()
# Find how many commits we are ahead/behind our upstream # Find how many commits we are ahead/behind our upstream
if [[ -z "$legacy" ]]; then if [[ -z "$legacy" ]]; then
count="$(git rev-list --count --left-right \ count="$(git rev-list --count --left-right \
"$upstream"...HEAD 2>/dev/null)" "$upstream_type"...HEAD 2>/dev/null)"
else else
# produce equivalent output to --count for older versions of git # produce equivalent output to --count for older versions of git
local commits local commits
if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)" if commits="$(git rev-list --left-right "$upstream_type"...HEAD 2>/dev/null)"
then then
local commit behind=0 ahead=0 local commit behind=0 ahead=0
for commit in $commits for commit in $commits
@ -214,26 +214,26 @@ __git_ps1_show_upstream ()
*) # diverged from upstream *) # diverged from upstream
p="<>" ;; p="<>" ;;
esac esac
else else # verbose, set upstream instead of p
case "$count" in case "$count" in
"") # no upstream "") # no upstream
p="" ;; upstream="" ;;
"0 0") # equal to upstream "0 0") # equal to upstream
p=" u=" ;; upstream="|u=" ;;
"0 "*) # ahead of upstream "0 "*) # ahead of upstream
p=" u+${count#0 }" ;; upstream="|u+${count#0 }" ;;
*" 0") # behind upstream *" 0") # behind upstream
p=" u-${count% 0}" ;; upstream="|u-${count% 0}" ;;
*) # diverged from upstream *) # diverged from upstream
p=" u+${count#* }-${count% *}" ;; upstream="|u+${count#* }-${count% *}" ;;
esac esac
if [[ -n "$count" && -n "$name" ]]; then if [[ -n "$count" && -n "$name" ]]; then
__git_ps1_upstream_name=$(git rev-parse \ __git_ps1_upstream_name=$(git rev-parse \
--abbrev-ref "$upstream" 2>/dev/null) --abbrev-ref "$upstream_type" 2>/dev/null)
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
p="$p \${__git_ps1_upstream_name}" upstream="$upstream \${__git_ps1_upstream_name}"
else else
p="$p ${__git_ps1_upstream_name}" upstream="$upstream ${__git_ps1_upstream_name}"
# not needed anymore; keep user's # not needed anymore; keep user's
# environment clean # environment clean
unset __git_ps1_upstream_name unset __git_ps1_upstream_name
@ -245,7 +245,8 @@ __git_ps1_show_upstream ()
# Helper function that is meant to be called from __git_ps1. It # Helper function that is meant to be called from __git_ps1. It
# injects color codes into the appropriate gitstring variables used # injects color codes into the appropriate gitstring variables used
# to build a gitstring. # to build a gitstring. Colored variables are responsible for clearing
# their own color.
__git_ps1_colorize_gitstring () __git_ps1_colorize_gitstring ()
{ {
if [[ -n ${ZSH_VERSION-} ]]; then if [[ -n ${ZSH_VERSION-} ]]; then
@ -271,22 +272,23 @@ __git_ps1_colorize_gitstring ()
else else
branch_color="$bad_color" branch_color="$bad_color"
fi fi
c="$branch_color$c" if [ -n "$c" ]; then
c="$branch_color$c$c_clear"
fi
b="$branch_color$b$c_clear"
z="$c_clear$z" if [ -n "$w" ]; then
if [ "$w" = "*" ]; then w="$bad_color$w$c_clear"
w="$bad_color$w"
fi fi
if [ -n "$i" ]; then if [ -n "$i" ]; then
i="$ok_color$i" i="$ok_color$i$c_clear"
fi fi
if [ -n "$s" ]; then if [ -n "$s" ]; then
s="$flags_color$s" s="$flags_color$s$c_clear"
fi fi
if [ -n "$u" ]; then if [ -n "$u" ]; then
u="$bad_color$u" u="$bad_color$u$c_clear"
fi fi
r="$c_clear$r"
} }
# Helper function to read the first line of a file into a variable. # Helper function to read the first line of a file into a variable.
@ -512,7 +514,8 @@ __git_ps1 ()
local u="" local u=""
local h="" local h=""
local c="" local c=""
local p="" local p="" # short version of upstream state indicator
local upstream="" # verbose version of upstream state indicator
if [ "true" = "$inside_gitdir" ]; then if [ "true" = "$inside_gitdir" ]; then
if [ "true" = "$bare_repo" ]; then if [ "true" = "$bare_repo" ]; then
@ -555,6 +558,12 @@ __git_ps1 ()
local z="${GIT_PS1_STATESEPARATOR-" "}" local z="${GIT_PS1_STATESEPARATOR-" "}"
b=${b##refs/heads/}
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
__git_ps1_branch_name=$b
b="\${__git_ps1_branch_name}"
fi
# NO color option unless in PROMPT_COMMAND mode or it's Zsh # NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
@ -562,14 +571,8 @@ __git_ps1 ()
fi fi
fi fi
b=${b##refs/heads/} local f="$h$w$i$s$u$p"
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}"
__git_ps1_branch_name=$b
b="\${__git_ps1_branch_name}"
fi
local f="$h$w$i$s$u"
local gitstring="$c$b${f:+$z$f}${sparse}$r$p"
if [ $pcmode = yes ]; then if [ $pcmode = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then if [ "${__git_printf_supports_v-}" != yes ]; then

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
url="https://raw.githubusercontent.com/felipec/git-completion" url="https://raw.githubusercontent.com/felipec/git-completion"
version="1.3.6" version="1.3.7"
curl -s -o _git "${url}/v${version}/git-completion.zsh" && curl -s -o _git "${url}/v${version}/git-completion.zsh" &&
curl -s -o git-completion.bash "${url}/v${version}/git-completion.bash" && curl -s -o git-completion.bash "${url}/v${version}/git-completion.bash" &&

View file

@ -11,7 +11,6 @@ This plugin supports working with GitHub from the command line. It provides a fe
* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub * `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub
* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub * `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
* `exist_gh` - Takes an existing repo and pushes it to GitHub * `exist_gh` - Takes an existing repo and pushes it to GitHub
* `git.io` - Shortens a URL using [git.io](https://git.io)
## Installation ## Installation

View file

@ -68,8 +68,9 @@ exist_gh() { # [DIRECTORY]
# documentation: https://github.com/blog/985-git-io-github-url-shortener # documentation: https://github.com/blog/985-git-io-github-url-shortener
# #
git.io() { git.io() {
emulate -L zsh # emulate -L zsh
curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " " # curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "
print -u2 ${(%):-"%F{yellow}%BThe \`git.io\` is deprecated.%b\nView the announcement made by GitHub: https://github.blog/changelog/2022-01-11-git-io-no-longer-accepts-new-urls/%f"}
} }
# End Functions ############################################################# # End Functions #############################################################

View file

@ -19,7 +19,7 @@ __gnu_utils() {
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate' 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand' 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid' 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum' 'gid' 'gindent' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc' 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd' 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum' 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
@ -61,3 +61,14 @@ __gnu_utils_preexec() {
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
add-zsh-hook preexec __gnu_utils_preexec add-zsh-hook preexec __gnu_utils_preexec
# lib/theme-and-appearance.zsh sets the alias for ls not knowing that
# we'll be using GNU ls. We'll reset this to use GNU ls --color.
# See https://github.com/ohmyzsh/ohmyzsh/issues/11503
#
# The ls alias might look like:
# - ls='ls -G'
# - ls='gls --color=tty'
if [[ -x "${commands[gls]}" && "${aliases[ls]}" = (*-G*|gls*) ]]; then
alias ls='ls --color=tty'
fi

View file

@ -16,11 +16,12 @@ plugins=(... golang)
| gob | `go build` | Build your code | | gob | `go build` | Build your code |
| goc | `go clean` | Removes object files from package source directories | | goc | `go clean` | Removes object files from package source directories |
| god | `go doc` | Prints documentation comments | | god | `go doc` | Prints documentation comments |
| goe | `go env` | Prints Go environment information |
| gof | `go fmt` | Gofmt formats (aligns and indents) Go programs. | | gof | `go fmt` | Gofmt formats (aligns and indents) Go programs. |
| gofa | `go fmt ./...` | Run go fmt for all packages in current directory, recursively | | gofa | `go fmt ./...` | Run go fmt for all packages in current directory, recursively |
| gofx | `go fix` | Update packages to use a new API | | gofx | `go fix` | Update packages to use a new API |
| gog | `go get` | Downloads packages and then installs them to $GOPATH | | gog | `go get` | Downloads packages and then installs them to $GOPATH |
| gog | `go get ./...` | Installs all dependencies in current directory, recursively | | goga | `go get ./...` | Installs all dependencies in current directory, recursively |
| goi | `go install` | Compiles and installs packages to $GOPATH | | goi | `go install` | Compiles and installs packages to $GOPATH |
| gol | `go list` | Lists Go packages | | gol | `go list` | Lists Go packages |
| gom | `go mod` | Access to operations on modules | | gom | `go mod` | Access to operations on modules |
@ -35,3 +36,5 @@ plugins=(... golang)
| gotod | `go tool dist` | Utility to bootstrap, build and test go runtime | | gotod | `go tool dist` | Utility to bootstrap, build and test go runtime |
| gotofx | `go tool fix` | Fixes an application to use newer features | | gotofx | `go tool fix` | Fixes an application to use newer features |
| gov | `go vet` | Vet examines Go source code and reports suspicious constructs | | gov | `go vet` | Vet examines Go source code and reports suspicious constructs |
| gove | `go version` | Prints Go version |
| gow | `go work` | Work provides access to operations on workspaces |

View file

@ -13,6 +13,7 @@ unset p
alias gob='go build' alias gob='go build'
alias goc='go clean' alias goc='go clean'
alias god='go doc' alias god='go doc'
alias goe='go env'
alias gof='go fmt' alias gof='go fmt'
alias gofa='go fmt ./...' alias gofa='go fmt ./...'
alias gofx='go fix' alias gofx='go fix'
@ -32,3 +33,5 @@ alias gotoc='go tool compile'
alias gotod='go tool dist' alias gotod='go tool dist'
alias gotofx='go tool fix' alias gotofx='go tool fix'
alias gov='go vet' alias gov='go vet'
alias gove='go version'
alias gow='go work'

View file

@ -1,4 +1,6 @@
#compdef gradle gradlew gw #compdef gradle gradlew gw
# THE LINE ABOVE MUST BE THE FIRST LINE OF THIS FILE IN ORDER FOR COMPLETION TO WORK
# #
# Taken from https://github.com/gradle/gradle-completion # Taken from https://github.com/gradle/gradle-completion
# Copyright (c) 2017 Eric Wendelin # Copyright (c) 2017 Eric Wendelin
@ -116,9 +118,9 @@ __gradle-generate-tasks-cache() {
# Reuse Gradle Daemon if IDLE but don't start a new one. # Reuse Gradle Daemon if IDLE but don't start a new one.
local gradle_tasks_output local gradle_tasks_output
if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
gradle_tasks_output="$($gradle_cmd --daemon --build-file $gradle_build_file --console plain -q tasks --all 2>/dev/null)" gradle_tasks_output="$($gradle_cmd --daemon --no-scan --build-file $gradle_build_file --console=plain -q tasks --all 2>/dev/null)"
else else
gradle_tasks_output="$($gradle_cmd --no-daemon --build-file $gradle_build_file --console plain -q tasks --all 2>/dev/null)" gradle_tasks_output="$($gradle_cmd --no-daemon --no-scan --build-file $gradle_build_file --console=plain -q tasks --all 2>/dev/null)"
fi fi
local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
local -a match local -a match
@ -180,7 +182,7 @@ __gradle_tasks() {
local cached_checksum="$(cat $cache_dir/$cache_name.md5)" local cached_checksum="$(cat $cache_dir/$cache_name.md5)"
local -a cached_tasks local -a cached_tasks
if [[ -z $cur ]]; then if [[ -z $cur ]]; then
cached_tasks=(${(f)"$(cat $cache_dir/$cached_checksum)"}) cached_tasks=(${(f)"$(grep -v "^\\\:" $cache_dir/$cached_checksum)"})
else else
cached_tasks=(${(f)"$(grep "^${cur//:/\\\\:}" $cache_dir/$cached_checksum)"}) cached_tasks=(${(f)"$(grep "^${cur//:/\\\\:}" $cache_dir/$cached_checksum)"})
fi fi
@ -191,7 +193,7 @@ __gradle_tasks() {
# Regenerate tasks cache in the background # Regenerate tasks cache in the background
if [[ $gradle_files_checksum != "$(cat $cache_dir/$cache_name.md5)" || ! -f $cache_dir/$gradle_files_checksum || $(wc -c < $cache_dir/$gradle_files_checksum) -le 1 ]]; then if [[ $gradle_files_checksum != "$(cat $cache_dir/$cache_name.md5)" || ! -f $cache_dir/$gradle_files_checksum || $(wc -c < $cache_dir/$gradle_files_checksum) -le 1 ]]; then
$(__gradle-generate-tasks-cache 1>&2 2>/dev/null &) $(__gradle-generate-tasks-cache &> /dev/null &)
fi fi
else else
_describe 'built-in tasks' '( _describe 'built-in tasks' '(
@ -262,7 +264,10 @@ __gradle_subcommand() {
{-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \ {-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
{-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \ {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
{-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle' \ {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle' \
'(--configuration-cache)--no-configuration-cache[Disables the configuration cache. Gradle will not reuse the build configuration from previous builds.]' \
'--configuration-cache-problems=[Configures how the configuration cache handles problems]:problem handling:(fail warn)' \
'(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \ '(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
'(--no-configuration-cache)--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
'--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \ '--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
'--continue[Continues task execution after a task failure.]' \ '--continue[Continues task execution after a task failure.]' \
'-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \ '-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
@ -276,6 +281,7 @@ __gradle_subcommand() {
'-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \ '-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
'-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:enable parallel build:(true false)' \ '-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:enable parallel build:(true false)' \
'-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \ '-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
'-Dorg.gradle.unsafe.watch-fs=[Set true to enable Gradle file watcher.]:enable watcher:(true false)' \
'-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \ '-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
'-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \ '-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
'(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \ '(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
@ -314,6 +320,7 @@ __gradle_subcommand() {
'(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \ '(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
'(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \ '(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
'--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \ '--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
'(--no-watch-fs)--watch-fs[Gradle watches filesystem for incremental builds.]' \
'(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \ '(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
{-x,--exclude-task}'[Specify a task to be excluded from execution.]' && ret=0 {-x,--exclude-task}'[Specify a task to be excluded from execution.]' && ret=0
;; ;;
@ -347,6 +354,9 @@ _gradle() {
{-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \ {-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
{-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \ {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
{-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle:->argument-expected' \ {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle:->argument-expected' \
'(--no-configuration-cache)--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
'(--configuration-cache)--no-configuration-cache[Disables the configuration cache. Gradle will not reuse the build configuration from previous builds.]' \
'--configuration-cache-problems=[Configures how the configuration cache handles problems]:problem handling:(fail warn)' \
'(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \ '(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
'--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \ '--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
'--continue[Continues task execution after a task failure.]' \ '--continue[Continues task execution after a task failure.]' \
@ -361,6 +371,7 @@ _gradle() {
'-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \ '-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
'-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:(true false)' \ '-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:(true false)' \
'-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \ '-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
'-Dorg.gradle.unsafe.watch-fs=[Set true to enable Gradle file watcher.]:enable watcher:(true false)' \
'-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \ '-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
'-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \ '-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
'(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \ '(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
@ -404,6 +415,7 @@ _gradle() {
'(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \ '(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
'--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \ '--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
'(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \ '(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
'(--no-watch-fs)--watch-fs[Gradle watches filesystem for incremental builds.]' \
{-x,--exclude-task}'[Specify a task to be excluded from execution.]' \ {-x,--exclude-task}'[Specify a task to be excluded from execution.]' \
'(-)*:: :->task-or-option' && ret=0 '(-)*:: :->task-or-option' && ret=0

9
plugins/hasura/README.md Normal file
View file

@ -0,0 +1,9 @@
# Hasura plugin
This plugin adds completion for [the Hasura CLI](https://hasura.io/docs/latest/hasura-cli/index/).
To use it, add `hasura` to the plugins array in your zshrc file:
```zsh
plugins=(... hasura)
```

View file

@ -0,0 +1,13 @@
if (( ! $+commands[hasura] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_hasura" ]]; then
hasura completion zsh --file "$ZSH_CACHE_DIR/completions/_hasura" >/dev/null
source "$ZSH_CACHE_DIR/completions/_hasura"
else
source "$ZSH_CACHE_DIR/completions/_hasura"
hasura completion zsh --file "$ZSH_CACHE_DIR/completions/_hasura" >/dev/null &|
fi

Some files were not shown because too many files have changed in this diff Show more