mirror of
https://github.com/DazAh/dotfiles
synced 2026-05-21 18:25:46 +01:00
update oh-my-zsh, poetry env and cs setting update
This commit is contained in:
@@ -31,7 +31,7 @@ your problem.
|
||||
|
||||
If you find one, comment on it so we can know there are more people experiencing it.
|
||||
|
||||
If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/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.
|
||||
|
||||
Then, you can go ahead and create an issue with as much detail as you can provide.
|
||||
@@ -62,7 +62,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
|
||||
|
||||
You should be familiar with the basics of
|
||||
[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
|
||||
[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices).
|
||||
[properly set up](https://github.com/ohmyzsh/ohmyzsh/wiki/Contribution-Technical-Practices).
|
||||
|
||||
You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree.
|
||||
|
||||
@@ -85,7 +85,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
|
||||
|
||||
### You have an addition
|
||||
|
||||
Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now)
|
||||
Please [do not](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#dont-send-us-your-theme-for-now)
|
||||
send themes for now.
|
||||
|
||||
Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests
|
||||
@@ -109,7 +109,7 @@ to help you check whether a similar contribution to yours already exists. Please
|
||||
before making any contribution, it avoids duplicates and eases maintenance. Trust me,
|
||||
that works 90% of the time.
|
||||
|
||||
You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ)
|
||||
You can also take a look at the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ)
|
||||
to be sure your contribution has not already come up.
|
||||
|
||||
If all fails, your thing has probably not been reported yet, so you can go ahead
|
||||
@@ -121,5 +121,5 @@ and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-reque
|
||||
|
||||
Very nice!! :)
|
||||
|
||||
Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers)
|
||||
Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers)
|
||||
page for instructions on where to start and more.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2009-2019 Robby Russell and contributors
|
||||
See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
|
||||
Copyright (c) 2009-2020 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -12,14 +12,18 @@ Once installed, your terminal shell will become the talk of the town _or your mo
|
||||
|
||||
Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬
|
||||
|
||||
To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
|
||||
To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and/or join us on Discord.
|
||||
|
||||

