summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/gradle/gradle.plugin.zsh1
-rw-r--r--plugins/singlechar/README.md118
-rw-r--r--plugins/singlechar/singlechar.plugin.zsh12
-rw-r--r--plugins/sprunge/README.md31
-rw-r--r--plugins/sprunge/sprunge.plugin.zsh86
-rw-r--r--plugins/terminalapp/terminalapp.plugin.zsh6
-rw-r--r--plugins/yarn/README.md2
-rw-r--r--plugins/yarn/_yarn32
-rw-r--r--plugins/yarn/yarn.plugin.zsh2
9 files changed, 222 insertions, 68 deletions
diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh
index 8d578e27b..6be583179 100644
--- a/plugins/gradle/gradle.plugin.zsh
+++ b/plugins/gradle/gradle.plugin.zsh
@@ -181,3 +181,4 @@ _gradlew_tasks () {
############################################################################
compdef _gradle_tasks gradle
compdef _gradlew_tasks gradlew
+compdef _gradlew_tasks gw
diff --git a/plugins/singlechar/README.md b/plugins/singlechar/README.md
new file mode 100644
index 000000000..d89029900
--- /dev/null
+++ b/plugins/singlechar/README.md
@@ -0,0 +1,118 @@
+# Singlechar plugin
+
+This plugin adds single char shortcuts (and combinations) for some commands.
+
+To use it, add `singlechar` to the plugins array of your zshrc file:
+```
+plugins=(... singlechar)
+```
+
+## Aliases
+
+### CAT, GREP, CURL, WGET
+
+| Alias | Command | Description |
+|-------|------------------|-------------|
+| y | `grep -Ri` | Find case-insensitive string in all files and directories, recursively. Follows symlinks. |
+| n | `grep -Rvi` | Same as above but only show lines that don't match the string. |
+| f | `grep -Rli` | Same as 'y' but only print the filenames where the string is found. |
+| fn | `grep -Rlvi` | Same as above but only show files that don't contain the string. |
+| f. | `find . \| grep` | Grep list of files in current directory |
+| f: | `find` | 'find' command |
+| p | `less` | 'less' command |
+| m | `man` | 'man' command |
+| d | `wget` | 'wget' command |
+| u | `curl` | 'curl' command |
+| c | `cat` | 'cat' command |
+| w | `echo >` | Write arguments to file, overwriting it if it exists. |
+| a | `echo >>` | Write arguments to file, appending them if the file exists. |
+| w: | `cat >` | Write stdin to file, overwriting if it exists. |
+| a: | `cat >>` | Write stdin to file, appending it if the file exists. |
+
+### XARGS
+
+These aliases are versions of the aliases above but using xargs. This can be used
+by piping the arguments to the xargs aliases.
+
+| Alias | Command | Description |
+|-------|----------------------|---------------------------------|
+| x | `xargs` | 'xargs' command |
+| xy | `xargs grep -Ri` | Same as 'y' alias using xargs. |
+| xn | `xargs grep -Rvi` | Same as 'n' alias using xargs. |
+| xf | `xargs grep -Rli` | Same as 'f' alias using xargs. |
+| xfn | `xargs grep -Rlvi` | Same as 'fn' alias using xargs. |
+| xf. | `xargs find \| grep` | Same as 'f.' alias using xargs. |
+| xf: | `xargs find` | Same as 'f:' alias using xargs. |
+| xc | `xargs cat` | Same as 'c' alias using xargs. |
+| xp | `xargs less` | Same as 'p' alias using xargs. |
+| xm | `xargs man` | Same as 'm' alias using xargs. |
+| xd | `xargs wget` | Same as 'd' alias using xargs. |
+| xu | `xargs curl` | Same as 'u' alias using xargs. |
+| xw | `xargs echo >` | Same as 'w' alias using xargs. |
+| xa | `xargs echo >>` | Same as 'a' alias using xargs. |
+| xw: | `xargs cat >` | Same as 'w:' alias using xargs. |
+| xa: | `xargs >>` | Same as 'a:' alias using xargs. |
+
+### SUDO
+
+These aliases are versions of the aliases above in [CAT, GREP, CURL, WGET](#cat-grep-curl-wget)
+but using sudo to run them with root permission.
+
+| Alias | Command | Description |
+|-------|-----------------------|--------------------------------|
+| s | `sudo` | 'sudo' command |
+| sy | `sudo grep -Ri` | Same as 'y' alias using sudo. |
+| sn | `sudo grep -Riv` | Same as 'n' alias using sudo. |
+| sf | `sudo grep -Rli` | Same as 'f' alias using sudo. |
+| sfn | `sudo grep -Rlvi` | Same as 'fn' alias using sudo. |
+| sf. | `sudo find . \| grep` | Same as 'f.' alias using sudo. |
+| sf: | `sudo find` | Same as 'f:' alias using sudo. |
+| sp | `sudo less` | Same as 'p' alias using sudo. |
+| sm | `sudo man` | Same as 'm' alias using sudo. |
+| sd | `sudo wget` | Same as 'd' alias using sudo. |
+| sc | `sudo cat` | Same as 'c' alias using sudo. |
+| sw | `sudo echo >` | Same as 'w' alias using sudo. |
+| sa | `sudo echo >>` | Same as 'a' alias using sudo. |
+| sw: | `sudo cat >` | Same as 'w:' alias using sudo. |
+| sa: | `sudo cat >>` | Same as 'a:' alias using sudo. |
+
+### SUDO-XARGS
+
+Same as above but using both sudo and xargs.
+
+| Alias | Command | Description |
+|-------|---------------------------|---------------------------------|
+| sx | `sudo xargs` | 'sudo xargs' command |
+| sxy | `sudo xargs grep -Ri` | Same as 'xy' alias using sudo. |
+| sxn | `sudo xargs grep -Riv` | Same as 'xn' alias using sudo. |
+| sxf | `sudo xargs grep -li` | Same as 'xf' alias using sudo. |
+| sxfn | `sudo xargs grep -lvi` | Same as 'xfn' alias using sudo. |
+| sxf. | `sudo xargs find \| grep` | Same as 'xf.' alias using sudo. |
+| sxf: | `sudo xargs find` | Same as 'xf:' alias using sudo. |
+| sxp | `sudo xargs less` | Same as 'xp' alias using sudo. |
+| sxm | `sudo xargs man` | Same as 'xm' alias using sudo. |
+| sxd | `sudo xargs wget` | Same as 'xd' alias using sudo. |
+| sxu | `sudo xargs curl` | Same as 'xu' alias using sudo. |
+| sxc | `sudo xargs cat` | Same as 'xc' alias using sudo. |
+| sxw | `sudo xargs echo >` | Same as 'xw' alias using sudo. |
+| sxa | `sudo xargs echo >>` | Same as 'xa' alias using sudo. |
+| sxw: | `sudo xargs cat >` | Same as 'xw:' alias using sudo. |
+| sxa: | `sudo xargs cat >>` | Same as 'xa:' alias using sudo. |
+
+## Options
+
+The commands `grep`, `sudo`, `wget`, `curl`, and `less` can be configured to use other commands
+via the setup variables below, before Oh My Zsh is sourced. If they are not set yet, they will
+use their default values:
+
+| Setup variable | Default value |
+|----------------|---------------|
+| GREP | `grep` |
+| ROOT | `sudo` |
+| WGET | `wget` |
+| CURL | `curl` |
+| PAGER | `less` |
+
+## Author
+
+- [Karolin Varner](https://github.com/koraa)
diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh
index 44bd998aa..d4b0b6735 100644
--- a/plugins/singlechar/singlechar.plugin.zsh
+++ b/plugins/singlechar/singlechar.plugin.zsh
@@ -1,13 +1,3 @@
-################################################################################
-# FILE: singlechar.plugin.zsh
-# DESCRIPTION: oh-my-zsh plugin file.
-# AUTHOR: Michael Varner (musikmichael@web.de)
-# VERSION: 1.0.0
-#
-# This plugin adds single char shortcuts (and combinations) for some commands.
-#
-################################################################################
-
###########################
# Settings
@@ -130,4 +120,4 @@ alias sxd='"$ROOT" xargs "$WGET"'
alias sxu='"$ROOT" xargs "$CURL"'
alias sxw:='"$ROOT" xargs cat >'
-alias sxa:='"$ROOT" xargs cat >>' \ No newline at end of file
+alias sxa:='"$ROOT" xargs cat >>'
diff --git a/plugins/sprunge/README.md b/plugins/sprunge/README.md
new file mode 100644
index 000000000..2a363d3bd
--- /dev/null
+++ b/plugins/sprunge/README.md
@@ -0,0 +1,31 @@
+# Sprunge plugin
+
+This plugin uploads data and fetch URL from the pastebin http://sprunge.us
+
+To enable it, add 'sprunge' to your plugins:
+```
+plugins=(... sprunge)
+```
+
+## Usage
+
+| Command | Description |
+|------------------------------|-------------------------------------------|
+| `sprunge filename.txt` | Uploads filename.txt |
+| `sprunge "this is a string"` | Uploads plain text |
+| `sprunge < filename.txt` | Redirects filename.txt content to sprunge |
+| `echo data \| sprunge` | Any piped data will be uploaded |
+
+Once sprunge has processed the input it will give you a unique HTTP address:
+```
+$ sprunge "hello"
+http://sprunge.us/XxjnKz
+```
+
+## Notes
+
+- Sprunge accepts piped data, stdin redirection, text strings as input or filenames.
+ Only one of these can be used at a time.
+- Argument precedence goes as follows: stdin > piped input > text strings.
+- If a filename is mispelled or doesn't have the necessary path description, it will NOT
+ generate an error, but instead treat it as a text string.
diff --git a/plugins/sprunge/sprunge.plugin.zsh b/plugins/sprunge/sprunge.plugin.zsh
index e1c89b729..5d5687a82 100644
--- a/plugins/sprunge/sprunge.plugin.zsh
+++ b/plugins/sprunge/sprunge.plugin.zsh
@@ -2,12 +2,9 @@
# Created by the blogger at the URL below...I don't know where to find his/her name
# Original found at https://www.shellperson.net/sprunge-pastebin-script/
-usage() {
-description | fmt -s >&2
-}
-
-description() {
-cat << HERE
+sprunge() {
+ if [[ "$1" = --help ]]; then
+ fmt -s >&2 << EOF
DESCRIPTION
Upload data and fetch URL from the pastebin http://sprunge.us
@@ -19,44 +16,41 @@ USAGE
piped_data | $0
NOTES
---------------------------------------------------------------------------
-* INPUT METHODS *
-$0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code.
-
-* PRECEDENCE *
-STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments.
-
- EXAMPLE:
- echo piped | "$0" arguments.txt < stdin_redirection.txt
-
-In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded.
-
-* FILENAMES *
-If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
---------------------------------------------------------------------------
-
-HERE
-exit
-}
-
-sprunge() {
- if [ -t 0 ]; then
- echo Running interactively, checking for arguments... >&2
- if [ "$*" ]; then
- echo Arguments present... >&2
- if [ -f "$*" ]; then
- echo Uploading the contents of "$*"... >&2
- cat "$*"
- else
- echo Uploading the text: \""$*"\"... >&2
- echo "$*"
- fi | curl -F 'sprunge=<-' http://sprunge.us
- else
- echo No arguments found, printing USAGE and exiting. >&2
- usage
- fi
- else
- echo Using input from a pipe or STDIN redirection... >&2
- curl -F 'sprunge=<-' http://sprunge.us
- fi
+ Input Methods:
+ $0 can accept piped data, STDIN redirection [< filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code.
+
+ Precedence:
+ STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as arguments. For example:
+
+ echo piped | $0 arguments.txt < stdin_redirection.txt
+
+ In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded.
+
+ Filenames:
+ If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
+
+EOF
+ return
+ fi
+
+ if [ -t 0 ]; then
+ echo Running interactively, checking for arguments... >&2
+ if [ "$*" ]; then
+ echo Arguments present... >&2
+ if [ -f "$*" ]; then
+ echo Uploading the contents of "$*"... >&2
+ cat "$*"
+ else
+ echo Uploading the text: \""$*"\"... >&2
+ echo "$*"
+ fi | curl -F 'sprunge=<-' http://sprunge.us
+ else
+ echo No arguments found, printing USAGE and exiting. >&2
+ sprunge --help
+ return 1
+ fi
+ else
+ echo Using input from a pipe or STDIN redirection... >&2
+ curl -F 'sprunge=<-' http://sprunge.us
+ fi
}
diff --git a/plugins/terminalapp/terminalapp.plugin.zsh b/plugins/terminalapp/terminalapp.plugin.zsh
deleted file mode 100644
index 7c0c278b9..000000000
--- a/plugins/terminalapp/terminalapp.plugin.zsh
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is intentionally empty.
-#
-# The terminalapp plugin is deprecated and may be removed in a future release.
-# Its functionality has been folded in to the core lib/termsupport.zsh, which
-# is loaded for all users. You can remove terminalapp from your $plugins list
-# once all your systems are updated to the current version of Oh My Zsh.
diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md
index 439a9355f..e6daae44f 100644
--- a/plugins/yarn/README.md
+++ b/plugins/yarn/README.md
@@ -35,8 +35,10 @@ plugins=(... yarn)
| ys | `yarn serve` | Start the dev server |
| yst | `yarn start` | Run the start script defined in `package.json` |
| yt | `yarn test` | Run the test script defined in `package.json` |
+| ytc | `yarn test --coverage` | Run the test script defined in `package.json` with coverage |
| yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache |
| yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade |
| yup | `yarn upgrade` | Upgrade packages to their latest version |
+| yv | `yarn version` | Update the version of your package |
| yw | `yarn workspace` | Run a command within a single workspace. |
| yws | `yarn workspaces` | Run a command within all defined workspaces. |
diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn
index 382f58a0a..3689ae960 100644
--- a/plugins/yarn/_yarn
+++ b/plugins/yarn/_yarn
@@ -71,7 +71,7 @@ _global_commands=(
'bin:Displays the location of the yarn bin folder'
'remove:Remove installed package from dependencies updating package.json'
'upgrade:Upgrades packages to their latest version based on the specified range'
- 'upgrade-interactive'
+ 'upgrade-interactive:Interactively upgrade packages'
)
_yarn_commands_scripts() {
@@ -81,9 +81,21 @@ _yarn_commands_scripts() {
}
_yarn_scripts() {
- local -a scripts
- scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g'))
- _describe 'script' scripts
+ local -a commands binaries scripts
+ local -a scriptNames scriptCommands
+ local i runJSON
+
+ runJSON=$(yarn run --json 2>/dev/null)
+ binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON"))
+ scriptNames=($(sed -E '/possibleCommands/!d;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON"))
+ scriptCommands=("${(@f)$(sed -E '/possibleCommands/!d;s/.*"hints":\{([^}]+)\}.*/\1/;s/"[^"]+"://g;s/:/\\:/g;s/","/\n/g;s/(^"|"$)//g' <<< "$runJSON")}")
+
+ for (( i=1; i <= $#scriptNames; i++ )); do
+ scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}")
+ done
+
+ commands=($scripts $binaries)
+ _describe 'command' commands
}
_yarn_global_commands() {
@@ -240,7 +252,8 @@ _yarn() {
run)
_arguments \
- '1: :_yarn_scripts'
+ '1: :_yarn_scripts' \
+ '*:: :_default'
;;
tag)
@@ -255,6 +268,11 @@ _yarn() {
'*:: :->team_args'
;;
+ upgrade-interactive)
+ _arguments \
+ '--latest:use the version tagged latest in the registry:'
+ ;;
+
version)
_arguments \
'--new-version:version:' \
@@ -266,6 +284,10 @@ _yarn() {
_arguments \
'1:query:_files'
;;
+
+ *)
+ _default
+ ;;
esac
;;
esac
diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh
index 6dc4786de..18c5dcc89 100644
--- a/plugins/yarn/yarn.plugin.zsh
+++ b/plugins/yarn/yarn.plugin.zsh
@@ -20,8 +20,10 @@ alias yrun="yarn run"
alias ys="yarn serve"
alias yst="yarn start"
alias yt="yarn test"
+alias ytc="yarn test --coverage"
alias yuc="yarn global upgrade && yarn cache clean"
alias yui="yarn upgrade-interactive"
alias yup="yarn upgrade"
+alias yv="yarn version"
alias yw="yarn workspace"
alias yws="yarn workspaces"