|
||||
[](https://twitter.com/intent/follow?screen_name=ohmyzsh)
|
||||
[](https://discord.gg/bpXWhnN)
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work.
|
||||
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
|
||||
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
|
||||
* `curl` or `wget` should be installed
|
||||
* `git` should be installed
|
||||
|
||||
@@ -30,13 +34,13 @@ Oh My Zsh is installed by running one of the following commands in your terminal
|
||||
#### via curl
|
||||
|
||||
```shell
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### via wget
|
||||
|
||||
```shell
|
||||
sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### Manual inspection
|
||||
@@ -46,7 +50,7 @@ that by downloading the install script first, looking through it so everything l
|
||||
then running it:
|
||||
|
||||
```shell
|
||||
curl -Lo install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
|
||||
curl -Lo install.sh https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||
sh install.sh
|
||||
```
|
||||
|
||||
@@ -54,7 +58,7 @@ sh install.sh
|
||||
|
||||
### Plugins
|
||||
|
||||
Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available.
|
||||
Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available.
|
||||
|
||||
#### Enabling Plugins
|
||||
|
||||
@@ -86,7 +90,7 @@ Most plugins (should! we're working on this) include a __README__, which documen
|
||||
|
||||
### Themes
|
||||
|
||||
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out!
|
||||
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki. Check them out!
|
||||
|
||||
#### Selecting a Theme
|
||||
|
||||
@@ -102,7 +106,7 @@ To use a different theme, simply change the value to match the name of your desi
|
||||
|
||||
```shell
|
||||
ZSH_THEME="agnoster" # (this is one of the fancy ones)
|
||||
# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster
|
||||
# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster
|
||||
```
|
||||
|
||||
_Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._
|
||||
@@ -111,7 +115,7 @@ Open up a new terminal window and your prompt should look something like this:
|
||||
|
||||

|
||||
|
||||
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes).
|
||||
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes).
|
||||
|
||||
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
|
||||
|
||||
@@ -129,6 +133,10 @@ ZSH_THEME_RANDOM_CANDIDATES=(
|
||||
)
|
||||
```
|
||||
|
||||
### FAQ
|
||||
|
||||
If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).
|
||||
|
||||
## Advanced Topics
|
||||
|
||||
If you're the type that likes to get their hands dirty, these sections might resonate.
|
||||
@@ -157,14 +165,14 @@ flag `--unattended` to the `install.sh` script. This will have the effect of not
|
||||
the default shell, and also won't run `zsh` when the installation has finished.
|
||||
|
||||
```shell
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" "" --unattended
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||
```
|
||||
|
||||
#### Installing from a forked repository
|
||||
|
||||
The install script also accepts these variables to allow installation of a different repository:
|
||||
|
||||
- `REPO` (default: `robbyrussell/oh-my-zsh`): this takes the form of `owner/repository`. If you set
|
||||
- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set
|
||||
this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`.
|
||||
|
||||
- `REMOTE` (default: `https://github.com/${REPO}.git`): this is the full URL of the git repository
|
||||
@@ -188,7 +196,7 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
|
||||
##### 1. Clone the repository:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
||||
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
|
||||
```
|
||||
|
||||
##### 2. *Optionally*, backup your existing `~/.zshrc` file:
|
||||
@@ -270,13 +278,13 @@ Before you participate in our delightful community, please read the [code of con
|
||||
|
||||
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
|
||||
|
||||
We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can.
|
||||
We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can.
|
||||
|
||||
See [Contributing](CONTRIBUTING.md) for more details.
|
||||
|
||||
### Do NOT send us themes
|
||||
|
||||
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page.
|
||||
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page.
|
||||
|
||||
## Contributors
|
||||
|
||||
|
||||
@@ -4,3 +4,5 @@ custom/
|
||||
# temp files directories
|
||||
cache/
|
||||
log/
|
||||
*.swp
|
||||
.DS_Store
|
||||
|
||||
@@ -1 +1 @@
|
||||
LAST_EPOCH=18186
|
||||
LAST_EPOCH=18290
|
||||
|
||||
@@ -1 +1 @@
|
||||
3e4d10c4f17b2fe57090a524d5d78781beda204a branch 'master' of https://github.com/robbyrussell/oh-my-zsh
|
||||
05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 branch 'master' of https://github.com/robbyrussell/oh-my-zsh
|
||||
|
||||
@@ -20,3 +20,5 @@ e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508
|
||||
52f58785645c18aa88ea515d070a42bcfe97508d 52f58785645c18aa88ea515d070a42bcfe97508d DazAh <9095216+DazAh@users.noreply.github.com> 1570921257 +0100 reset: moving to HEAD
|
||||
52f58785645c18aa88ea515d070a42bcfe97508d 52f58785645c18aa88ea515d070a42bcfe97508d DazAh <9095216+DazAh@users.noreply.github.com> 1571311718 +0100 reset: moving to HEAD
|
||||
52f58785645c18aa88ea515d070a42bcfe97508d 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1571311756 +0100 pull: Fast-forward
|
||||
3e4d10c4f17b2fe57090a524d5d78781beda204a 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1580316543 +0000 reset: moving to HEAD
|
||||
3e4d10c4f17b2fe57090a524d5d78781beda204a 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 DazAh <9095216+DazAh@users.noreply.github.com> 1580316594 +0000 pull --rebase --stat origin master: Fast-forward
|
||||
|
||||
@@ -17,3 +17,4 @@ a4f6a9964ceec3d222a8caa8eb3e5cf6027cfbab 32338fd40cae45c775dadc34ae05476811a3834
|
||||
32338fd40cae45c775dadc34ae05476811a3834b e38099de96e8b62976354b468da1b21ec2d57f68 Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570028747 +0100 pull --rebase --stat origin master: Fast-forward
|
||||
e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508d Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570875427 +0100 pull: Fast-forward
|
||||
52f58785645c18aa88ea515d070a42bcfe97508d 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1571311756 +0100 pull: Fast-forward
|
||||
3e4d10c4f17b2fe57090a524d5d78781beda204a 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 DazAh <9095216+DazAh@users.noreply.github.com> 1580316594 +0000 pull --rebase --stat origin master: Fast-forward
|
||||
|
||||
+1
@@ -16,3 +16,4 @@ a4f6a9964ceec3d222a8caa8eb3e5cf6027cfbab 32338fd40cae45c775dadc34ae05476811a3834
|
||||
32338fd40cae45c775dadc34ae05476811a3834b e38099de96e8b62976354b468da1b21ec2d57f68 Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570028747 +0100 pull --rebase --stat origin master: fast-forward
|
||||
e38099de96e8b62976354b468da1b21ec2d57f68 52f58785645c18aa88ea515d070a42bcfe97508d Darren Leatherbarrow <darren@DarrenPC.dazeerrcloud.xyz> 1570875427 +0100 pull: fast-forward
|
||||
52f58785645c18aa88ea515d070a42bcfe97508d 3e4d10c4f17b2fe57090a524d5d78781beda204a DazAh <9095216+DazAh@users.noreply.github.com> 1571311756 +0100 pull: fast-forward
|
||||
3e4d10c4f17b2fe57090a524d5d78781beda204a 05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5 DazAh <9095216+DazAh@users.noreply.github.com> 1580316594 +0000 pull --rebase --stat origin master: fast-forward
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
0000000000000000000000000000000000000000 eb431af8f7e08b7771004f9fae70bb616856593c DazAh <9095216+DazAh@users.noreply.github.com> 1570920993 +0100 WIP on master: 52f58785 rust: add README (#8242)
|
||||
eb431af8f7e08b7771004f9fae70bb616856593c 49dad0cd7bfa681db26f6aa6c6b8a6191fab060e DazAh <9095216+DazAh@users.noreply.github.com> 1570921257 +0100 WIP on master: 52f58785 rust: add README (#8242)
|
||||
49dad0cd7bfa681db26f6aa6c6b8a6191fab060e 56f3414079b2e53d24677bf128b6ddffef6e2ca1 DazAh <9095216+DazAh@users.noreply.github.com> 1571311718 +0100 WIP on master: 52f58785 rust: add README (#8242)
|
||||
56f3414079b2e53d24677bf128b6ddffef6e2ca1 778901cd9b55d509149e2c689941938e82ddfa37 DazAh <9095216+DazAh@users.noreply.github.com> 1580316543 +0000 WIP on master: 3e4d10c4 lib: allow alias expansion in _ sudo alias (#8268)
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
x¥OËJÅ0uݯp£\(“ióèEDÁ�;w.e’Ll¡mJøøzƒ¨?à,ÌyÁ yš†Cû*AëÖP@¯}ðºKâ´FèR ÕÅ BÂjáUæ”6*mRÖSm±CÖÔF³Ny‰LØò¯ßvÁ{ãŒC'*1²ñF ²sHƒ
|
||||
+1
@@ -0,0 +1 @@
|
||||
x¥OÑJÄ0ô¹_±à‹rP6iÒ$‡ˆ‚ÿ!›d{
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -1 +1 @@
|
||||
3e4d10c4f17b2fe57090a524d5d78781beda204a
|
||||
05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5
|
||||
|
||||
@@ -1 +1 @@
|
||||
3e4d10c4f17b2fe57090a524d5d78781beda204a
|
||||
05a38c8b99ea5bc54e7fdfc1cc1ea6d2729c05e5
|
||||
|
||||
@@ -1 +1 @@
|
||||
56f3414079b2e53d24677bf128b6ddffef6e2ca1
|
||||
778901cd9b55d509149e2c689941938e82ddfa37
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
name: Check Suite
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Run tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
steps:
|
||||
- name: Set up git repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Install zsh
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update; sudo apt-get install zsh
|
||||
- name: Test installer
|
||||
run: sh ./tools/install.sh
|
||||
- name: Check syntax
|
||||
run: |
|
||||
for file in ./oh-my-zsh.sh \
|
||||
./lib/*.zsh \
|
||||
./plugins/*/*.plugin.zsh \
|
||||
./plugins/*/_* \
|
||||
./themes/*.zsh-theme; do
|
||||
zsh -n "$file" || return 1
|
||||
done
|
||||
@@ -24,7 +24,7 @@ function clipcopy() {
|
||||
else
|
||||
cat $file | pbcopy
|
||||
fi
|
||||
elif [[ $OSTYPE == cygwin* ]]; then
|
||||
elif [[ $OSTYPE == (cygwin|msys)* ]]; then
|
||||
if [[ -z $file ]]; then
|
||||
cat > /dev/clipboard
|
||||
else
|
||||
@@ -71,7 +71,7 @@ function clippaste() {
|
||||
emulate -L zsh
|
||||
if [[ $OSTYPE == darwin* ]]; then
|
||||
pbpaste
|
||||
elif [[ $OSTYPE == cygwin* ]]; then
|
||||
elif [[ $OSTYPE == (cygwin|msys)* ]]; then
|
||||
cat /dev/clipboard
|
||||
else
|
||||
if (( $+commands[xclip] )); then
|
||||
|
||||
@@ -12,11 +12,21 @@ function git_prompt_info() {
|
||||
function parse_git_dirty() {
|
||||
local STATUS
|
||||
local -a FLAGS
|
||||
FLAGS=('--porcelain' '--ignore-submodules=dirty')
|
||||
FLAGS=('--porcelain')
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
||||
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
||||
FLAGS+='--untracked-files=no'
|
||||
fi
|
||||
case "$GIT_STATUS_IGNORE_SUBMODULES" in
|
||||
git)
|
||||
# let git decide (this respects per-repo config in .gitmodules)
|
||||
;;
|
||||
*)
|
||||
# if unset: ignore dirty submodules
|
||||
# other values are passed to --ignore-submodules
|
||||
FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
|
||||
;;
|
||||
esac
|
||||
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
|
||||
fi
|
||||
if [[ -n $STATUS ]]; then
|
||||
|
||||
@@ -75,8 +75,9 @@ function omz_termsupport_preexec {
|
||||
title '$CMD' '%100>...>$LINE%<<'
|
||||
}
|
||||
|
||||
precmd_functions+=(omz_termsupport_precmd)
|
||||
preexec_functions+=(omz_termsupport_preexec)
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd omz_termsupport_precmd
|
||||
add-zsh-hook preexec omz_termsupport_preexec
|
||||
|
||||
|
||||
# Keep Apple Terminal.app's current working directory updated
|
||||
@@ -99,7 +100,7 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||
}
|
||||
|
||||
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
|
||||
precmd_functions+=(update_terminalapp_cwd)
|
||||
add-zsh-hook precmd update_terminalapp_cwd
|
||||
# Run once to get initial cwd set
|
||||
update_terminalapp_cwd
|
||||
fi
|
||||
|
||||
@@ -4,7 +4,7 @@ alias-finder() {
|
||||
case $i in
|
||||
-e|--exact) exact=true;;
|
||||
-l|--longer) longer=true;;
|
||||
*)
|
||||
*)
|
||||
if [[ -z $cmd ]]; then
|
||||
cmd=$i
|
||||
else
|
||||
@@ -14,7 +14,7 @@ alias-finder() {
|
||||
esac
|
||||
done
|
||||
cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
|
||||
if [[ $(wc -l <<< $cmd) == 1 ]]; then
|
||||
if (( $(wc -l <<< $cmd) == 1 )); then
|
||||
while [[ $cmd != "" ]]; do
|
||||
if [[ $longer = true ]]; then
|
||||
wordStart="'{0,1}"
|
||||
@@ -43,4 +43,5 @@ preexec_alias-finder() {
|
||||
fi
|
||||
}
|
||||
|
||||
preexec_functions+=(preexec_alias-finder)
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook preexec preexec_alias-finder
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
**Maintainer:** [@emzar](https://github.com/emzar)
|
||||
|
||||
This plugin adds many useful aliases.
|
||||
This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist).
|
||||
|
||||
@@ -42,7 +42,7 @@ This will exclude the `foreman` and `spin` gems (i.e. their executable) from bei
|
||||
|
||||
## Excluded gems
|
||||
|
||||
These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/robbyrussell/oh-my-zsh/pull/2923) on GitHub for clarification.
|
||||
These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/ohmyzsh/ohmyzsh/pull/2923) on GitHub for clarification.
|
||||
|
||||
`berks`
|
||||
`foreman`
|
||||
|
||||
@@ -82,7 +82,7 @@ _bundler-installed() {
|
||||
_within-bundled-project() {
|
||||
local check_dir="$PWD"
|
||||
while [ "$check_dir" != "/" ]; do
|
||||
[ -f "$check_dir/Gemfile" ] && return
|
||||
[ -f "$check_dir/Gemfile" -o -f "$check_dir/gems.rb" ] && return
|
||||
check_dir="$(dirname $check_dir)"
|
||||
done
|
||||
false
|
||||
@@ -95,7 +95,7 @@ _binstubbed() {
|
||||
_run-with-bundler() {
|
||||
if _bundler-installed && _within-bundled-project; then
|
||||
if _binstubbed $1; then
|
||||
./bin/$@
|
||||
./bin/${^^@}
|
||||
else
|
||||
bundle exec $@
|
||||
fi
|
||||
|
||||
@@ -2,489 +2,367 @@
|
||||
|
||||
autoload -U regexp-replace
|
||||
|
||||
zstyle -T ':completion:*:*:cargo:*' tag-order && \
|
||||
zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
|
||||
|
||||
_cargo() {
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
local curcontext="$curcontext" ret=1
|
||||
local -a command_scope_spec common parallel features msgfmt triple target registry
|
||||
local -a state line state_descr # These are set by _arguments
|
||||
typeset -A opt_args
|
||||
|
||||
# leading items in parentheses are an exclusion list for the arguments following that arg
|
||||
# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
|
||||
# - => exclude all other options
|
||||
# 1 => exclude positional arg 1
|
||||
# * => exclude all other args
|
||||
# +blah => exclude +blah
|
||||
_arguments \
|
||||
'(- 1 *)'{-h,--help}'[show help message]' \
|
||||
'(- 1 *)--list[list installed commands]' \
|
||||
'(- 1 *)'{-V,--version}'[show version information]' \
|
||||
{-v,--verbose}'[use verbose output]' \
|
||||
--color'[colorization option]' \
|
||||
'(+beta +nightly)+stable[use the stable toolchain]' \
|
||||
'(+stable +nightly)+beta[use the beta toolchain]' \
|
||||
'(+stable +beta)+nightly[use the nightly toolchain]' \
|
||||
'1: :->command' \
|
||||
'*:: :->args'
|
||||
common=(
|
||||
'(-q --quiet)*'{-v,--verbose}'[use verbose output]'
|
||||
'(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]'
|
||||
'-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags'
|
||||
'--frozen[require that Cargo.lock and cache are up-to-date]'
|
||||
'--locked[require that Cargo.lock is up-to-date]'
|
||||
'--color=[specify colorization option]:coloring:(auto always never)'
|
||||
'(- 1 *)'{-h,--help}'[show help message]'
|
||||
)
|
||||
|
||||
case $state in
|
||||
command)
|
||||
_alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
|
||||
;;
|
||||
# leading items in parentheses are an exclusion list for the arguments following that arg
|
||||
# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
|
||||
# - => exclude all other options
|
||||
# 1 => exclude positional arg 1
|
||||
# * => exclude all other args
|
||||
# +blah => exclude +blah
|
||||
_arguments -s -S -C $common \
|
||||
'(- 1 *)--list[list installed commands]' \
|
||||
'(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \
|
||||
'(- 1 *)'{-V,--version}'[show version information]' \
|
||||
'(+beta +nightly)+stable[use the stable toolchain]' \
|
||||
'(+stable +nightly)+beta[use the beta toolchain]' \
|
||||
'(+stable +beta)+nightly[use the nightly toolchain]' \
|
||||
'1: :_cargo_cmds' \
|
||||
'*:: :->args'
|
||||
|
||||
args)
|
||||
case $words[1] in
|
||||
bench)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--no-run[compile but do not run]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
# These flags are mutually exclusive specifiers for the scope of a command; as
|
||||
# they are used in multiple places without change, they are expanded into the
|
||||
# appropriate command's `_arguments` where appropriate.
|
||||
command_scope_spec=(
|
||||
'(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names'
|
||||
'(--bench --bin --test --lib)--example=[specify example name]:example name'
|
||||
'(--bench --example --test --lib)--bin=[specify binary name]:binary name'
|
||||
'(--bench --bin --example --test)--lib=[specify library name]:library name'
|
||||
'(--bench --bin --example --lib)--test=[specify test name]:test name'
|
||||
)
|
||||
|
||||
build)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
|
||||
'--release=[build in release mode]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
parallel=(
|
||||
'(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
|
||||
)
|
||||
|
||||
check)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-default-features[do not check the default features]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
|
||||
'--release=[check in release mode]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
features=(
|
||||
'(--all-features)--features=[specify features to activate]:feature'
|
||||
'(--features)--all-features[activate all available features]'
|
||||
"--no-default-features[don't build the default features]"
|
||||
)
|
||||
|
||||
clean)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[whether or not to clean release artifacts]' \
|
||||
'--target=[target triple(default:all)]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
msgfmt='--message-format=[specify error format]:error format [human]:(human json short)'
|
||||
triple='--target=[specify target triple]:target triple'
|
||||
target='--target-dir=[specify directory for all generated artifacts]:directory:_directories'
|
||||
manifest='--manifest-path=[specify path to manifest]:path:_directories'
|
||||
registry='--registry=[specify registry to use]:registry'
|
||||
|
||||
doc)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-deps[do not build docs for dependencies]' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--open[open docs in browser after the build]' \
|
||||
'(-p, --package)'{-p,--package}'=[package to document]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[build for the target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
case $state in
|
||||
args)
|
||||
curcontext="${curcontext%:*}-${words[1]}:"
|
||||
case ${words[1]} in
|
||||
bench)
|
||||
_arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \
|
||||
"${command_scope_spec[@]}" \
|
||||
'--all-targets[benchmark all targets]' \
|
||||
"--no-run[compile but don't run]" \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \
|
||||
'--exclude=[exclude packages from the benchmark]:spec' \
|
||||
'--no-fail-fast[run all benchmarks regardless of failure]' \
|
||||
'1: :_guard "^-*" "bench name"' \
|
||||
'*:args:_default'
|
||||
;;
|
||||
|
||||
fetch)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
build)
|
||||
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||
'--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
|
||||
'--release[build in release mode]' \
|
||||
'--build-plan[output the build plan in JSON]' \
|
||||
;;
|
||||
|
||||
generate-lockfile)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
check)
|
||||
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||
'--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \
|
||||
'--release[check in release mode]' \
|
||||
;;
|
||||
|
||||
git-checkout)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--reference=[REF]' \
|
||||
'--url=[URL]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
clean)
|
||||
_arguments -s -S $common $triple $target $manifest \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \
|
||||
'--release[clean release artifacts]' \
|
||||
'--doc[clean just the documentation directory]'
|
||||
;;
|
||||
|
||||
help)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'*: :_cargo_cmds' \
|
||||
;;
|
||||
doc)
|
||||
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||
'--no-deps[do not build docs for dependencies]' \
|
||||
'--document-private-items[include non-public items in the documentation]' \
|
||||
'--open[open docs in browser after the build]' \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
;;
|
||||
|
||||
init)
|
||||
_arguments \
|
||||
'--bin[use binary template]' \
|
||||
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--name=[set the resulting package name]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
fetch)
|
||||
_arguments -s -S $common $triple $manifest
|
||||
;;
|
||||
|
||||
install)
|
||||
_arguments \
|
||||
'--bin=[only install the specified binary]' \
|
||||
'--branch=[branch to use when installing from git]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--debug[build in debug mode instead of release mode]' \
|
||||
'--example[install the specified example instead of binaries]' \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'--git=[URL from which to install the crate]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--path=[local filesystem path to crate to install]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--rev=[specific commit to use when installing from git]' \
|
||||
'--root=[directory to install packages into]: :_files -/' \
|
||||
'--tag=[tag to use when installing from git]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--vers=[version to install from crates.io]' \
|
||||
;;
|
||||
fix)
|
||||
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||
"${command_scope_spec[@]}" \
|
||||
'--broken-code[fix code even if it already has compiler errors]' \
|
||||
'--edition[fix in preparation for the next edition]' \
|
||||
'--edition-idioms[fix warnings to migrate to the idioms of an edition]' \
|
||||
'--allow-no-vcs[fix code even if a VCS was not detected]' \
|
||||
'--allow-dirty[fix code even if the working directory is dirty]' \
|
||||
'--allow-staged[fix code even if the working directory has staged changes]'
|
||||
;;
|
||||
|
||||
locate-project)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
;;
|
||||
generate-lockfile)
|
||||
_arguments -s -S $common $manifest
|
||||
;;
|
||||
|
||||
login)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--host=[Host to set the token for]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
git-checkout)
|
||||
_arguments -s -S $common \
|
||||
'--reference=:reference' \
|
||||
'--url=:url:_urls'
|
||||
;;
|
||||
|
||||
metadata)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
"--no-deps[output information only about the root package and don't fetch dependencies]" \
|
||||
'--no-default-features[do not include the default feature]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'--format-version=[format version(default: 1)]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
help)
|
||||
_cargo_cmds
|
||||
;;
|
||||
|
||||
new)
|
||||
_arguments \
|
||||
'--bin[use binary template]' \
|
||||
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--name=[set the resulting package name]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
init)
|
||||
_arguments -s -S $common $registry \
|
||||
'--lib[use library template]' \
|
||||
'--edition=[specify edition to set for the crate generated]:edition:(2015 2018)' \
|
||||
'--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \
|
||||
'--name=[set the resulting package name]:name' \
|
||||
'1:path:_directories'
|
||||
;;
|
||||
|
||||
owner)
|
||||
_arguments \
|
||||
'(-a, --add)'{-a,--add}'[add owner LOGIN]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--index[registry index]' \
|
||||
'(-l, --list)'{-l,--list}'[list owners of a crate]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \
|
||||
'--token[API token to use when authenticating]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
install)
|
||||
_arguments -s -S $common $parallel $features $triple $registry \
|
||||
'(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \
|
||||
'--bin=[only install the specified binary]:binary' \
|
||||
'--branch=[branch to use when installing from git]:branch' \
|
||||
'--debug[build in debug mode instead of release mode]' \
|
||||
'--example=[install the specified example instead of binaries]:example' \
|
||||
'--git=[specify URL from which to install the crate]:url:_urls' \
|
||||
'--path=[local filesystem path to crate to install]: :_directories' \
|
||||
'--rev=[specific commit to use when installing from git]:commit' \
|
||||
'--root=[directory to install packages into]: :_directories' \
|
||||
'--tag=[tag to use when installing from git]:tag' \
|
||||
'--vers=[version to install from crates.io]:version' \
|
||||
'--list[list all installed packages and their versions]' \
|
||||
'*: :_guard "^-*" "crate"'
|
||||
;;
|
||||
|
||||
package)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-l, --list)'{-l,--list}'[print files included in a package without making one]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-metadata[ignore warnings about a lack of human-usable metadata]' \
|
||||
'--no-verify[do not build to verify contents]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
locate-project)
|
||||
_arguments -s -S $common $manifest
|
||||
;;
|
||||
|
||||
pkgid)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
login)
|
||||
_arguments -s -S $common $registry \
|
||||
'*: :_guard "^-*" "token"'
|
||||
;;
|
||||
|
||||
publish)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--host=[Host to set the token for]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-verify[Do not verify tarball until before publish]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--token[token to use when uploading]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
metadata)
|
||||
_arguments -s -S $common $features $manifest \
|
||||
"--no-deps[output information only about the root package and don't fetch dependencies]" \
|
||||
'--format-version=[specify format version]:version [1]:(1)'
|
||||
;;
|
||||
|
||||
read-manifest)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
new)
|
||||
_arguments -s -S $common $registry \
|
||||
'--lib[use library template]' \
|
||||
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
||||
'--name=[set the resulting package name]'
|
||||
;;
|
||||
|
||||
run)
|
||||
_arguments \
|
||||
'--example=[name of the bin target]' \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--bin=[name of the bin target]' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release=[build in release mode]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'*: :_normal' \
|
||||
;;
|
||||
owner)
|
||||
_arguments -s -S $common $registry \
|
||||
'(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \
|
||||
'--index=[specify registry index]:index' \
|
||||
'(-l --list)'{-l,--list}'[list owners of a crate]' \
|
||||
'(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \
|
||||
'--token=[specify API token to use when authenticating]:token' \
|
||||
'*: :_guard "^-*" "crate"'
|
||||
;;
|
||||
|
||||
rustc)
|
||||
_arguments \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--features=[features to compile for the package]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \
|
||||
'--no-default-features[do not compile default features for the package]' \
|
||||
'(-p, --package)'{-p,--package}'=[profile to compile for]' \
|
||||
'--profile=[profile to build the selected target for]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[target triple which compiles will be for]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
;;
|
||||
package)
|
||||
_arguments -s -S $common $parallel $features $triple $target $manifest \
|
||||
'(-l --list)'{-l,--list}'[print files included in a package without making one]' \
|
||||
'--no-metadata[ignore warnings about a lack of human-usable metadata]' \
|
||||
'--allow-dirty[allow dirty working directories to be packaged]' \
|
||||
"--no-verify[don't build to verify contents]"
|
||||
;;
|
||||
|
||||
rustdoc)
|
||||
_arguments \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--features=[space-separated list of features to also build]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to the manifest to document]: :_files -/' \
|
||||
'--no-default-features[do not build the `default` feature]' \
|
||||
'--open[open the docs in a browser after the operation]' \
|
||||
'(-p, --package)'{-p,--package}'=[package to document]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[build for the target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
;;
|
||||
pkgid)
|
||||
_arguments -s -S $common $manifest \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \
|
||||
'*: :_guard "^-*" "spec"'
|
||||
;;
|
||||
|
||||
search)
|
||||
_arguments \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--host=[host of a registry to search in]' \
|
||||
'--limit=[limit the number of results]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
;;
|
||||
publish)
|
||||
_arguments -s -S $common $parallel $features $triple $target $manifest $registry \
|
||||
'--index=[specify registry index]:index' \
|
||||
'--allow-dirty[allow dirty working directories to be packaged]' \
|
||||
"--no-verify[don't verify the contents by building them]" \
|
||||
'--token=[specify token to use when uploading]:token' \
|
||||
'--dry-run[perform all checks without uploading]'
|
||||
;;
|
||||
|
||||
test)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--test=[test name]: :_test_names' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--no-fail-fast[run all tests regardless of failure]' \
|
||||
'--no-run[compile but do not run]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'1: :_test_names' \
|
||||
'(--doc --bin --example --test --bench)--lib[only test library]' \
|
||||
'(--lib --bin --example --test --bench)--doc[only test documentation]' \
|
||||
'(--lib --doc --example --test --bench)--bin=[binary name]' \
|
||||
'(--lib --doc --bin --test --bench)--example=[example name]' \
|
||||
'(--lib --doc --bin --example --bench)--test=[test name]' \
|
||||
'(--lib --doc --bin --example --test)--bench=[benchmark name]' \
|
||||
'--message-format:error format:(human json short)' \
|
||||
'--frozen[require lock and cache up to date]' \
|
||||
'--locked[require lock up to date]'
|
||||
;;
|
||||
read-manifest)
|
||||
_arguments -s -S $common $manifest
|
||||
;;
|
||||
|
||||
uninstall)
|
||||
_arguments \
|
||||
'--bin=[only uninstall the binary NAME]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \
|
||||
'--root=[directory to uninstall packages from]: :_files -/' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
;;
|
||||
run)
|
||||
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||
'--example=[name of the bin target]:name' \
|
||||
'--bin=[name of the bin target]:name' \
|
||||
'(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \
|
||||
'--release[build in release mode]' \
|
||||
'*: :_default'
|
||||
;;
|
||||
|
||||
update)
|
||||
_arguments \
|
||||
'--aggressive=[force dependency update]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \
|
||||
'--precise=[update single dependency to PRECISE]: :' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
rustc)
|
||||
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
|
||||
'--profile=[specify profile to build the selected target for]:profile' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'*: : _dispatch rustc rustc -default-'
|
||||
;;
|
||||
|
||||
verify-project)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
rustdoc)
|
||||
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||
'--document-private-items[include non-public items in the documentation]' \
|
||||
'--open[open the docs in a browser after the operation]' \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'*: : _dispatch rustdoc rustdoc -default-'
|
||||
;;
|
||||
|
||||
version)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
search)
|
||||
_arguments -s -S $common $registry \
|
||||
'--index=[specify registry index]:index' \
|
||||
'--limit=[limit the number of results]:results [10]' \
|
||||
'*: :_guard "^-*" "query"'
|
||||
;;
|
||||
|
||||
yank)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--index[registry index]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--token[API token to use when authenticating]' \
|
||||
'--undo[undo a yank, putting a version back into the index]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--vers[yank version]' \
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
test)
|
||||
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
||||
'--test=[test name]: :_cargo_test_names' \
|
||||
'--no-fail-fast[run all tests regardless of failure]' \
|
||||
'--no-run[compile but do not run]' \
|
||||
'(-p --package)'{-p+,--package=}'[package to run tests for]:package:_cargo_package_names' \
|
||||
'--all[test all packages in the workspace]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'1: :_cargo_test_names' \
|
||||
'(--doc --bin --example --test --bench)--lib[only test library]' \
|
||||
'(--lib --bin --example --test --bench)--doc[only test documentation]' \
|
||||
'(--lib --doc --example --test --bench)--bin=[binary name]' \
|
||||
'(--lib --doc --bin --test --bench)--example=[example name]' \
|
||||
'(--lib --doc --bin --example --bench)--test=[test name]' \
|
||||
'(--lib --doc --bin --example --test)--bench=[benchmark name]' \
|
||||
'*: :_default'
|
||||
;;
|
||||
|
||||
uninstall)
|
||||
_arguments -s -S $common \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \
|
||||
'--bin=[only uninstall the specified binary]:name' \
|
||||
'--root=[directory to uninstall packages from]: :_files -/' \
|
||||
'*:crate:_cargo_installed_crates -F line'
|
||||
;;
|
||||
|
||||
update)
|
||||
_arguments -s -S $common $manifest \
|
||||
'--aggressive=[force dependency update]' \
|
||||
"--dry-run[don't actually write the lockfile]" \
|
||||
'(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \
|
||||
'--precise=[update single dependency to precise release]:release'
|
||||
;;
|
||||
|
||||
verify-project)
|
||||
_arguments -s -S $common $manifest
|
||||
;;
|
||||
|
||||
version)
|
||||
_arguments -s -S $common
|
||||
;;
|
||||
|
||||
yank)
|
||||
_arguments -s -S $common $registry \
|
||||
'--vers=[specify yank version]:version' \
|
||||
'--undo[undo a yank, putting a version back into the index]' \
|
||||
'--index=[specify registry index to yank from]:registry index' \
|
||||
'--token=[specify API token to use when authenticating]:token' \
|
||||
'*: :_guard "^-*" "crate"'
|
||||
;;
|
||||
*)
|
||||
# allow plugins to define their own functions
|
||||
if ! _call_function ret _cargo-${words[1]}; then
|
||||
# fallback on default completion for unknown commands
|
||||
_default && ret=0
|
||||
fi
|
||||
(( ! ret ))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_cargo_cmds(){
|
||||
local -a commands;commands=(
|
||||
'bench:execute all benchmarks of a local package'
|
||||
'build:compile the current package'
|
||||
'check:check the current package without compiling'
|
||||
'clean:remove generated artifacts'
|
||||
'doc:build package documentation'
|
||||
'fetch:fetch package dependencies'
|
||||
'generate-lockfile:create lockfile'
|
||||
'git-checkout:git checkout'
|
||||
'help:get help for commands'
|
||||
'init:create new package in current directory'
|
||||
'install:install a Rust binary'
|
||||
'locate-project:print "Cargo.toml" location'
|
||||
'login:login to remote server'
|
||||
'metadata:the metadata for a package in json'
|
||||
'new:create a new package'
|
||||
'owner:manage the owners of a crate on the registry'
|
||||
'package:assemble local package into a distributable tarball'
|
||||
'pkgid:print a fully qualified package specification'
|
||||
'publish:upload package to the registry'
|
||||
'read-manifest:print manifest in JSON format'
|
||||
'run:run the main binary of the local package'
|
||||
'rustc:compile a package and all of its dependencies'
|
||||
'rustdoc:build documentation for a package'
|
||||
'search:search packages on crates.io'
|
||||
'test:execute all unit and tests of a local package'
|
||||
'uninstall:remove a Rust binary'
|
||||
'update:update dependencies'
|
||||
'verify-project:check Cargo.toml'
|
||||
'version:show version information'
|
||||
'yank:remove pushed file from index'
|
||||
)
|
||||
_describe -t common-commands 'common commands' commands
|
||||
_cargo_unstable_flags() {
|
||||
local flags
|
||||
flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } )
|
||||
_describe -t flags 'unstable flag' flags
|
||||
}
|
||||
|
||||
_cargo_all_cmds(){
|
||||
local -a commands;commands=($(cargo --list))
|
||||
_describe -t all-commands 'all commands' commands
|
||||
_cargo_installed_crates() {
|
||||
local expl
|
||||
_description crates expl 'crate'
|
||||
compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *}
|
||||
}
|
||||
|
||||
_cargo_cmds() {
|
||||
local -a commands
|
||||
# This uses Parameter Expansion Flags, which are a built-in Zsh feature.
|
||||
# See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
|
||||
# and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion
|
||||
#
|
||||
# # How this work?
|
||||
#
|
||||
# First it splits the result of `cargo --list` at newline, then it removes the first line.
|
||||
# Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]).
|
||||
# Then it replaces those spaces between item and description with a `:`
|
||||
#
|
||||
# [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns
|
||||
commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} )
|
||||
_describe -t commands 'command' commands
|
||||
}
|
||||
|
||||
|
||||
#FIXME: Disabled until fixed
|
||||
#gets package names from the manifest file
|
||||
_get_package_names()
|
||||
{
|
||||
}
|
||||
|
||||
#TODO:see if it makes sense to have 'locate-project' to have non-json output.
|
||||
#strips package name from json stuff
|
||||
_locate_manifest(){
|
||||
local manifest=`cargo locate-project 2>/dev/null`
|
||||
regexp-replace manifest '\{"root":"|"\}' ''
|
||||
echo $manifest
|
||||
_cargo_package_names() {
|
||||
_message -e packages package
|
||||
}
|
||||
|
||||
# Extracts the values of "name" from the array given in $1 and shows them as
|
||||
# command line options for completion
|
||||
_get_names_from_array()
|
||||
{
|
||||
local -a filelist;
|
||||
local manifest=$(_locate_manifest)
|
||||
_cargo_names_from_array() {
|
||||
# strip json from the path
|
||||
local manifest=${${${"$(cargo locate-project)"}%\"\}}##*\"}
|
||||
if [[ -z $manifest ]]; then
|
||||
return 0
|
||||
fi
|
||||
@@ -494,51 +372,36 @@ _get_names_from_array()
|
||||
local in_block=false
|
||||
local block_name=$1
|
||||
names=()
|
||||
while read line
|
||||
do
|
||||
while read -r line; do
|
||||
if [[ $last_line == "[[$block_name]]" ]]; then
|
||||
in_block=true
|
||||
else
|
||||
if [[ $last_line =~ '.*\[\[.*' ]]; then
|
||||
if [[ $last_line =~ '\s*\[\[.*' ]]; then
|
||||
in_block=false
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $in_block == true ]]; then
|
||||
if [[ $line =~ '.*name.*=' ]]; then
|
||||
regexp-replace line '^.*name *= *|"' ""
|
||||
names+=$line
|
||||
if [[ $line =~ '\s*name\s*=' ]]; then
|
||||
regexp-replace line '^\s*name\s*=\s*|"' ''
|
||||
names+=( "$line" )
|
||||
fi
|
||||
fi
|
||||
|
||||
last_line=$line
|
||||
done < $manifest
|
||||
_describe $block_name names
|
||||
done < "$manifest"
|
||||
_describe "$block_name" names
|
||||
|
||||
}
|
||||
|
||||
#Gets the test names from the manifest file
|
||||
_test_names()
|
||||
{
|
||||
_get_names_from_array "test"
|
||||
_cargo_test_names() {
|
||||
_cargo_names_from_array "test"
|
||||
}
|
||||
|
||||
#Gets the bench names from the manifest file
|
||||
_benchmark_names()
|
||||
{
|
||||
_get_names_from_array "bench"
|
||||
_cargo_benchmark_names() {
|
||||
_cargo_names_from_array "bench"
|
||||
}
|
||||
|
||||
# These flags are mutually exclusive specifiers for the scope of a command; as
|
||||
# they are used in multiple places without change, they are expanded into the
|
||||
# appropriate command's `_arguments` where appropriate.
|
||||
set command_scope_spec
|
||||
command_scope_spec=(
|
||||
'(--bin --example --test --lib)--bench=[benchmark name]: :_benchmark_names'
|
||||
'(--bench --bin --test --lib)--example=[example name]'
|
||||
'(--bench --example --test --lib)--bin=[binary name]'
|
||||
'(--bench --bin --example --test)--lib=[library name]'
|
||||
'(--bench --bin --example --lib)--test=[test name]'
|
||||
)
|
||||
|
||||
_cargo
|
||||
|
||||
@@ -17,10 +17,10 @@ Plugin for displaying images on the terminal using the the `catimg.sh` script pr
|
||||
)
|
||||
```
|
||||
|
||||
2. Reload the source file or restart your Terminal session:
|
||||
2. Restart the shell or restart your Terminal session:
|
||||
|
||||
```console
|
||||
$ source ~/.zshrc
|
||||
$ exec zsh
|
||||
$
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# codeclimate plugin
|
||||
|
||||
This plugin adds autocompletion for the [`codeclimate` CLI](https://github.com/codeclimate/codeclimate).
|
||||
|
||||
To use it, add `codeclimate` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... codeclimate)
|
||||
```
|
||||
+1
-1
@@ -17,7 +17,7 @@ EOF
|
||||
fi
|
||||
|
||||
function colored() {
|
||||
env \
|
||||
command env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
|
||||
@@ -6,30 +6,43 @@ Colorize will highlight the content based on the filename extension. If it can't
|
||||
method for a given extension, it will try to find one by looking at the file contents. If no highlight method
|
||||
is found it will just cat the file normally, without syntax highlighting.
|
||||
|
||||
To use it, add colorize to the plugins array of your zshrc file:
|
||||
## Setup
|
||||
|
||||
To use it, add colorize to the plugins array of your `~/.zshrc` file:
|
||||
```
|
||||
plugins=(... colorize)
|
||||
```
|
||||
|
||||
## Styles
|
||||
## Configuration
|
||||
|
||||
### Requirements
|
||||
|
||||
This plugin requires that at least one of the following tools is installed:
|
||||
|
||||
* [Chroma](https://github.com/alecthomas/chroma)
|
||||
* [Pygments](https://pygments.org/download/)
|
||||
|
||||
### Colorize tool
|
||||
|
||||
Colorize supports `pygmentize` and `chroma` as syntax highlighter. By default colorize uses `pygmentize` unless it's not installed and `chroma` is. This can be overridden by the `ZSH_COLORIZE_TOOL` environment variable:
|
||||
|
||||
```
|
||||
ZSH_COLORIZE_TOOL=chroma
|
||||
```
|
||||
|
||||
### Styles
|
||||
|
||||
Pygments offers multiple styles. By default, the `default` style is used, but you can choose another theme by setting the `ZSH_COLORIZE_STYLE` environment variable:
|
||||
|
||||
`ZSH_COLORIZE_STYLE="colorful"`
|
||||
```
|
||||
ZSH_COLORIZE_STYLE="colorful"
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
|
||||
If no arguments are passed it will colorize the standard input or stdin.
|
||||
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
|
||||
If no files are passed it will colorize the standard input.
|
||||
|
||||
* `cless <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and
|
||||
open less. If no arguments are passed it will colorize the standard input or stdin.
|
||||
|
||||
Note that `cless` will behave as less when provided more than one file: you have to navigate files with
|
||||
the commands `:n` for next and `:p` for previous. The downside is that less options are not supported.
|
||||
But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`.
|
||||
In the latter form, the file contents will be concatenated and presented by less as a single file.
|
||||
|
||||
## Requirements
|
||||
|
||||
You have to install Pygments first: [pygments.org](http://pygments.org/download/)
|
||||
* `cless [less-options] <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and open less.
|
||||
If no files are passed it will colorize the standard input.
|
||||
The LESSOPEN and LESSCLOSE will be overwritten for this to work, but only in a local scope.
|
||||
|
||||
@@ -1,57 +1,113 @@
|
||||
# easier alias to use the plugin
|
||||
alias ccat='colorize_via_pygmentize'
|
||||
alias cless='colorize_via_pygmentize_less'
|
||||
# Easier alias to use the plugin
|
||||
alias ccat="colorize_cat"
|
||||
alias cless="colorize_less"
|
||||
|
||||
colorize_via_pygmentize() {
|
||||
if ! (( $+commands[pygmentize] )); then
|
||||
echo "package 'Pygments' is not installed!"
|
||||
# '$0:A' gets the absolute path of this file
|
||||
ZSH_COLORIZE_PLUGIN_PATH=$0:A
|
||||
|
||||
colorize_check_requirements() {
|
||||
local available_tools=("chroma" "pygmentize")
|
||||
|
||||
if [ -z "$ZSH_COLORIZE_TOOL" ]; then
|
||||
if (( $+commands[pygmentize] )); then
|
||||
ZSH_COLORIZE_TOOL="pygmentize"
|
||||
elif (( $+commands[chroma] )); then
|
||||
ZSH_COLORIZE_TOOL="chroma"
|
||||
else
|
||||
echo "Neither 'pygments' nor 'chroma' is installed!" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
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
|
||||
return 1
|
||||
elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then
|
||||
echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
colorize_cat() {
|
||||
if ! colorize_check_requirements; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# If the environment varianle ZSH_COLORIZE_STYLE
|
||||
# If the environment variable ZSH_COLORIZE_STYLE
|
||||
# is set, use that theme instead. Otherwise,
|
||||
# use the default.
|
||||
if [ -z $ZSH_COLORIZE_STYLE ]; then
|
||||
ZSH_COLORIZE_STYLE="default"
|
||||
if [ -z "$ZSH_COLORIZE_STYLE" ]; then
|
||||
# Both pygmentize & chroma support 'emacs'
|
||||
ZSH_COLORIZE_STYLE="emacs"
|
||||
fi
|
||||
|
||||
# pygmentize stdin if no arguments passed
|
||||
# Use stdin if no arguments have been passed.
|
||||
if [ $# -eq 0 ]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
|
||||
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
|
||||
else
|
||||
chroma --style="$ZSH_COLORIZE_STYLE"
|
||||
fi
|
||||
return $?
|
||||
fi
|
||||
|
||||
# guess lexer from file extension, or
|
||||
# guess it from file contents if unsuccessful
|
||||
|
||||
# Guess lexer from file extension, or guess it from file contents if unsuccessful.
|
||||
local FNAME lexer
|
||||
for FNAME in "$@"
|
||||
do
|
||||
lexer=$(pygmentize -N "$FNAME")
|
||||
if [[ $lexer != text ]]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
|
||||
for FNAME in "$@"; do
|
||||
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
|
||||
lexer=$(pygmentize -N "$FNAME")
|
||||
if [[ $lexer != text ]]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
|
||||
else
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
|
||||
fi
|
||||
else
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
|
||||
chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
colorize_via_pygmentize_less() (
|
||||
# this function is a subshell so tmp_files can be shared to cleanup function
|
||||
declare -a tmp_files
|
||||
# The less option 'F - Forward forever; like "tail -f".' will not work in this implementation
|
||||
# caused by the lack of the ability to follow the file within pygmentize.
|
||||
colorize_less() {
|
||||
if ! colorize_check_requirements; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
cleanup () {
|
||||
[[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}"
|
||||
exit
|
||||
_cless() {
|
||||
# LESS="-R $LESS" enables raw ANSI colors, while maintain already set options.
|
||||
local LESS="-R $LESS"
|
||||
|
||||
# This variable tells less to pipe every file through the specified command
|
||||
# (see the man page of less INPUT PREPROCESSOR).
|
||||
# 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like
|
||||
# the ~/.zsh_history. For such files the tty of the preprocessor will be supended.
|
||||
# Therefore we must source this file to make colorize_cat available in the
|
||||
# preprocessor without the interactive mode.
|
||||
# `2>/dev/null` will suppress the error for large files 'broken pipe' of the python
|
||||
# script pygmentize, which will show up if less has not fully "loaded the file"
|
||||
# (e.g. when not scrolled to the bottom) while already the next file will be displayed.
|
||||
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
|
||||
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
|
||||
colorize_cat %s 2> /dev/null'"
|
||||
|
||||
# LESSCLOSE will be set to prevent any errors by executing a user script
|
||||
# which assumes that his LESSOPEN has been executed.
|
||||
local LESSCLOSE=""
|
||||
|
||||
LESS="$LESS" LESSOPEN="$LESSOPEN" LESSCLOSE="$LESSCLOSE" less "$@"
|
||||
}
|
||||
trap 'cleanup' EXIT HUP TERM INT
|
||||
|
||||
while (( $# != 0 )); do #TODO: filter out less opts
|
||||
tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")"
|
||||
tmp_files+=("$tmp_file")
|
||||
colorize_via_pygmentize "$1" > "$tmp_file"
|
||||
shift 1
|
||||
done
|
||||
|
||||
less -f "${tmp_files[@]}"
|
||||
)
|
||||
if [ -t 0 ]; then
|
||||
_cless "$@"
|
||||
else
|
||||
# The input is not associated with a terminal, therefore colorize_cat will
|
||||
# colorize this input and pass it to less.
|
||||
# Less has now to decide what to use. If any files have been provided, less
|
||||
# will ignore the input by default, otherwise the colorized input will be used.
|
||||
# If files have been supplied and the input has been redirected, this will
|
||||
# lead to unnecessary overhead, but retains the ability to use the less options
|
||||
# without checking for them inside this script.
|
||||
colorize_cat | _cless "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ This plugin enables directory navigation similar to using back and forward on br
|
||||
)
|
||||
```
|
||||
|
||||
2. Reload the source file or restart your Terminal session:
|
||||
2. Restart the shell or restart your Terminal session:
|
||||
|
||||
```console
|
||||
$ source ~/.zshrc
|
||||
$ exec zsh
|
||||
$
|
||||
```
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@ function push_future() {
|
||||
}
|
||||
|
||||
# Called by zsh when directory changes
|
||||
chpwd_functions+=(chpwd_dirhistory)
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd chpwd_dirhistory
|
||||
function chpwd_dirhistory() {
|
||||
push_past $PWD
|
||||
# If DIRHISTORY_CD is not set...
|
||||
|
||||
@@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
|
||||
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
|
||||
fi
|
||||
|
||||
chpwd_functions+=(chpwd_dirpersist)
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd chpwd_dirpersist
|
||||
chpwd_dirpersist() {
|
||||
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
|
||||
local -ax my_stack
|
||||
|
||||
@@ -374,7 +374,8 @@ _managepy-commands() {
|
||||
_applist() {
|
||||
local line
|
||||
local -a apps
|
||||
_call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\
|
||||
_call_program help-command "python -c \"import sys; del sys.path[0];\\
|
||||
import os.path as op, re, django.conf;\\
|
||||
bn=op.basename(op.abspath(op.curdir));[sys\\
|
||||
.stdout.write(str(re.sub(r'^%s\.(.*?)$' %
|
||||
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
## Docker autocomplete plugin
|
||||
# Docker plugin
|
||||
|
||||
A copy of the completion script from the
|
||||
[docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker)
|
||||
git repo.
|
||||
This plugin adds auto-completion for [docker](https://www.docker.com/).
|
||||
|
||||
To use it add `docker` to the plugins array in your zshrc file.
|
||||
```zsh
|
||||
plugins=(... docker)
|
||||
```
|
||||
|
||||
A copy of the completion script from the docker/cli git repo:
|
||||
https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# .NET Core CLI plugin
|
||||
|
||||
This plugin provides completion and useful aliases for [.NET Core CLI](https://dotnet.microsoft.com/).
|
||||
|
||||
To use it, add `dotnet` to the plugins array in your zshrc file.
|
||||
|
||||
```
|
||||
plugins=(... dotnet)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|--------------|-------------------------------------------------------------------|
|
||||
| dn | dotnet new | Create a new .NET project or file. |
|
||||
| dr | dotnet run | Build and run a .NET project output. |
|
||||
| dt | dotnet test | Run unit tests using the test runner specified in a .NET project. |
|
||||
| ds | dotnet sln | Modify Visual Studio solution files. |
|
||||
| da | dotnet add | Add a package or reference to a .NET project. |
|
||||
| dp | dotnet pack | Create a NuGet package. |
|
||||
| dng | dotnet nuget | Provides additional NuGet commands. |
|
||||
@@ -0,0 +1,117 @@
|
||||
# --------------------------------------------------------------------- #
|
||||
# Aliases and Completions for .NET Core (https://dotnet.microsoft.com/) #
|
||||
# Author: Shaun Tabone (https://github.com/xontab) #
|
||||
# --------------------------------------------------------------------- #
|
||||
|
||||
# Helper function to cache and load completions
|
||||
local cache_base_path="${ZSH_CACHE_DIR}/dotnet_"
|
||||
_dotnet_cache_completion() {
|
||||
local cache="${cache_base_path}$(echo $1)_completion"
|
||||
if [[ ! -f $cache ]]; then
|
||||
$2 $cache
|
||||
fi
|
||||
|
||||
[[ -f $cache ]] && cat $cache
|
||||
}
|
||||
|
||||
_dotnet_cache_completion_cleanup() {
|
||||
local cache="${cache_base_path}$(echo $1)_completion"
|
||||
rm -f $cache
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------- #
|
||||
# dotnet new #
|
||||
# ALIAS: dn #
|
||||
# --------------------------------------------------------------------- #
|
||||
_dotnet_new_completion() {
|
||||
if [ $commands[dotnet] ]; then
|
||||
dotnet new -l | tail -n +21 | sed 's/ \+/:/g' | cut -d : -f 2 >$1
|
||||
fi
|
||||
}
|
||||
|
||||
_dotnet_new_completion_cached() {
|
||||
_dotnet_cache_completion 'new' _dotnet_new_completion
|
||||
}
|
||||
|
||||
_dotnet_cache_completion_cleanup 'new'
|
||||
|
||||
alias dn='dotnet new'
|
||||
|
||||
# --------------------------------------------------------------------- #
|
||||
# dotnet #
|
||||
# --------------------------------------------------------------------- #
|
||||
_dotnet() {
|
||||
if [ $CURRENT -eq 2 ]; then
|
||||
_arguments \
|
||||
'--diagnostics[Enable diagnostic output.]' \
|
||||
'--help[Show command line help.]' \
|
||||
'--info[Display .NET Core information.]' \
|
||||
'--list-runtimes[Display the installed runtimes.]' \
|
||||
'--list-sdks[Display the installed SDKs.]' \
|
||||
'--version[Display .NET Core SDK version in use.]'
|
||||
|
||||
_values \
|
||||
'add[Add a package or reference to a .NET project.]' \
|
||||
'build[Build a .NET project.]' \
|
||||
'build-server[Interact with servers started by a build.]' \
|
||||
'clean[Clean build outputs of a .NET project.]' \
|
||||
'help[Show command line help.]' \
|
||||
'list[List project references of a .NET project.]' \
|
||||
'msbuild[Run Microsoft Build Engine (MSBuild) commands.]' \
|
||||
'new[Create a new .NET project or file.]' \
|
||||
'nuget[Provides additional NuGet commands.]' \
|
||||
'pack[Create a NuGet package.]' \
|
||||
'publish[Publish a .NET project for deployment.]' \
|
||||
'remove[Remove a package or reference from a .NET project.]' \
|
||||
'restore[Restore dependencies specified in a .NET project.]' \
|
||||
'run[Build and run a .NET project output.]' \
|
||||
'sln[Modify Visual Studio solution files.]' \
|
||||
'store[Store the specified assemblies in the runtime package store.]' \
|
||||
'test[Run unit tests using the test runner specified in a .NET project.]' \
|
||||
'tool[Install or manage tools that extend the .NET experience.]' \
|
||||
'vstest[Run Microsoft Test Engine (VSTest) commands.]' \
|
||||
'dev-certs[Create and manage development certificates.]' \
|
||||
'fsi[Start F# Interactive / execute F# scripts.]' \
|
||||
'sql-cache[SQL Server cache command-line tools.]' \
|
||||
'user-secrets[Manage development user secrets.]' \
|
||||
'watch[Start a file watcher that runs a command when files change.]'
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $CURRENT -eq 3 ]; then
|
||||
case ${words[2]} in
|
||||
"new")
|
||||
compadd -X ".NET Installed Templates" $(_dotnet_new_completion_cached)
|
||||
return
|
||||
;;
|
||||
"sln")
|
||||
_values \
|
||||
'add[Add one or more projects to a solution file.]' \
|
||||
'list[List all projects in a solution file.]' \
|
||||
'remove[Remove one or more projects from a solution file.]'
|
||||
return
|
||||
;;
|
||||
"nuget")
|
||||
_values \
|
||||
'delete[Deletes a package from the server.]' \
|
||||
'locals[Clears or lists local NuGet resources such as http requests cache, packages folder, plugin operations cache or machine-wide global packages folder.]' \
|
||||
'push[Pushes a package to the server and publishes it.]'
|
||||
return
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
_arguments '*::arguments: _normal'
|
||||
}
|
||||
|
||||
compdef _dotnet dotnet
|
||||
|
||||
# --------------------------------------------------------------------- #
|
||||
# Other Aliases #
|
||||
# --------------------------------------------------------------------- #
|
||||
alias dr='dotnet run'
|
||||
alias dt='dotnet test'
|
||||
alias ds='dotnet sln'
|
||||
alias da='dotnet add'
|
||||
alias dp='dotnet pack'
|
||||
alias dng='dotnet nuget'
|
||||
@@ -0,0 +1,11 @@
|
||||
# eecms plugin
|
||||
|
||||
This plugin adds auto-completion of console commands for [`eecms`](https://github.com/ExpressionEngine/ExpressionEngine).
|
||||
|
||||
To use it, add `eecms` to the plugins array of your `.zshrc` file:
|
||||
```
|
||||
plugins=(... eecms)
|
||||
```
|
||||
|
||||
It also adds the alias `eecms` which finds the eecms file in the current project
|
||||
and runs it with php.
|
||||
@@ -20,7 +20,8 @@ _emacsfun()
|
||||
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
||||
if [ "$#" -ge "2" -a "$2" = "-" ]
|
||||
then
|
||||
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
|
||||
tempfile="$(mktemp --tmpdir emacs-stdin-$USER.XXXXXXX 2>/dev/null \
|
||||
|| mktemp -t emacs-stdin-$USER)" # support BSD mktemp
|
||||
cat - > "$tempfile"
|
||||
_emacsfun --no-wait $tempfile
|
||||
else
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# FILE: emoji-clock.plugin.zsh
|
||||
# DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
|
||||
# Inspired by Andre Torrez' "Put A Burger In Your Shell"
|
||||
# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
|
||||
# https://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
|
||||
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
||||
# VERSION: 1.0.0
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -8,7 +8,7 @@ To use it, add emotty to the plugins array in your zshrc file:
|
||||
plugins=(... emotty)
|
||||
```
|
||||
|
||||
**NOTE:** it requires the [emoji plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/emoji).
|
||||
**NOTE:** it requires the [emoji plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/emoji).
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ Alias plugin for encoding or decoding using `base64` command
|
||||
)
|
||||
```
|
||||
|
||||
2. Restart your terminal session or reload configuration by running:
|
||||
2. Restart your terminal session or restart the shell:
|
||||
|
||||
```sh
|
||||
source ~/.zshrc
|
||||
exec zsh
|
||||
```
|
||||
|
||||
## Usage and examples
|
||||
|
||||
@@ -25,23 +25,32 @@ plugins=(... extract)
|
||||
| `gz` | Gzip file |
|
||||
| `ipsw` | iOS firmware file |
|
||||
| `jar` | Java Archive |
|
||||
| `lrz` | LRZ archive |
|
||||
| `lz4` | LZ4 archive |
|
||||
| `lzma` | LZMA archive |
|
||||
| `rar` | WinRAR archive |
|
||||
| `rpm` | RPM package |
|
||||
| `sublime-package` | Sublime Text package |
|
||||
| `tar` | Tarball |
|
||||
| `tar.bz2` | Tarball with bzip2 compression |
|
||||
| `tar.gz` | Tarball with gzip compression |
|
||||
| `tar.lrz` | Tarball with lrzip compression |
|
||||
| `tar.lz` | Tarball with lzip compression |
|
||||
| `tar.lz4` | Tarball with lz4 compression |
|
||||
| `tar.xz` | Tarball with lzma2 compression |
|
||||
| `tar.zma` | Tarball with lzma compression |
|
||||
| `tar.zst` | Tarball with zstd compression |
|
||||
| `tbz` | Tarball with bzip compression |
|
||||
| `tbz2` | Tarball with bzip2 compression |
|
||||
| `tgz` | Tarball with gzip compression |
|
||||
| `tlz` | Tarball with lzma compression |
|
||||
| `txz` | Tarball with lzma2 compression |
|
||||
| `tzst` | Tarball with zstd compression |
|
||||
| `war` | Web Application archive (Java-based) |
|
||||
| `xpi` | Mozilla XPI module file |
|
||||
| `xz` | LZMA2 archive |
|
||||
| `zip` | Zip archive |
|
||||
| `zst` | Zstandard file (zstd) |
|
||||
|
||||
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
|
||||
more information regarding archive formats.
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
|
||||
_arguments \
|
||||
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
|
||||
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \
|
||||
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|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)(-.)'" \
|
||||
&& return 0
|
||||
|
||||
@@ -40,14 +40,24 @@ extract() {
|
||||
tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -xvf "$1" \
|
||||
|| lzcat "$1" | tar xvf - ;;
|
||||
(*.tar.zst|*.tzst)
|
||||
tar --zstd --help &> /dev/null \
|
||||
&& tar --zstd -xvf "$1" \
|
||||
|| zstdcat "$1" | tar xvf - ;;
|
||||
(*.tar) tar xvf "$1" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;;
|
||||
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
|
||||
(*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;;
|
||||
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
|
||||
(*.bz2) bunzip2 "$1" ;;
|
||||
(*.xz) unxz "$1" ;;
|
||||
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;;
|
||||
(*.lz4) lz4 -d "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.z) uncompress "$1" ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
mkdir -p "$extract_dir/control"
|
||||
@@ -58,6 +68,7 @@ extract() {
|
||||
cd ..; rm *.tar.* debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*.zst) unzstd "$1" ;;
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" >&2
|
||||
success=1
|
||||
|
||||
@@ -4,10 +4,19 @@
|
||||
local curcontext=$curcontext state line
|
||||
declare -A opt_args
|
||||
|
||||
declare target_list
|
||||
target_list=(`fab --shortlist 2>/dev/null || fab --complete 2>/dev/null`)
|
||||
declare -a target_list
|
||||
target_list=("${(@f)$(fab -l 2>/dev/null | awk '{
|
||||
if (NF == 0 || NR == 1) next
|
||||
if (NF < 2) print $1
|
||||
else {
|
||||
docstring=substr($0, index($0,$2))
|
||||
gsub(":", "\\:", docstring)
|
||||
print $1":"docstring
|
||||
}
|
||||
}')}")
|
||||
|
||||
_targets() {
|
||||
_fab_targets() {
|
||||
[[ -n "$target_list" ]] || return
|
||||
_describe -t commands "fabric targets" target_list
|
||||
}
|
||||
|
||||
@@ -28,7 +37,7 @@ _arguments -w -S -C \
|
||||
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
|
||||
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
|
||||
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
|
||||
"(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
|
||||
"(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_fab_targets" \
|
||||
'(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
|
||||
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
|
||||
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
|
||||
@@ -53,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then
|
||||
levels)
|
||||
_describe -t commands "output levels" output_levels;;
|
||||
*)
|
||||
_targets;;
|
||||
_fab_targets;;
|
||||
esac
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# fasd
|
||||
|
||||
[`Fasd`](https://github.com/clvv/fasd) (pronounced similar to "fast") is a command-line productivity booster. Fasd offers quick access to files and directories for POSIX shells.
|
||||
|
||||
To use it, add `fasd` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... fasd)
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Please find detailed installation guide [`here`](https://github.com/clvv/fasd#install)
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-------------------------------------------|-------------------------------------------------------------|
|
||||
| v | `fasd -f -e "$EDITOR"` | List frequent/recent files matching the given filename. |
|
||||
| o | `fasd -a -e xdg-open` | List frequent/recent files and directories matching. |
|
||||
| j | `fasd_cd -d -i` | cd with interactive selection |
|
||||
@@ -0,0 +1,84 @@
|
||||
# Fastfile plugin
|
||||
|
||||
This plugin adds a way to reference certain files or folders used frequently using
|
||||
a global alias or shortcut.
|
||||
|
||||
To use it, add `fastfile` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... fastfile)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Example: you access folder `/code/project/backend/database` very frequently.
|
||||
|
||||
First, generate a shortcut with the name `pjdb`:
|
||||
```zsh
|
||||
$ fastfile pjdb /code/project/backend/database
|
||||
```
|
||||
|
||||
Next time you want to access it, use `§pjdb`. For example:
|
||||
```zsh
|
||||
$ cd §pjdb
|
||||
$ subl §pjdb
|
||||
```
|
||||
where § is the fastfile prefix (see [below](#options) for how to change).
|
||||
|
||||
**Note:** shortcuts with spaces in the name are assigned a global alias
|
||||
where the spaces have been substituted with underscores (`_`). For example:
|
||||
a shortcut named `"hello world"` corresponds with `§hello_world`.
|
||||
|
||||
|
||||
## Functions
|
||||
|
||||
- `fastfile <shortcut_name> <path/to/file/or/folder>`: generate a shortcut.
|
||||
|
||||
- `fastfile_print <shortcut_name>`: prints a shortcut, with the format
|
||||
`<prefix><shortcut_name> -> <shortcut_path>`.
|
||||
|
||||
- `fastfile_ls`: lists all shortcuts.
|
||||
|
||||
- `fastfile_rm <shortcut_name> `: remove a shortcut.
|
||||
|
||||
- `fastfile_sync`: generates the global aliases for the shortcuts.
|
||||
|
||||
|
||||
### Internal functions
|
||||
|
||||
- `fastfile_resolv <shortcut_name>`: resolves the location of the shortcut
|
||||
file, i.e., the file in the fastfile directory where the shortcut path
|
||||
is stored.
|
||||
|
||||
- `fastfile_get <shortcut_name>`: get the real path of the shortcut.
|
||||
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Function |
|
||||
|--------|------------------|
|
||||
| ff | `fastfile` |
|
||||
| ffp | `fastfile_print` |
|
||||
| ffrm | `fastfile_rm` |
|
||||
| ffls | `fastfile_ls` |
|
||||
| ffsync | `fastfile_sync` |
|
||||
|
||||
|
||||
## Options
|
||||
|
||||
These are options you can set to change certain parts of the plugin. To change
|
||||
them, add `<variable>=<value>` to your zshrc file, before Oh My Zsh is sourced.
|
||||
For example: `fastfile_var_prefix='@'`.
|
||||
|
||||
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
|
||||
created global aliases.
|
||||
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
|
||||
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
|
||||
or using `⌥ Option`+`6` in macOS.
|
||||
|
||||
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
|
||||
with a trailing slash.
|
||||
**Default:** `$HOME/.fastfile/`.
|
||||
|
||||
## Author
|
||||
|
||||
- [Karolin Varner](https://github.com/koraa)
|
||||
@@ -1,15 +1,5 @@
|
||||
################################################################################
|
||||
# FILE: fastfile.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Michael Varner (musikmichael@web.de)
|
||||
# VERSION: 1.0.0
|
||||
#
|
||||
# This plugin adds the ability to on the fly generate and access file shortcuts.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
###########################
|
||||
# Settings
|
||||
# Settings
|
||||
|
||||
# These can be overwritten any time.
|
||||
# If they are not set yet, they will be
|
||||
@@ -33,7 +23,7 @@ default fastfile_var_prefix "§"
|
||||
function fastfile() {
|
||||
test "$2" || 2="."
|
||||
file=$(readlink -f "$2")
|
||||
|
||||
|
||||
test "$1" || 1="$(basename "$file")"
|
||||
name=$(echo "$1" | tr " " "_")
|
||||
|
||||
@@ -51,7 +41,7 @@ function fastfile() {
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut
|
||||
# STDOUT:
|
||||
# The path
|
||||
# The path to the shortcut file
|
||||
#
|
||||
function fastfile_resolv() {
|
||||
echo "${fastfile_dir}${1}"
|
||||
@@ -88,12 +78,12 @@ function fastfile_print() {
|
||||
# (=> fastfle_print) for each shortcut
|
||||
#
|
||||
function fastfile_ls() {
|
||||
for f in "${fastfile_dir}"/*; do
|
||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||
varkey=`echo "$file" | tr " " "_"`
|
||||
for f in "${fastfile_dir}"/*; do
|
||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||
varkey=`echo "$file" | tr " " "_"`
|
||||
|
||||
# Special format for colums
|
||||
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
|
||||
# Special format for colums
|
||||
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
|
||||
done | column -t -s "|"
|
||||
}
|
||||
|
||||
@@ -102,7 +92,6 @@ function fastfile_ls() {
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut (default: name of the file)
|
||||
# 2. file - The file or directory to make the shortcut for
|
||||
# STDOUT:
|
||||
# => fastfle_print
|
||||
#
|
||||
@@ -115,11 +104,11 @@ function fastfile_rm() {
|
||||
# Generate the aliases for the shortcuts
|
||||
#
|
||||
function fastfile_sync() {
|
||||
for f in "${fastfile_dir}"/*; do
|
||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||
varkey=`echo "$file" | tr " " "_"`
|
||||
for f in "${fastfile_dir}"/*; do
|
||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||
varkey=`echo "$file" | tr " " "_"`
|
||||
|
||||
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
|
||||
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -133,6 +122,6 @@ alias ffls=fastfile_ls
|
||||
alias ffsync=fastfile_sync
|
||||
|
||||
##################################
|
||||
# Init
|
||||
# Init
|
||||
|
||||
fastfile_sync
|
||||
fastfile_sync
|
||||
|
||||
@@ -1 +1 @@
|
||||
The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/dnf) instead.
|
||||
The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dnf) instead.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# FirewallD Plugin
|
||||
|
||||
This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array.
|
||||
|
||||
```zsh
|
||||
plugins=(... firewalld)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| :---- | :----------------------------------------- | :--------------------------- |
|
||||
| fw | `sudo firewall-cmd` | Shorthand |
|
||||
| fwr | `sudo firewall-cmd --reload` | Reload current configuration |
|
||||
| fwp | `sudo firewall-cmd --permanent` | Create permanent rule |
|
||||
| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| :------- | :--------------------------------------------------------- |
|
||||
| fwl | Lists configuration from all active zones and direct rules |
|
||||
@@ -12,6 +12,7 @@ function setup_using_base_dir() {
|
||||
"${HOME}/.fzf"
|
||||
"/usr/local/opt/fzf"
|
||||
"/usr/share/fzf"
|
||||
"/usr/local/share/examples/fzf"
|
||||
)
|
||||
for dir in ${fzfdirs}; do
|
||||
if [[ -d "${dir}" ]]; then
|
||||
@@ -67,7 +68,10 @@ function setup_using_debian_package() {
|
||||
# NOTE: There is no need to configure PATH for debian package, all binaries
|
||||
# are installed to /usr/bin by default
|
||||
|
||||
local completions="/usr/share/zsh/vendor-completions/_fzf"
|
||||
# Determine completion file path: first bullseye/sid, then buster/stretch
|
||||
local completions="/usr/share/doc/fzf/examples/completion.zsh"
|
||||
[[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf"
|
||||
|
||||
local key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh"
|
||||
|
||||
# Auto-completion
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# Gas plugin
|
||||
|
||||
This plugin adds autocompletion for the [gas](http://walle.github.com/gas) command,
|
||||
a utility to manage Git authors.
|
||||
|
||||
To use it, add `gas` to the plugins array of your zshrc file:
|
||||
```zsh
|
||||
plugins=(... gas)
|
||||
```
|
||||
@@ -1,16 +1,17 @@
|
||||
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
|
||||
|
||||
function git-fetch-all {
|
||||
(`git rev-parse --is-inside-work-tree 2>/dev/null` &&
|
||||
dir=`git rev-parse --git-dir` &&
|
||||
(`command git rev-parse --is-inside-work-tree 2>/dev/null` &&
|
||||
dir=`command git rev-parse --git-dir` &&
|
||||
[[ ! -f $dir/NO_AUTO_FETCH ]] &&
|
||||
(( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) &&
|
||||
git fetch --all 2>/dev/null &>! $dir/FETCH_LOG &)
|
||||
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
|
||||
command git fetch --all 2>/dev/null &>! $dir/FETCH_LOG &)
|
||||
}
|
||||
|
||||
function git-auto-fetch {
|
||||
`git rev-parse --is-inside-work-tree 2>/dev/null` || return
|
||||
guard="`git rev-parse --git-dir`/NO_AUTO_FETCH"
|
||||
`command git rev-parse --is-inside-work-tree 2>/dev/null` || return
|
||||
guard="`command git rev-parse --git-dir`/NO_AUTO_FETCH"
|
||||
|
||||
(rm $guard 2>/dev/null &&
|
||||
echo "${fg_bold[green]}enabled${reset_color}") ||
|
||||
|
||||
@@ -20,9 +20,10 @@ function precmd_update_git_vars() {
|
||||
fi
|
||||
}
|
||||
|
||||
chpwd_functions+=(chpwd_update_git_vars)
|
||||
precmd_functions+=(precmd_update_git_vars)
|
||||
preexec_functions+=(preexec_update_git_vars)
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd chpwd_update_git_vars
|
||||
add-zsh-hook precmd precmd_update_git_vars
|
||||
add-zsh-hook preexec preexec_update_git_vars
|
||||
|
||||
|
||||
## Function definitions
|
||||
|
||||
@@ -4,26 +4,21 @@ from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import shlex
|
||||
from subprocess import Popen, PIPE, check_output
|
||||
|
||||
|
||||
def get_tagname_or_hash():
|
||||
"""return tagname if exists else hash"""
|
||||
cmd = 'git log -1 --format="%h%d"'
|
||||
output = check_output(shlex.split(cmd)).decode('utf-8').strip()
|
||||
hash_, tagname = None, None
|
||||
# get hash
|
||||
m = re.search('\(.*\)$', output)
|
||||
if m:
|
||||
hash_ = output[:m.start()-1]
|
||||
# get tagname
|
||||
m = re.search('tag: .*[,\)]', output)
|
||||
if m:
|
||||
tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
|
||||
hash_cmd = ['git', 'rev-parse', '--short', 'HEAD']
|
||||
hash_ = check_output(hash_cmd).strip()
|
||||
|
||||
if tagname:
|
||||
return tagname.replace(' ', '')
|
||||
# get tagname
|
||||
tags_cmd = ['git', 'for-each-ref', '--points-at=HEAD', '--count=2', '--sort=-version:refname', '--format=%(refname:short)', 'refs/tags']
|
||||
tags = check_output(tags_cmd).split()
|
||||
|
||||
if tags:
|
||||
return tags[0] + ('+' if len(tags) > 1 else '')
|
||||
elif hash_:
|
||||
return hash_
|
||||
return None
|
||||
|
||||
@@ -11,5 +11,5 @@ plugins=(... gitfast)
|
||||
## Aliases
|
||||
|
||||
An earlier version of the plugin also loaded the git plugin. If you want to keep those
|
||||
aliases enable the [git plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/git)
|
||||
aliases enable the [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git)
|
||||
as well.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# glassfish
|
||||
|
||||
The glassfish plugin adds completion for the `asadmin` utility, a command to manage
|
||||
[Oracle GlassFish](https://docs.oracle.com/cd/E18930_01/html/821-2416/giobi.html) servers.
|
||||
|
||||
To use it, add `glassfish` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... glassfish)
|
||||
```
|
||||
@@ -0,0 +1,38 @@
|
||||
# gnu-utils plugin
|
||||
|
||||
This plugin binds GNU coreutils to their default names, so that you don't have
|
||||
to call them using their prefixed name, which starts with `g`. This is useful
|
||||
in systems which don't have GNU coreutils installed by default, mainly macOS
|
||||
or FreeBSD, which use BSD coreutils.
|
||||
|
||||
To use it, add `gnu-utils` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... gnu-utils)
|
||||
```
|
||||
|
||||
The plugin works by changing the path that the command hash points to, so
|
||||
instead of `ls` pointing to `/bin/ls`, it points to wherever `gls` is
|
||||
installed.
|
||||
|
||||
Since `hash -rf` or `rehash` refreshes the command hashes, it also wraps
|
||||
`hash` and `rehash` so that the coreutils binding is always done again
|
||||
after calling these two commands.
|
||||
|
||||
Look at the source code of the plugin to see which GNU coreutils are tried
|
||||
to rebind. Open an issue if there are some missing.
|
||||
|
||||
## Other methods
|
||||
|
||||
The plugin also documents two other ways to do this:
|
||||
|
||||
1. Using a function wrapper, such that, for example, there exists a function
|
||||
named `ls` which calls `gls` instead. Since functions have a higher preference
|
||||
than commands, this ends up calling the GNU coreutil. It has also a higher
|
||||
preference over shell builtins (`gecho` is called instead of the builtin `echo`).
|
||||
|
||||
2. Using an alias. This has an even higher preference than functions, but they
|
||||
could be overridden because of a user setting.
|
||||
|
||||
## Author
|
||||
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu).
|
||||
@@ -5,79 +5,79 @@
|
||||
# VERSION: 1.0.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
if [[ -x "${commands[gwhoami]}" ]]; then
|
||||
__gnu_utils() {
|
||||
emulate -L zsh
|
||||
local gcmds
|
||||
local gcmd
|
||||
local cmd
|
||||
local prefix
|
||||
|
||||
# coreutils
|
||||
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
|
||||
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
|
||||
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
|
||||
'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
|
||||
'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
|
||||
'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
|
||||
'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
|
||||
'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
|
||||
'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
|
||||
'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
|
||||
'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
|
||||
'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
|
||||
'gwhoami' 'gyes')
|
||||
|
||||
# findutils
|
||||
gcmds+=('gfind' 'gxargs' 'glocate')
|
||||
|
||||
# Not part of either coreutils or findutils, installed separately.
|
||||
gcmds+=('gsed' 'gtar' 'gtime')
|
||||
|
||||
for gcmd in "${gcmds[@]}"; do
|
||||
#
|
||||
# This method allows for builtin commands to be primary but it's
|
||||
# lost if hash -r or rehash -f is executed. Thus, those two
|
||||
# functions have to be wrapped.
|
||||
#
|
||||
(( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}
|
||||
|
||||
#
|
||||
# This method generates wrapper functions.
|
||||
# It will override shell builtins.
|
||||
#
|
||||
# (( ${+commands[$gcmd]} )) && \
|
||||
# eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
|
||||
|
||||
#
|
||||
# This method is inflexible since the aliases are at risk of being
|
||||
# overridden resulting in the BSD coreutils being called.
|
||||
#
|
||||
# (( ${+commands[$gcmd]} )) && \
|
||||
# alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
__gnu_utils;
|
||||
|
||||
function hash() {
|
||||
if [[ "$*" =~ "-(r|f)" ]]; then
|
||||
builtin hash "$@"
|
||||
__gnu_utils
|
||||
else
|
||||
builtin hash "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function rehash() {
|
||||
if [[ "$*" =~ "-f" ]]; then
|
||||
builtin rehash "$@"
|
||||
__gnu_utils
|
||||
else
|
||||
builtin rehash "$@"
|
||||
fi
|
||||
}
|
||||
# Detect if GNU coreutils are installed by looking for gwhoami
|
||||
if [[ ! -x "${commands[gwhoami]}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
__gnu_utils() {
|
||||
emulate -L zsh
|
||||
local gcmds
|
||||
local gcmd
|
||||
local cmd
|
||||
local prefix
|
||||
|
||||
# coreutils
|
||||
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
|
||||
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
|
||||
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
|
||||
'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
|
||||
'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
|
||||
'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
|
||||
'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
|
||||
'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
|
||||
'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
|
||||
'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
|
||||
'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
|
||||
'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
|
||||
'gwhoami' 'gyes')
|
||||
|
||||
# findutils
|
||||
gcmds+=('gfind' 'gxargs' 'glocate')
|
||||
|
||||
# Not part of either coreutils or findutils, installed separately.
|
||||
gcmds+=('gsed' 'gtar' 'gtime')
|
||||
|
||||
for gcmd in "${gcmds[@]}"; do
|
||||
# Do nothing if the command isn't found
|
||||
(( ${+commands[$gcmd]} )) || continue
|
||||
|
||||
# This method allows for builtin commands to be primary but it's
|
||||
# lost if hash -r or rehash -f is executed. Thus, those two
|
||||
# functions have to be wrapped.
|
||||
#
|
||||
hash ${gcmd[2,-1]}=${commands[$gcmd]}
|
||||
|
||||
# This method generates wrapper functions.
|
||||
# It will override shell builtins.
|
||||
#
|
||||
# eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
|
||||
|
||||
# This method is inflexible since the aliases are at risk of being
|
||||
# overridden resulting in the BSD coreutils being called.
|
||||
#
|
||||
# alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
__gnu_utils
|
||||
|
||||
function hash() {
|
||||
if [[ "$*" =~ "-(r|f)" ]]; then
|
||||
builtin hash "$@"
|
||||
__gnu_utils
|
||||
else
|
||||
builtin hash "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function rehash() {
|
||||
if [[ "$*" =~ "-f" ]]; then
|
||||
builtin rehash "$@"
|
||||
__gnu_utils
|
||||
else
|
||||
builtin rehash "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
The go plugin is deprecated. Use the [golang plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/golang) instead.
|
||||
The go plugin is deprecated. Use the [golang plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/golang) instead.
|
||||
|
||||
@@ -9,7 +9,7 @@ You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same.
|
||||
[1]: https://fishshell.com
|
||||
[2]: https://www.zsh.org/mla/users/2009/msg00818.html
|
||||
[3]: https://sourceforge.net/projects/fizsh/
|
||||
[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
|
||||
[4]: https://github.com/ohmyzsh/ohmyzsh/pull/215
|
||||
[5]: https://github.com/zsh-users/zsh-history-substring-search
|
||||
[6]: https://github.com/zsh-users/zsh-syntax-highlighting
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# hitokoto plugin
|
||||
|
||||
Displays a random quote taken from [hitokoto.cn](https://v1.hitokoto.cn/)
|
||||
|
||||
Created by [Sinrimin](https://github.com/sinrimin)
|
||||
|
||||
## Usage
|
||||
|
||||
Add the plugin to the plugins array in your zshrc file and restart zsh:
|
||||
|
||||
```zsh
|
||||
plugins=(... hitokoto)
|
||||
```
|
||||
|
||||
Then, run `hitokoto` to get a new random quote.
|
||||
@@ -0,0 +1,14 @@
|
||||
if ! (( $+commands[curl] )); then
|
||||
echo "hitokoto plugin needs curl to work" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
function hitokoto {
|
||||
emulate -L zsh
|
||||
Q=$(curl -s --connect-timeout 2 "https://v1.hitokoto.cn" | jq -j '.hitokoto+"\t"+.from')
|
||||
|
||||
TXT=$(echo "$Q" | awk -F '\t' '{print $1}')
|
||||
WHO=$(echo "$Q" | awk -F '\t' '{print $2}')
|
||||
|
||||
[[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# Ionic plugin
|
||||
|
||||
This plugin adds completion for the [Ionic CLI](https://ionicframework.com/docs/cli),
|
||||
as well as some aliases for common Ionic commands.
|
||||
|
||||
To use it, add `ionic` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... ionic)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|--------------------------------------|------------------------------------------------------------------|
|
||||
| iv | `ionic --version` | Check Ionic version |
|
||||
| ih | `ionic --help` | Ionic help command |
|
||||
| ist | `ionic start` | Create a new project |
|
||||
| ii | `ionic info` | Print system/environment info |
|
||||
| is | `ionic serve` | Start a local dev server for app dev/testing |
|
||||
| icba | `ionic cordova build android` | Build web assets and prepare app for android platform targets |
|
||||
| icbi | `ionic cordova build ios` | Build web assets and prepare app for ios platform targets |
|
||||
| icra | `ionic cordova run android` | Run an Ionic project on a connected android device |
|
||||
| icri | `ionic cordova run ios` | Run an Ionic project on a connected ios device |
|
||||
| icrsa | `ionic cordova resources android` | Automatically create icon and splash screen resources for android|
|
||||
| icrsi | `ionic cordova resources ios` | Automatically create icon and splash screen resources for ios |
|
||||
| icpaa | `ionic cordova platform add android` | Add Cordova android platform targets |
|
||||
| icpai | `ionic cordova platform add ios` | Add Cordova ios platform targets |
|
||||
| icpra | `ionic cordova platform rm android` | Remove Cordova platform targets |
|
||||
| icpri | `ionic cordova platform rm ios` | Remove Cordova platform targets |
|
||||
@@ -0,0 +1,15 @@
|
||||
alias iv="ionic --version"
|
||||
alias ih="ionic --help"
|
||||
alias ist="ionic start"
|
||||
alias ii="ionic info"
|
||||
alias is="ionic serve"
|
||||
alias icba="ionic cordova build android"
|
||||
alias icbi="ionic cordova build ios"
|
||||
alias icra="ionic cordova run android"
|
||||
alias icri="ionic cordova run ios"
|
||||
alias icrsa="ionic cordova resources android"
|
||||
alias icrsi="ionic cordova resources ios"
|
||||
alias icpaa="ionic cordova platform add android"
|
||||
alias icpai="ionic cordova platform add ios"
|
||||
alias icpra="ionic cordova platform rm android"
|
||||
alias icpri="ionic cordova platform rm ios"
|
||||
@@ -15,7 +15,7 @@ if [[ $FOUND_JENV -eq 0 ]]; then
|
||||
fi
|
||||
|
||||
if [[ $FOUND_JENV -eq 1 ]]; then
|
||||
export PATH="${jenvdir}/bin:$PATH"
|
||||
(( $+commands[jenv] )) || export PATH="${jenvdir}/bin:$PATH"
|
||||
eval "$(jenv init - zsh)"
|
||||
|
||||
function jenv_prompt_info() { jenv version-name 2>/dev/null }
|
||||
|
||||
@@ -11,9 +11,10 @@ if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METH
|
||||
alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"'
|
||||
alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"'
|
||||
elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then
|
||||
alias pp_json='python -mjson.tool'
|
||||
alias pp_json='python -c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"'
|
||||
alias is_json='python -c "
|
||||
import json, sys;
|
||||
import sys; del sys.path[0];
|
||||
import json;
|
||||
try:
|
||||
json.loads(sys.stdin.read())
|
||||
except ValueError, e:
|
||||
@@ -22,11 +23,13 @@ else:
|
||||
print True
|
||||
sys.exit(0)"'
|
||||
alias urlencode_json='python -c "
|
||||
import urllib, json, sys;
|
||||
import sys; del sys.path[0];
|
||||
import urllib, json;
|
||||
print urllib.quote_plus(sys.stdin.read())
|
||||
sys.exit(0)"'
|
||||
alias urldecode_json='python -c "
|
||||
import urllib, json, sys;
|
||||
import sys; del sys.path[0];
|
||||
import urllib, json;
|
||||
print urllib.unquote_plus(sys.stdin.read())
|
||||
sys.exit(0)"'
|
||||
elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then
|
||||
@@ -36,4 +39,4 @@ elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_MET
|
||||
alias urldecode_json='ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"'
|
||||
fi
|
||||
|
||||
unset JSONTOOLS_METHOD
|
||||
unset JSONTOOLS_METHOD
|
||||
|
||||
@@ -15,7 +15,7 @@ function _start_agent() {
|
||||
zstyle -a :omz:plugins:keychain options options
|
||||
|
||||
# start keychain...
|
||||
keychain ${^options:-} --agents ${agents:-gpg} ${^identities}
|
||||
keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
|
||||
|
||||
# Get the filenames to store/lookup the environment from
|
||||
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# knife plugin
|
||||
|
||||
This plugin adds completion for [knife](https://docs.chef.io/knife.html), a command-line tool
|
||||
to interact with [Chef](https://chef.io), a platform to automate and manage infrastructure via
|
||||
code.
|
||||
|
||||
To use it, add `knife` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... knife)
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `KNIFE_RELATIVE_PATH`: if set to `true`, the completion script will look for local cookbooks
|
||||
under the `cookbooks` folder in the chef root directory. It has preference over the other two
|
||||
options below. **Default:** empty.
|
||||
|
||||
- `KNIFE_COOKBOOK_PATH`: if set, it points to the folder that contains local cookbooks, for
|
||||
example: `/path/to/my/chef/cookbooks`. **Default:** `cookbook_path` field in `knife.rb`
|
||||
(see below).
|
||||
|
||||
- `KNIFE_CONF_PATH`: variable pointing to the `knife.rb` configuration file, for example
|
||||
`/path/to/my/.chef/knife.rb`. Only used if `$KNIFE_COOKBOOK_PATH` isn't set. If it exists,
|
||||
`$PWD/.chef/knife.rb` is used instead. Otherwise, if it's set, its value is used.
|
||||
**Default**: `$HOME/.chef/knife.rb`.
|
||||
@@ -3,13 +3,13 @@
|
||||
# You can override the path to knife.rb and your cookbooks by setting
|
||||
# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
|
||||
# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
|
||||
# If you want your local cookbooks path to be calculated relative to where you are then
|
||||
# If you want your local cookbooks path to be calculated relative to where you are then
|
||||
# set the below option
|
||||
# KNIFE_RELATIVE_PATH=true
|
||||
# KNIFE_RELATIVE_PATH=true
|
||||
# Read around where these are used for more detail.
|
||||
|
||||
# These flags should be available everywhere according to man knife
|
||||
knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
|
||||
knife_general_flags=(--help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes)
|
||||
|
||||
# knife has a very special syntax, some example calls are:
|
||||
# knife status
|
||||
@@ -25,183 +25,191 @@ _knife() {
|
||||
typeset -A opt_args
|
||||
cloudproviders=(bluebox ec2 rackspace slicehost terremark)
|
||||
_arguments \
|
||||
'1: :->knifecmd'\
|
||||
'2: :->knifesubcmd'\
|
||||
'1: :->knifecmd' \
|
||||
'2: :->knifesubcmd' \
|
||||
'3: :->knifesubcmd2' \
|
||||
'4: :->knifesubcmd3' \
|
||||
'5: :->knifesubcmd4' \
|
||||
'6: :->knifesubcmd5'
|
||||
|
||||
|
||||
case $state in
|
||||
knifecmd)
|
||||
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload vault windows $cloudproviders
|
||||
;;
|
||||
;;
|
||||
knifesubcmd)
|
||||
case $words[2] in
|
||||
(bluebox|ec2|rackspace|slicehost|terremark)
|
||||
bluebox|ec2|rackspace|slicehost|terremark)
|
||||
compadd "$@" server images
|
||||
;;
|
||||
;;
|
||||
client)
|
||||
compadd -Q "$@" "bulk delete" list create show delete edit reregister
|
||||
;;
|
||||
;;
|
||||
configure)
|
||||
compadd "$@" client
|
||||
;;
|
||||
;;
|
||||
cookbook)
|
||||
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
|
||||
;;
|
||||
;;
|
||||
diff)
|
||||
_arguments '*:file or directory:_files -g "*"'
|
||||
;;
|
||||
;;
|
||||
environment)
|
||||
compadd -Q "$@" list create delete edit show "from file"
|
||||
;;
|
||||
;;
|
||||
node)
|
||||
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
|
||||
;;
|
||||
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
|
||||
;;
|
||||
recipe)
|
||||
compadd "$@" list
|
||||
;;
|
||||
compadd "$@" list
|
||||
;;
|
||||
role)
|
||||
compadd -Q "$@" "bulk delete" create delete edit "from file" list show
|
||||
;;
|
||||
;;
|
||||
upload)
|
||||
_arguments '*:file or directory:_files -g "*"'
|
||||
;;
|
||||
_arguments '*:file or directory:_files -g "*"'
|
||||
;;
|
||||
vault)
|
||||
compadd -Q "$@" create decrypt delete edit remove "rotate all keys" "rotate keys" show update
|
||||
;;
|
||||
;;
|
||||
windows)
|
||||
compadd "$@" bootstrap
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
_arguments '2:Subsubcommands:($(_knife_options1))'
|
||||
_arguments '2:Subsubcommands:($(_knife_options1))'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
knifesubcmd2)
|
||||
;;
|
||||
knifesubcmd2)
|
||||
case $words[3] in
|
||||
server)
|
||||
server)
|
||||
compadd "$@" list create delete
|
||||
;;
|
||||
images)
|
||||
;;
|
||||
images)
|
||||
compadd "$@" list
|
||||
;;
|
||||
site)
|
||||
;;
|
||||
site)
|
||||
compadd "$@" vendor show share search download list unshare
|
||||
;;
|
||||
(show|delete|edit)
|
||||
_arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
|
||||
;;
|
||||
(upload|test)
|
||||
_arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
|
||||
;;
|
||||
;;
|
||||
show|delete|edit)
|
||||
_arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
|
||||
;;
|
||||
upload|test)
|
||||
_arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
|
||||
;;
|
||||
list)
|
||||
compadd -a "$@" knife_general_flags
|
||||
;;
|
||||
compadd -a "$@" knife_general_flags
|
||||
;;
|
||||
bag)
|
||||
compadd -Q "$@" show edit list "from file" create delete
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
_arguments '3:Subsubcommands:($(_knife_options2))'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
knifesubcmd3)
|
||||
case $words[3] in
|
||||
show)
|
||||
case $words[2] in
|
||||
cookbook)
|
||||
versioncomp=1
|
||||
_arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
|
||||
;;
|
||||
(node|client|role)
|
||||
compadd "$@" --attribute
|
||||
esac
|
||||
esac
|
||||
case $words[4] in
|
||||
(show|edit)
|
||||
_arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
|
||||
;;
|
||||
file)
|
||||
knifesubcmd3)
|
||||
case $words[3] in
|
||||
show)
|
||||
case $words[2] in
|
||||
cookbook)
|
||||
versioncomp=1
|
||||
_arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
|
||||
;;
|
||||
node|client|role)
|
||||
compadd "$@" --attribute
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
case $words[4] in
|
||||
show|edit)
|
||||
_arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
|
||||
;;
|
||||
file)
|
||||
case $words[2] in
|
||||
environment)
|
||||
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/environments"'
|
||||
;;
|
||||
;;
|
||||
node)
|
||||
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/nodes"'
|
||||
;;
|
||||
;;
|
||||
role)
|
||||
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/roles"'
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
_arguments '*:Subsubcommands:($(_knife_options3))'
|
||||
esac
|
||||
;;
|
||||
list)
|
||||
compadd -a "$@" knife_general_flags
|
||||
;;
|
||||
*)
|
||||
_arguments '*:Subsubcommands:($(_knife_options3))'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
list)
|
||||
compadd -a "$@" knife_general_flags
|
||||
;;
|
||||
*)
|
||||
_arguments '*:Subsubcommands:($(_knife_options3))'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
knifesubcmd4)
|
||||
if (( versioncomp > 0 )); then
|
||||
compadd "$@" attributes definitions files libraries providers recipes resources templates
|
||||
else
|
||||
case $words[5] in
|
||||
file)
|
||||
_arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
|
||||
knifesubcmd4)
|
||||
if ((versioncomp > 0)); then
|
||||
compadd "$@" attributes definitions files libraries providers recipes resources templates
|
||||
else
|
||||
case $words[5] in
|
||||
file)
|
||||
_arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
|
||||
;;
|
||||
*) _arguments '*:Subsubcommands:($(_knife_options2))'
|
||||
*) _arguments '*:Subsubcommands:($(_knife_options2))' ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
knifesubcmd5)
|
||||
case $words[5] in
|
||||
file)
|
||||
_arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"'
|
||||
;;
|
||||
*)
|
||||
_arguments '*:Subsubcommands:($(_knife_options3))'
|
||||
esac
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
knifesubcmd5)
|
||||
case $words[5] in
|
||||
file)
|
||||
_arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"'
|
||||
;;
|
||||
*)
|
||||
_arguments '*:Subsubcommands:($(_knife_options3))'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Helper functions to provide the argument completion for several depths of commands
|
||||
_knife_options1() {
|
||||
( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
|
||||
(for line in $(knife $words[2] --help | grep -v "^knife"); do echo $line | grep "\-\-"; done)
|
||||
}
|
||||
|
||||
_knife_options2() {
|
||||
( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
|
||||
(for line in $(knife $words[2] $words[3] --help | grep -v "^knife"); do echo $line | grep "\-\-"; done)
|
||||
}
|
||||
|
||||
_knife_options3() {
|
||||
( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
|
||||
(for line in $(knife $words[2] $words[3] $words[4] --help | grep -v "^knife"); do echo $line | grep "\-\-"; done)
|
||||
}
|
||||
|
||||
# The chef_x_remote functions use knife to get a list of objects of type x on the server
|
||||
_chef_roles_remote() {
|
||||
(knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
(knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
}
|
||||
|
||||
_chef_clients_remote() {
|
||||
(knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
(knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
}
|
||||
|
||||
_chef_nodes_remote() {
|
||||
(knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
(knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
}
|
||||
|
||||
_chef_cookbooks_remote() {
|
||||
(knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
(knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
}
|
||||
|
||||
_chef_sitecookbooks_remote() {
|
||||
(knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
(knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
}
|
||||
|
||||
_chef_data_bags_remote() {
|
||||
(knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
(knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||
}
|
||||
|
||||
_chef_environments_remote() {
|
||||
@@ -210,14 +218,14 @@ _chef_environments_remote() {
|
||||
|
||||
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
|
||||
_chef_cookbooks_local() {
|
||||
if [ $KNIFE_RELATIVE_PATH ]; then
|
||||
if [ $KNIFE_RELATIVE_PATH ]; then
|
||||
local cookbook_path="$(_chef_root)/cookbooks"
|
||||
else
|
||||
else
|
||||
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
|
||||
if [ -f ./.chef/knife.rb ]; then
|
||||
knife_rb="./.chef/knife.rb"
|
||||
fi
|
||||
local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
|
||||
local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/')}
|
||||
fi
|
||||
(for i in $cookbook_path; do ls $i; done)
|
||||
}
|
||||
@@ -227,12 +235,11 @@ _cookbook_versions() {
|
||||
(knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g')
|
||||
}
|
||||
|
||||
# Searches up from current directory to find the closest folder that has a .chef folder
|
||||
# Useful for the knife upload/from file commands
|
||||
_chef_root () {
|
||||
# Searches up from current directory to find the closest folder that has a .chef folder
|
||||
# Useful for the knife upload/from file commands
|
||||
_chef_root() {
|
||||
directory="$PWD"
|
||||
while [ $directory != '/' ]
|
||||
do
|
||||
while [ $directory != '/' ]; do
|
||||
test -e "$directory/.chef" && echo "$directory" && return
|
||||
directory="${directory:h}"
|
||||
done
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# knife_ssh plugin
|
||||
|
||||
This plugin adds a `knife_ssh` function as well as completion for it, to allow
|
||||
connecting via ssh to servers managed with [Chef](https://www.chef.io/).
|
||||
|
||||
To use it, add `knife_ssh` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... knife_ssh)
|
||||
```
|
||||
|
||||
The plugin creates a cache of the Chef node list via `knife`, and stores it
|
||||
in `$HOME/.knife_comp~`, when first triggering knife_ssh completion.
|
||||
|
||||
**Requirements:** `knife` has to be installed.
|
||||
@@ -1,17 +1,17 @@
|
||||
function knife_ssh() {
|
||||
grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~;
|
||||
grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~
|
||||
ssh $(knife node show $1 | awk '/IP:/{print $2}')
|
||||
}
|
||||
|
||||
_knife_ssh() {
|
||||
if hash knife 2>/dev/null; then
|
||||
if [[ ! -f ~/.knife_comp~ ]]; then
|
||||
echo "\nGenerating ~/.knife_comp~..." >/dev/stderr
|
||||
echo "\nGenerating ~/.knife_comp~..." >&2
|
||||
knife node list > ~/.knife_comp~
|
||||
fi
|
||||
compadd $(<~/.knife_comp~)
|
||||
compadd $(< ~/.knife_comp~)
|
||||
else
|
||||
echo "Could not find knife" > /dev/stderr;
|
||||
echo "Could not find knife" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ alias kdelf='kubectl delete -f'
|
||||
|
||||
# Pod management.
|
||||
alias kgp='kubectl get pods'
|
||||
alias kgpa='kubectl get pods --all-namespaces'
|
||||
alias kgpw='kgp --watch'
|
||||
alias kgpwide='kgp -o wide'
|
||||
alias kep='kubectl edit pods'
|
||||
@@ -48,6 +49,7 @@ alias kgpl='kgp -l'
|
||||
|
||||
# Service management.
|
||||
alias kgs='kubectl get svc'
|
||||
alias kgsa='kubectl get svc --all-namespaces'
|
||||
alias kgsw='kgs --watch'
|
||||
alias kgswide='kgs -o wide'
|
||||
alias kes='kubectl edit svc'
|
||||
@@ -56,6 +58,7 @@ alias kdels='kubectl delete svc'
|
||||
|
||||
# Ingress management
|
||||
alias kgi='kubectl get ingress'
|
||||
alias kgia='kubectl get ingress --all-namespaces'
|
||||
alias kei='kubectl edit ingress'
|
||||
alias kdi='kubectl describe ingress'
|
||||
alias kdeli='kubectl delete ingress'
|
||||
@@ -69,17 +72,20 @@ alias kcn='kubectl config set-context $(kubectl config current-context) --namesp
|
||||
|
||||
# ConfigMap management
|
||||
alias kgcm='kubectl get configmaps'
|
||||
alias kgcma='kubectl get configmaps --all-namespaces'
|
||||
alias kecm='kubectl edit configmap'
|
||||
alias kdcm='kubectl describe configmap'
|
||||
alias kdelcm='kubectl delete configmap'
|
||||
|
||||
# Secret management
|
||||
alias kgsec='kubectl get secret'
|
||||
alias kgseca='kubectl get secret --all-namespaces'
|
||||
alias kdsec='kubectl describe secret'
|
||||
alias kdelsec='kubectl delete secret'
|
||||
|
||||
# Deployment management.
|
||||
alias kgd='kubectl get deployment'
|
||||
alias kgda='kubectl get deployment --all-namespaces'
|
||||
alias kgdw='kgd --watch'
|
||||
alias kgdwide='kgd -o wide'
|
||||
alias ked='kubectl edit deployment'
|
||||
@@ -98,6 +104,7 @@ alias kru='kubectl rollout undo'
|
||||
|
||||
# Statefulset management.
|
||||
alias kgss='kubectl get statefulset'
|
||||
alias kgssa='kubectl get statefulset --all-namespaces'
|
||||
alias kgssw='kgss --watch'
|
||||
alias kgsswide='kgss -o wide'
|
||||
alias kess='kubectl edit statefulset'
|
||||
@@ -115,7 +122,13 @@ alias kgaa='kubectl get all --all-namespaces'
|
||||
|
||||
# Logs
|
||||
alias kl='kubectl logs'
|
||||
alias kl1h='kubectl logs --since 1h'
|
||||
alias kl1m='kubectl logs --since 1m'
|
||||
alias kl1s='kubectl logs --since 1s'
|
||||
alias klf='kubectl logs -f'
|
||||
alias klf1h='kubectl logs --since 1h -f'
|
||||
alias klf1m='kubectl logs --since 1m -f'
|
||||
alias klf1s='kubectl logs --since 1s -f'
|
||||
|
||||
# File copy
|
||||
alias kcp='kubectl cp'
|
||||
@@ -128,6 +141,7 @@ alias kdelno='kubectl delete node'
|
||||
|
||||
# PVC management.
|
||||
alias kgpvc='kubectl get pvc'
|
||||
alias kgpvca='kubectl get pvc --all-namespaces'
|
||||
alias kgpvcw='kgpvc --watch'
|
||||
alias kepvc='kubectl edit pvc'
|
||||
alias kdpvc='kubectl describe pvc'
|
||||
|
||||
@@ -29,6 +29,12 @@ plugins=(... laravel)
|
||||
| `pamc` | `php artisan make:controller` |
|
||||
| `pams` | `php artisan make:seeder` |
|
||||
| `pamt` | `php artisan make:test` |
|
||||
| `pamfa` | `php artisan make:factory` |
|
||||
| `pamp` | `php artisan make:policy` |
|
||||
| `pame` | `php artisan make:event` |
|
||||
| `pamj` | `php artisan make:job` |
|
||||
| `paml` | `php artisan make:listener` |
|
||||
| `pamn` | `php artisan make:notification` |
|
||||
|
||||
## Clears
|
||||
|
||||
@@ -38,3 +44,14 @@ plugins=(... laravel)
|
||||
| `pacoc` | `php artisan config:clear` |
|
||||
| `pavic` | `php artisan view:clear` |
|
||||
| `paroc` | `php artisan route:clear` |
|
||||
|
||||
## Queues
|
||||
|
||||
| Alias | Description |
|
||||
|:-:|:-:|
|
||||
| `paqf` | `php artisan queue:failed` |
|
||||
| `paqft` | `php artisan queue:failed-table` |
|
||||
| `paql` | `php artisan queue:listen` |
|
||||
| `paqr` | `php artisan queue:retry` |
|
||||
| `paqt` | `php artisan queue:table` |
|
||||
| `paqw` | `php artisan queue:work` |
|
||||
|
||||
@@ -17,6 +17,13 @@ alias pamm='php artisan make:model'
|
||||
alias pamc='php artisan make:controller'
|
||||
alias pams='php artisan make:seeder'
|
||||
alias pamt='php artisan make:test'
|
||||
alias pamfa='php artisan make:factory'
|
||||
alias pamp='php artisan make:policy'
|
||||
alias pame='php artisan make:event'
|
||||
alias pamj='php artisan make:job'
|
||||
alias paml='php artisan make:listener'
|
||||
alias pamn='php artisan make:notification'
|
||||
alias pampp='php artisan make:provider'
|
||||
|
||||
|
||||
# Clears
|
||||
@@ -24,3 +31,11 @@ alias pacac='php artisan cache:clear'
|
||||
alias pacoc='php artisan config:clear'
|
||||
alias pavic='php artisan view:clear'
|
||||
alias paroc='php artisan route:clear'
|
||||
|
||||
# queues
|
||||
alias paqf='php artisan queue:failed'
|
||||
alias paqft='php artisan queue:failed-table'
|
||||
alias paql='php artisan queue:listen'
|
||||
alias paqr='php artisan queue:retry'
|
||||
alias paqt='php artisan queue:table'
|
||||
alias paqw='php artisan queue:work'
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
typeset -g ZSH_LAST_WORKING_DIRECTORY
|
||||
|
||||
# Updates the last directory once directory is changed
|
||||
chpwd_functions+=(chpwd_last_working_dir)
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd chpwd_last_working_dir
|
||||
chpwd_last_working_dir() {
|
||||
if [ "$ZSH_SUBSHELL" = 0 ]; then
|
||||
local cache_file="$ZSH_CACHE_DIR/last-working-dir"
|
||||
|
||||
@@ -13,10 +13,10 @@ Plugin for adding catspeak aliases, because why not
|
||||
)
|
||||
```
|
||||
|
||||
2. Reload the source file or restart your Terminal session:
|
||||
2. Restart your terminal session or restart the shell:
|
||||
|
||||
```console
|
||||
$ source ~/.zshrc
|
||||
$ exec zsh
|
||||
$
|
||||
```
|
||||
|
||||
@@ -61,7 +61,7 @@ Plugin for adding catspeak aliases, because why not
|
||||
| `violenz` | `git rebase` |
|
||||
| `visible` | `echo` |
|
||||
| `wtf` | `dmesg` |
|
||||
| `yolo` | `git commit -m "$(curl -s https://whatthecommit.com/index.txt)"` |
|
||||
| `yolo` | `git commit -m "$(curl -s http://whatthecommit.com/index.txt)"` |
|
||||
|
||||
## Usage Examples
|
||||
|
||||
@@ -78,6 +78,6 @@ nowai u=r,go= some.file
|
||||
# ssh root@catserver.org
|
||||
pwned root@catserver.org
|
||||
|
||||
# git commit -m "$(curl -s https://whatthecommit.com/index.txt)"
|
||||
# git commit -m "$(curl -s http://whatthecommit.com/index.txt)"
|
||||
yolo
|
||||
```
|
||||
|
||||
@@ -45,7 +45,7 @@ alias bringz='git pull'
|
||||
alias chicken='git add'
|
||||
alias oanward='git commit -m'
|
||||
alias ooanward='git commit -am'
|
||||
alias yolo='git commit -m "$(curl -s https://whatthecommit.com/index.txt)"'
|
||||
alias yolo='git commit -m "$(curl -s http://whatthecommit.com/index.txt)"'
|
||||
alias letcat='git checkout'
|
||||
alias violenz='git rebase'
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
## Magic Enter plugin
|
||||
|
||||
This plugin makes your enter key magical, by binding commonly used commands to it.
|
||||
|
||||
To use it, add `magic-enter` to the plugins array in your zshrc file. You can set the
|
||||
commands to be run in your .zshrc, before the line containing plugins. If no command
|
||||
is specified in a git directory, `git status` is executed; in other directories, `ls`.
|
||||
|
||||
```zsh
|
||||
# defaults
|
||||
MAGIC_ENTER_GIT_COMMAND='git status -u .'
|
||||
MAGIC_ENTER_OTHER_COMMAND='ls -lh .'
|
||||
|
||||
plugins=(... magic-enter)
|
||||
```
|
||||
|
||||
**Maintainer:** [@dufferzafar](https://github.com/dufferzafar)
|
||||
@@ -1,6 +1,6 @@
|
||||
## Introduction
|
||||
|
||||
The [meteor plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/meteor) provides many
|
||||
The [meteor plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/meteor) provides many
|
||||
[useful aliases](#aliases) as well as completion for the `meteor` command.
|
||||
|
||||
Enable it by adding `meteor` to the plugins array in your zshrc file:
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# MicroK8s plugin
|
||||
|
||||
This plugin provides completion and useful aliases for [MicroK8s](https://microk8s.io/).
|
||||
|
||||
To use it, add `microk8s` to the plugins array in your zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... microk8s)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|------------------|----------------------------------------------------------------------------------------------------------|
|
||||
| mco | microk8s.config | Shows the Kubernetes config file. |
|
||||
| mct | microk8s.ctr | Interact with containerd CLI. |
|
||||
| mdi | microk8s.disable | Disables an addon. |
|
||||
| me | microk8s.enable | Enables an addon. |
|
||||
| mh | microk8s.helm | Interact with Helm CLI. |
|
||||
| mis | microk8s.istio | Interact with Istio CLI. |
|
||||
| mk | microk8s.kubectl | Interact with Kubernetes CLI. |
|
||||
| msp | microk8s.stop | Stops all Kubernetes services. |
|
||||
| mst | microk8s.start | Starts MicroK8s after it is being stopped. |
|
||||
| msts | microk8s.status | Provides an overview of the MicroK8s state (running / not running) as well as the set of enabled addons. |
|
||||
@@ -0,0 +1,82 @@
|
||||
# ---------------------------------------------------------- #
|
||||
# Aliases and Completions for MicroK8s (https://microk8s.io) #
|
||||
# Author: Shaun Tabone (https://github.com/xontab) #
|
||||
# ---------------------------------------------------------- #
|
||||
|
||||
# Helper function to cache and load completions
|
||||
_microk8s_cache_completion() {
|
||||
local cache="${ZSH_CACHE_DIR}/microk8s_$(echo $1)_completion"
|
||||
if [[ ! -f $cache ]]; then
|
||||
$2 $cache
|
||||
fi
|
||||
|
||||
[[ -f $cache ]] && source $cache
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------- #
|
||||
# microk8s.enable #
|
||||
# ALIAS: me #
|
||||
# ---------------------------------------------------------- #
|
||||
_microk8s_enable_get_command_list() {
|
||||
microk8s.enable --help | tail -n +7 | awk '{$1=$1;print}'
|
||||
}
|
||||
|
||||
_microk8s_enable() {
|
||||
compadd -X "MicroK8s Addons" $(_microk8s_enable_get_command_list)
|
||||
}
|
||||
|
||||
compdef _microk8s_enable microk8s.enable
|
||||
alias me='microk8s.enable'
|
||||
|
||||
# ---------------------------------------------------------- #
|
||||
# microk8s.disable #
|
||||
# ALIAS: mdi #
|
||||
# ---------------------------------------------------------- #
|
||||
_microk8s_disable_get_command_list() {
|
||||
microk8s.disable --help | tail -n +7 | awk '{$1=$1;print}'
|
||||
}
|
||||
|
||||
_microk8s_disable() {
|
||||
compadd -X "MicroK8s Addons" $(_microk8s_disable_get_command_list)
|
||||
}
|
||||
|
||||
compdef _microk8s_disable microk8s.disable
|
||||
alias mdi='microk8s.disable'
|
||||
|
||||
# ---------------------------------------------------------- #
|
||||
# microk8s.kubectl #
|
||||
# ALIAS: mk #
|
||||
# ---------------------------------------------------------- #
|
||||
_microk8s_kubectl_completion() {
|
||||
if [ $commands[microk8s.kubectl] ]; then
|
||||
microk8s.kubectl 2>/dev/null >/dev/null && microk8s.kubectl completion zsh | sed 's/__start_kubectl kubectl/__start_kubectl microk8s.kubectl/g' >$1
|
||||
fi
|
||||
}
|
||||
|
||||
_microk8s_cache_completion 'kubectl' _microk8s_kubectl_completion
|
||||
|
||||
alias mk='microk8s.kubectl'
|
||||
|
||||
# ---------------------------------------------------------- #
|
||||
# microk8s.helm #
|
||||
# ALIAS: mh #
|
||||
# ---------------------------------------------------------- #
|
||||
_microk8s_helm_completion() {
|
||||
if [ $commands[microk8s.helm] ]; then
|
||||
microk8s.helm completion zsh | sed 's/__start_helm helm/__start_helm microk8s.helm/g' >$1
|
||||
fi
|
||||
}
|
||||
|
||||
_microk8s_cache_completion 'helm' _microk8s_helm_completion
|
||||
|
||||
alias mh='microk8s.helm'
|
||||
|
||||
# ---------------------------------------------------------- #
|
||||
# Other Aliases #
|
||||
# ---------------------------------------------------------- #
|
||||
alias mco='microk8s.config'
|
||||
alias mct='microk8s.ctr'
|
||||
alias mis='microk8s.istio'
|
||||
alias mst='microk8s.start'
|
||||
alias msts='microk8s.status'
|
||||
alias msp='microk8s.stop'
|
||||
@@ -55,4 +55,4 @@ has colored output, so this function will be soon removed from the plugin.
|
||||
### Known bugs
|
||||
|
||||
It has a bug where it will swallow mvn prompts for user input, _e.g._ when using
|
||||
`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052).
|
||||
`archetype:generate`. See [#5052](https://github.com/ohmyzsh/ohmyzsh/issues/5052).
|
||||
|
||||
@@ -267,6 +267,8 @@ function listMavenCompletions {
|
||||
stage:copy
|
||||
# toolchain
|
||||
toolchain:toolchain
|
||||
#liberty
|
||||
liberty:clean-server liberty:compile-jsp liberty:configure-arquillian liberty:create-server liberty:debug liberty:debug-server liberty:deploy liberty:dev liberty:display-url liberty:dump-server liberty:install-apps liberty:install-feature liberty:install-server liberty:java-dump-server liberty:package-server liberty:run liberty:run-server liberty:server-status liberty:start liberty:start-server liberty:status liberty:stop liberty:stop-server liberty:test-start-server liberty:test-stop-server liberty:undeploy liberty:uninstall-feature
|
||||
|
||||
# options
|
||||
"-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile="
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## NG Plugin
|
||||
|
||||
This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng)
|
||||
This [ng plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/ng)
|
||||
adds completion support for Angular's CLI (named ng).
|
||||
|
||||
Ng is hosted on [ng home](https://github.com/catull/angular-cli)
|
||||
|
||||
@@ -42,20 +42,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
| :-------------- | :-------------------------------------------------- |
|
||||
| `tab` | Open the current directory in a new tab |
|
||||
| `split_tab` | Split the current terminal tab horizontally |
|
||||
| `vsplit_tab` | Split the current terminal tab vertically |
|
||||
| `ofd` | Open the current directory in a Finder window |
|
||||
| `pfd` | Return the path of the frontmost Finder window |
|
||||
| `pfs` | Return the current Finder selection |
|
||||
| `cdf` | `cd` to the current Finder directory |
|
||||
| `pushdf` | `pushd` to the current Finder directory |
|
||||
| `quick-look` | Quick-Look a specified file |
|
||||
| `man-preview` | Open a specified man page in Preview app |
|
||||
| `showfiles` | Show hidden files |
|
||||
| `hidefiles` | Hide the hidden files |
|
||||
| `itunes` | Control iTunes. Use `itunes -h` for usage details |
|
||||
| `spotify` | Control Spotify and search by artist, album, track… |
|
||||
| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
|
||||
| Command | Description |
|
||||
| :-------------- | :---------------------------------------------------- |
|
||||
| `tab` | Open the current directory in a new tab |
|
||||
| `split_tab` | Split the current terminal tab horizontally |
|
||||
| `vsplit_tab` | Split the current terminal tab vertically |
|
||||
| `ofd` | Open the current directory in a Finder window |
|
||||
| `pfd` | Return the path of the frontmost Finder window |
|
||||
| `pfs` | Return the current Finder selection |
|
||||
| `cdf` | `cd` to the current Finder directory |
|
||||
| `pushdf` | `pushd` to the current Finder directory |
|
||||
| `quick-look` | Quick-Look a specified file |
|
||||
| `man-preview` | Open a specified man page in Preview app |
|
||||
| `showfiles` | Show hidden files |
|
||||
| `hidefiles` | Hide the hidden files |
|
||||
| `itunes` | DEPRECATED. Use `music` from macOS Catalina on |
|
||||
| `music` | Control Apple Music. Use `music -h` for usage details |
|
||||
| `spotify` | Control Spotify and search by artist, album, track… |
|
||||
| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
|
||||
|
||||
@@ -219,7 +219,19 @@ function vncviewer() {
|
||||
}
|
||||
|
||||
# iTunes control function
|
||||
function itunes() {
|
||||
function itunes music() {
|
||||
local APP_NAME=Music
|
||||
|
||||
autoload is-at-least
|
||||
if is-at-least 10.15 $(sw_vers -productVersion); then
|
||||
if [[ $0 = itunes ]]; then
|
||||
echo >&2 The itunes function name is deprecated. Use \`music\' instead.
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
APP_NAME=iTunes
|
||||
fi
|
||||
|
||||
local opt=$1
|
||||
local playlist=$2
|
||||
shift
|
||||
@@ -236,7 +248,7 @@ function itunes() {
|
||||
opt="$opt track"
|
||||
;;
|
||||
vol)
|
||||
local new_volume volume=$(osascript -e 'tell application "iTunes" to get sound volume')
|
||||
local new_volume volume=$(osascript -e "tell application \"$APP_NAME\" to get sound volume")
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "Current volume is ${volume}."
|
||||
return 0
|
||||
@@ -251,26 +263,26 @@ function itunes() {
|
||||
opt="set sound volume to ${new_volume}"
|
||||
;;
|
||||
playlist)
|
||||
# Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
|
||||
if [[ ! -z "$playlist" ]]; then
|
||||
osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
|
||||
# Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
|
||||
if [[ ! -z "$playlist" ]]; then
|
||||
osascript -e "tell application \"$APP_NAME\"" -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
|
||||
if [[ $? -eq 0 ]]; then
|
||||
opt="play"
|
||||
else
|
||||
opt="stop"
|
||||
fi
|
||||
else
|
||||
opt="set allPlaylists to (get name of every playlist)"
|
||||
fi
|
||||
;;
|
||||
else
|
||||
opt="set allPlaylists to (get name of every playlist)"
|
||||
fi
|
||||
;;
|
||||
playing|status)
|
||||
local state=`osascript -e 'tell application "iTunes" to player state as string'`
|
||||
local state=`osascript -e "tell application \"$APP_NAME\" to player state as string"`
|
||||
if [[ "$state" = "playing" ]]; then
|
||||
currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'`
|
||||
currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
|
||||
currenttrack=`osascript -e "tell application \"$APP_NAME\" to name of current track as string"`
|
||||
currentartist=`osascript -e "tell application \"$APP_NAME\" to artist of current track as string"`
|
||||
echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color";
|
||||
else
|
||||
echo "iTunes is" $state;
|
||||
echo "$APP_NAME is" $state;
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
@@ -284,7 +296,7 @@ if [[ ! -z "$playlist" ]]; then
|
||||
|
||||
if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]]
|
||||
then
|
||||
print "Usage: itunes shuffle [on|off|toggle]. Invalid option."
|
||||
print "Usage: $0 shuffle [on|off|toggle]. Invalid option."
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -305,14 +317,14 @@ EOF
|
||||
esac
|
||||
;;
|
||||
""|-h|--help)
|
||||
echo "Usage: itunes <option>"
|
||||
echo "Usage: $0 <option>"
|
||||
echo "option:"
|
||||
echo "\tlaunch|play|pause|stop|rewind|resume|quit"
|
||||
echo "\tmute|unmute\tcontrol volume set"
|
||||
echo "\tnext|previous\tplay next or previous track"
|
||||
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
|
||||
echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
|
||||
echo "\tplaying|status\tShow what song is currently playing in iTunes."
|
||||
echo "\tplaying|status\tShow what song is currently playing in Music."
|
||||
echo "\tplaylist [playlist name]\t Play specific playlist"
|
||||
echo "\thelp\tshow this message and exit"
|
||||
return 0
|
||||
@@ -322,7 +334,7 @@ EOF
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
osascript -e "tell application \"iTunes\" to $opt"
|
||||
osascript -e "tell application \"$APP_NAME\" to $opt"
|
||||
}
|
||||
|
||||
# Spotify control function
|
||||
|
||||
@@ -148,11 +148,11 @@ if [ $# = 0 ]; then
|
||||
else
|
||||
if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
|
||||
echo "The Spotify application must be installed."
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
|
||||
osascript -e 'tell application "Spotify" to activate' || exit 1
|
||||
osascript -e 'tell application "Spotify" to activate' || return 1
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
@@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do
|
||||
if [ -z "${CLIENT_ID}" ]; then
|
||||
cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}";
|
||||
showAPIHelp;
|
||||
exit 1;
|
||||
return 1
|
||||
fi
|
||||
if [ -z "${CLIENT_SECRET}" ]; then
|
||||
cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}";
|
||||
showAPIHelp;
|
||||
exit 1;
|
||||
return 1
|
||||
fi
|
||||
SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
|
||||
SPOTIFY_PLAY_URI="";
|
||||
@@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
|
||||
cecho "Autorization failed, please check ${USER_CONFG_FILE}"
|
||||
cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}"
|
||||
showAPIHelp
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
SPOTIFY_ACCESS_TOKEN=$( \
|
||||
printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \
|
||||
@@ -307,7 +307,7 @@ while [ $# -gt 0 ]; do
|
||||
|
||||
"quit" ) cecho "Quitting Spotify.";
|
||||
osascript -e 'tell application "Spotify" to quit';
|
||||
exit 0 ;;
|
||||
break ;;
|
||||
|
||||
"next" ) cecho "Going to next track." ;
|
||||
osascript -e 'tell application "Spotify" to next track';
|
||||
@@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
|
||||
echo " vol down # Decreases the volume by 10%.";
|
||||
echo " vol [amount] # Sets the volume to an amount between 0 and 100.";
|
||||
echo " vol # Shows the current Spotify volume.";
|
||||
exit 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
|
||||
@@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do
|
||||
"help" )
|
||||
showHelp;
|
||||
break ;;
|
||||
|
||||
* )
|
||||
showHelp;
|
||||
exit 1;
|
||||
return 1 ;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# otp plugin
|
||||
|
||||
This plugin allows you to create one-time passwords using [`oathtool`](https://www.nongnu.org/oath-toolkit/man-oathtool.html),
|
||||
able to replace MFA devices. The oathtool key is kept in a GPG-encrypted file so the codes
|
||||
can only be generated by a user able to decrypt it.
|
||||
|
||||
To use it, add `otp` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... otp)
|
||||
```
|
||||
|
||||
Provided aliases:
|
||||
|
||||
- `otp_add_device`: creates a new encrypted storage for an oathtool key and stores it
|
||||
on the disk. For encrypting the key, it will ask for a GPG user ID (your GPG key's
|
||||
email address). Then the OTP key needs to be pasted, followed by a CTRL+D character
|
||||
inserted on an empty line.
|
||||
|
||||
- `ot`: generates a MFA code based on the given key and copies it to the clipboard
|
||||
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
|
||||
|
||||
The plugin uses `$HOME/.otp` to store its internal files.
|
||||
@@ -12,32 +12,23 @@ function ot () {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ `uname` == 'Darwin' ]] then # MacOS X
|
||||
export COPY_CMD='pbcopy'
|
||||
elif command -v xsel > /dev/null 2>&1; then # Any Unix with xsel installed
|
||||
export COPY_CMD='xsel --clipboard --input'
|
||||
else
|
||||
COPY_CMD='true'
|
||||
fi
|
||||
COPY_CMD='true'
|
||||
|
||||
if [[ "x$1" == "x" ]]; then
|
||||
echo "usage: otpw <profile.name>"
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "usage: $0 <profile.name>"
|
||||
return 1
|
||||
elif [ ! -f $OTP_HOME/$1.otp.asc ]; then
|
||||
echo "missing profile $1, you might need to create it first using otp_add_device"
|
||||
return 1
|
||||
else
|
||||
totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc)
|
||||
oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD`
|
||||
if [[ $COPY_CMD == 'true' ]] then
|
||||
echo "Note: you might consider installing xsel for clipboard integration"
|
||||
fi
|
||||
oathtool --totp --b $totpkey | tee /dev/stderr | clipcopy
|
||||
fi
|
||||
}
|
||||
|
||||
function otp_add_device () {
|
||||
if [[ "x$1" == "x" ]] then
|
||||
echo "usage: otp_add <profile.name>"
|
||||
echo "usage: $0 <profile.name>"
|
||||
return 1
|
||||
else
|
||||
echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# pass
|
||||
|
||||
This plugin provides completion for the [pass](https://www.passwordstore.org/) password manager.
|
||||
|
||||
To use it, add `pass` to the plugins array in your zshrc file.
|
||||
|
||||
```
|
||||
plugins=(... pass)
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Multiple repositories
|
||||
|
||||
If you use multiple repositories, you can configure completion like this:
|
||||
```zsh
|
||||
compdef _pass workpass
|
||||
zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
|
||||
workpass() {
|
||||
PASSWORD_STORE_DIR=$HOME/work/pass pass $@
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
# Paver
|
||||
|
||||
This plugin adds completion for the `paver` command-line tool of [Paver](https://pythonhosted.org/Paver/).
|
||||
|
||||
To use it, add `paver` to the plugins array of your zshrc file:
|
||||
```zsh
|
||||
plugins=(... paver)
|
||||
```
|
||||
|
||||
The completion function creates a cache of paver tasks with the name `.paver_tasks`,
|
||||
in the current working directory. It regenerates that cache when the `pavement.py`
|
||||
changes.
|
||||
@@ -1,7 +1,7 @@
|
||||
_paver_does_target_list_need_generating () {
|
||||
[ ! -f .paver_targets ] && return 0;
|
||||
[ pavement.py -nt .paver_targets ] && return 0;
|
||||
return 1;
|
||||
[ ! -f .paver_targets ] && return 0
|
||||
[ pavement.py -nt .paver_targets ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
_paver () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## percol
|
||||
|
||||
Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh)
|
||||
Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh)
|
||||
|
||||
### Requirements
|
||||
|
||||
@@ -8,7 +8,7 @@ Provides some useful function to make [percol](https://github.com/mooz/percol) w
|
||||
pip install percol
|
||||
```
|
||||
|
||||
And [jump](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
|
||||
And [jump](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
|
||||
|
||||
### Usage
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# Phing plugin
|
||||
|
||||
This plugin adds autocompletion for [`phing`](https://github.com/phingofficial/phing) targets.
|
||||
|
||||
To use it, add `phing` to the plugins array of your `.zshrc` file:
|
||||
```
|
||||
plugins=(... eecms)
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user