Unverified Commit cad48e38 authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into fabric_task_description

parents 225425fe 40df67bc
# mvn-color based on https://gist.github.com/1027800
BOLD=`tput bold`
UNDERLINE_ON=`tput smul`
UNDERLINE_OFF=`tput rmul`
TEXT_BLACK=`tput setaf 0`
TEXT_RED=`tput setaf 1`
TEXT_GREEN=`tput setaf 2`
TEXT_YELLOW=`tput setaf 3`
TEXT_BLUE=`tput setaf 4`
TEXT_MAGENTA=`tput setaf 5`
TEXT_CYAN=`tput setaf 6`
TEXT_WHITE=`tput setaf 7`
BACKGROUND_BLACK=`tput setab 0`
BACKGROUND_RED=`tput setab 1`
BACKGROUND_GREEN=`tput setab 2`
BACKGROUND_YELLOW=`tput setab 3`
BACKGROUND_BLUE=`tput setab 4`
BACKGROUND_MAGENTA=`tput setab 5`
BACKGROUND_CYAN=`tput setab 6`
BACKGROUND_WHITE=`tput setab 7`
RESET_FORMATTING=`tput sgr0`
# Wrapper function for Maven's mvn command.
mvn-color()
{
# Calls ./mvnw if found, otherwise execute the original mvn
mvn-or-mvnw() {
if [ -x ./mvnw ]; then
echo "executing mvnw instead of mvn"
./mvnw "$@"
else
command mvn "$@"
fi
}
# Wrapper function for Maven's mvn command. Based on https://gist.github.com/1027800
mvn-color() {
local BOLD=$(echoti bold)
local TEXT_RED=$(echoti setaf 1)
local TEXT_GREEN=$(echoti setaf 2)
local TEXT_YELLOW=$(echoti setaf 3)
local TEXT_BLUE=$(echoti setaf 4)
local TEXT_WHITE=$(echoti setaf 7)
local RESET_FORMATTING=$(echoti sgr0)
(
# Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations
unset LANG
LC_CTYPE=C mvn $@ | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \
LC_CTYPE=C mvn "$@" | sed \
-e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \
-e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_WHITE}${BOLD}\1${RESET_FORMATTING}\2/g" \
-e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
-e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \
-e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \
-e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g"
# Make sure formatting is reset
echo -ne ${RESET_FORMATTING}
echo -ne "${RESET_FORMATTING}"
)
}
# Override the mvn command with the colorized one.
#alias mvn="mvn-color"
# either use orignal mvn or the mvn wrapper
alias mvn="mvn-or-mvnw"
# Run mvn against the pom found in a project's root directory (assumes a git repo)
alias 'mvn!'='mvn -f $(git rev-parse --show-toplevel 2>/dev/null || echo ".")/pom.xml'
# aliases
alias mvncie='mvn clean install eclipse:eclipse'
alias mvnag='mvn archetype:generate'
alias mvnboot='mvn spring-boot:run'
alias mvnc='mvn clean'
alias mvncd='mvn clean deploy'
alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
alias mvnci='mvn clean install'
alias mvncie='mvn clean install eclipse:eclipse'
alias mvncini='mvn clean initialize'
alias mvncist='mvn clean install -DskipTests'
alias mvncisto='mvn clean install -DskipTests --offline'
alias mvne='mvn eclipse:eclipse'
alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
alias mvnd='mvn deploy'
alias mvnp='mvn package'
alias mvnc='mvn clean'
alias mvncom='mvn compile'
alias mvncp='mvn clean package'
alias mvnct='mvn clean test'
alias mvnt='mvn test'
alias mvnag='mvn archetype:generate'
alias mvn-updates='mvn versions:display-dependency-updates'
alias mvntc7='mvn tomcat7:run'
alias mvntc='mvn tomcat:run'
alias mvnjetty='mvn jetty:run'
alias mvncv='mvn clean verify'
alias mvncvst='mvn clean verify -DskipTests'
alias mvnd='mvn deploy'
alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc'
alias mvndt='mvn dependency:tree'
alias mvne='mvn eclipse:eclipse'
alias mvnjetty='mvn jetty:run'
alias mvnp='mvn package'
alias mvns='mvn site'
alias mvnsrc='mvn dependency:sources'
alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc'
alias mvnt='mvn test'
alias mvntc='mvn tomcat:run'
alias mvntc7='mvn tomcat7:run'
alias mvn-updates='mvn versions:display-dependency-updates'
function listMavenCompletions {
local file new_file
local -a profiles POM_FILES
# Root POM
POM_FILES=(~/.m2/settings.xml)
# POM in the current directory
if [[ -f pom.xml ]]; then
local file=pom.xml
POM_FILES+=("${file:A}")
fi
# Look for POM files in parent directories
while [[ -n "$file" ]] && grep -q "<parent>" "$file"; do
# look for a new relativePath for parent pom.xml
new_file=$(grep -e "<relativePath>.*</relativePath>" "$file" | sed -e 's/.*<relativePath>\(.*\)<\/relativePath>.*/\1/')
# if <parent> is present but not defined, assume ../pom.xml
if [[ -z "$new_file" ]]; then
new_file="../pom.xml"
fi
# if file doesn't exist break
file="${file:h}/${new_file}"
if ! [[ -e "$file" ]]; then
break
fi
POM_FILES+=("${file:A}")
done
# Get profiles from found files
for file in $POM_FILES; do
[[ -e $file ]] || continue
profiles+=($(sed 's/<!--.*-->//' "$file" | sed '/<!--/,/-->/d' | grep -e "<profile>" -A 1 | grep -e "<id>.*</id>" | sed 's?.*<id>\(.*\)<\/id>.*?-P\1?'))
done
reply=(
# common lifecycle
clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site
clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site
# integration testing
pre-integration-test integration-test
# common plugins
deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt
......@@ -77,18 +122,18 @@ function listMavenCompletions {
# failsafe
failsafe:integration-test failsafe:verify
# install
install:install-file
install:install-file install:help
# site
site:site site:deploy site:run site:stage site:stage-deploy
site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site
# surefire
surefire:test
# checkstyle
checkstyle:checkstyle checkstyle:check
checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate
# javadoc
javadoc:javadoc javadoc:jar javadoc:aggregate
javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle
# jxr
jxr:jxr
jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate
# pmd
pmd:pmd pmd:cpd pmd:check pmd:cpd-check
......@@ -101,19 +146,21 @@ function listMavenCompletions {
# assembly
assembly:single assembly:assembly
# dependency
dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:get dependency:go-offline dependency:list dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies
dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies
# enforcer
enforcer:enforce
enforcer:enforce enforcer:display-info
# gpg
gpg:sign gpg:sign-and-deploy-file
# help
help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system
# release
release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions
release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions
# jgitflow
jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number
# repository
repository:bundle-create repository:bundle-pack
# source
source:aggregate source:jar source:jar-no-fork
source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork
# eclipse
eclipse:clean eclipse:eclipse
......@@ -141,7 +188,7 @@ function listMavenCompletions {
# versions
versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert
# scm
scm:add scm:checkin scm:checkout scm:update scm:status
scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate
# buildnumber
buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset
......@@ -170,19 +217,109 @@ function listMavenCompletions {
flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate
# gwt
gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
# asciidoctor
asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip
# compiler
compiler:compile compiler:testCompile
# resources
resources:resources resources:testResources resources:copy-resources
# verifier
verifier:verify
# jar
jar:jar jar:test-jar
# rar
rar:rar
# acr
acr:acr
# shade
shade:shade
# changelog
changelog:changelog changelog:dev-activity changelog:file-activity
# changes
changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report
# doap
doap:generate
# docck
docck:check
# jdeps
jdeps:jdkinternals jdeps:test-jdkinternals
# linkcheck
linkcheck:linkcheck
# project-info-reports
project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary
# surefire-report
surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only
# invoker
invoker:install invoker:integration-test invoker:verify invoker:run
# jarsigner
jarsigner:sign jarsigner:verify
# patch
patch:apply
# pdf
pdf:pdf
# plugin
plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo
# remote-resources
remote-resources:bundle remote-resources:process
# scm-publish
scm-publish:help scm-publish:publish-scm scm-publish:scmpublish
# stage
stage:copy
# toolchain
toolchain:toolchain
# 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=
"-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="
# arguments
-am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X
-am --also-make
-amd --also-make-dependents-am
-B --batch-mode
-b --builder
-C --strict-checksums
-c --lax-checksums
-cpu --check-plugin-updates
-D --define
-e --errors
-emp --encrypt-master-password
-ep --encrypt-password
-f --file
-fae --fail-at-end
-ff --fail-fast
-fn --fail-never
-gs --global-settings
-gt --global-toolchains
-h --help
-l --log-file
-llr --legacy-local-repository
-N --non-recursive
-npr --no-plugin-registry
-npu --no-plugin-updates
-nsu --no-snapshot-updates
-o --offline
-P --activate-profiles
-pl --projects
-q --quiet
-rf --resume-from
-s --settings
-t --toolchains
-T --threads
-U --update-snapshots
-up --update-plugins
-v --version
-V --show-version
-X --debug
cli:execute cli:execute-phase
archetype:generate generate-sources
cobertura:cobertura
-Dtest= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
-Dit.test= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi`
);
-Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi)
-Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi)
$profiles
)
}
compctl -K listMavenCompletions mvn
compctl -K listMavenCompletions mvn mvnw
compctl -K listMavenCompletions mvn-color
compctl -K listMavenCompletions mvn-or-mvnw
# MySQL-Macports plugin
This plugin adds aliases for some of the commonly used [MySQL](https://www.mysql.com/) commands when installed using [MacPorts](https://www.macports.org/) on macOS.
To use it, add `mysql-macports` to the plugins array in your zshrc file:
```zsh
plugins=(... mysql-macports)
```
For instructions on how to install MySQL using MacPorts, read the [MacPorts wiki](https://trac.macports.org/wiki/howto/MySQL/).
## Aliases
| Alias | Command | Description |
| ------------ | --------------------------------------------------------- | ------------------------------------------ |
| mysqlstart | `sudo /opt/local/share/mysql5/mysql/mysql.server start` | Start the MySQL server. |
| mysqlstop | `sudo /opt/local/share/mysql5/mysql/mysql.server stop` | Stop the MySQL server. |
| mysqlrestart | `sudo /opt/local/share/mysql5/mysql/mysql.server restart` | Restart the MySQL server. |
| mysqlstatus | `mysqladmin5 -u root -p ping` | Check whether the MySQL server is running. |
# n98-magerun plugin
The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time.
The [n98-magerun plugin](https://github.com/netz98/n98-magerun) provides many
[useful aliases](#aliases) as well as completion for the `n98-magerun` command.
Enable it by adding `n98-magerun` to the plugins array in your zshrc file:
```zsh
plugins=(... n98-magerun)
```
## Aliases
| Alias | Command | Description |
| --------- | -------------------------------------------------- | --------------------------------------------------------------------------------- |
| n98 | `n98-magerun.phar` | The N98-Magerun phar-file (Version 1) |
| n98-2 | `n98-magerun2.phar` | The N98-Magerun phar-file (Version 2) |
| mage-get | `wget https://files.magerun.net/n98-magerun.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 1) |
| mage2-get | `wget https://files.magerun.net/n98-magerun2.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 2) |
......@@ -2,7 +2,8 @@
# FILE: n98-magerun.plugin.zsh
# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
# AUTHOR: Andrew Dwyer (andrewrdwyer at gmail dot com)
# VERSION: 1.0.0
# AUTHOR: Jisse Reitsma (jisse at yireo dot com)
# VERSION: 1.1.0
# ------------------------------------------------------------------------------
# n98-magerun basic command completion
......@@ -24,11 +25,18 @@ _n98_magerun () {
compdef _n98_magerun n98-magerun.phar
compdef _n98_magerun n98-magerun
compdef _n98_magerun n98-magerun2.phar
compdef _n98_magerun n98-magerun2
# Aliases
alias n98='n98-magerun.phar'
alias mage='n98-magerun.phar'
alias magefl='n98-magerun.phar cache:flush'
alias magerun='n98-magerun.phar'
alias n98-2='n98-magerun2.phar'
alias mage2='n98-magerun2.phar'
alias magerun2='n98-magerun2.phar'
# Install n98-magerun into the current directory
alias mage-get='wget https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar'
alias mage-get='wget https://files.magerun.net/n98-magerun.phar'
alias mage2-get='wget https://files.magerun.net/n98-magerun2.phar'
# Nanoc plugin
This plugin adds some aliases and autocompletion for common [Nanoc](https://nanoc.ws) commands.
To use it, add `nanoc` to the plugins array in your zshrc file:
```zsh
plugins=(... nanoc)
```
## Aliases
| Alias | Command | Description |
|-------|-----------------------|-----------------------------------------------------------------------------------|
| n | `nanoc` | Main Nanoc command |
| nco | `nanoc compile` | Compile all items of the current site |
| ncs | `nanoc create-site` | Create a new site at the given path. The site will use the filesystem data source |
| nd | `nanoc deploy` | Deploy the compiled site to the destination (specified with `--target`) |
| np | `nanoc prune` | Remove files not managed by Nanoc from the output directory |
| nv | `nanoc view` | Start the static web server (on port 3000 and all IP addresses, unless specified) |
#compdef nanoc
#autoload
# nanoc zsh completion - based on the homebrew zsh completion
# requires the 'nanoc' gem to be installed
local -a _1st_arguments
_1st_arguments=(
'autocompile:start the autocompiler'
'check:run issue checks'
'compile:compile items of this site'
'create-item:create an item'
'create-layout:create a layout'
'create-site:create a site'
'deploy:deploy the compiled site'
'help:show help'
'prune:remove files not managed by nanoc from the output directory'
'shell:open a shell on the Nanoc environment'
'show-data:show data in this site'
'show-plugins:show all available plugins'
'show-rules:describe the rules for each item'
'update:update the data stored by the data source to a newer version'
'validate-css:validate the site’s CSS'
'validate-html:validate the site’s HTML'
'validate-links:validate links in site'
'view:start the web server that serves static files'
'watch:start the watcher'
)
local expl
......@@ -31,13 +24,68 @@ local -a pkgs installed_pkgs
_arguments \
'(--color)--color[enable color]' \
'(--debug)--debug[enable debugging]' \
'(--env)--env[set environment]' \
'(--help)--help[show the help message and quit]' \
'(--no-color)--no-color[disable color]' \
'(--verbose)--verbose[make nanoc output more detailed]' \
'(--verbose)--verbose[make output more detailed]' \
'(--version)--version[show version information and quit]' \
'(--warn)--warn[enable warnings]' \
'*:: :->subcmds' && return 0
case "$state" in
subcmds)
case $words[1] in
check)
_arguments \
'(--preprocess)--preprocess[run preprocessor]'
;;
compile)
_arguments \
'(--diff)--diff[generate diff]'
;;
compile)
_arguments \
'(--diff)--diff[generate diff]'
;;
create-site)
_arguments \
'(--force)--force[force creation of new site]'
;;
deploy)
_arguments \
'(--target)--target[specify the location to deploy to (default: `default`)]' \
'(--no-check)--no-check[do not run the issue checks marked for deployment]' \
'(--list)--list[list available locations to deploy to]' \
'(--list-deployers)--list-deployers[list available deployers]' \
'(--dry-run)--dry-run[show what would be deployed]'
;;
prune)
_arguments \
'(--yes)--yes[confirm deletion]' \
'(--dry-run)--dry-run[print files to be deleted instead of actually deleting them]'
;;
shell)
_arguments \
'(--preprocess)--preprocess[run preprocessor]'
;;
view)
_arguments \
'(--handler)--handler[specify the handler to use (webrick/mongrel/...)]' \
'(--host)--host[specify the host to listen on (default: 127.0.0.1)]' \
'(--port)--port[specify the port to listen on (default: 3000]' \
'(--live-reload)--live-reload[reload on changes]'
;;
esac
;;
esac
if (( CURRENT == 1 )); then
_describe -t commands "nanoc subcommand" _1st_arguments
return
......
alias n='nanoc'
alias na='nanoc autocompile'
alias nco='nanoc compile'
alias nci='nanoc create_item'
alias ncl='nanoc create_layout'
alias ncs='nanoc create_site'
alias ncs='nanoc create-site'
alias nd='nanoc deploy'
alias np='nanoc prune'
alias nv='nanoc view'
alias nw='nanoc watch'
ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test v version -h --help'
ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test update v version -h --help'
_ng_completion () {
local words cword opts
......@@ -56,6 +55,10 @@ _ng_completion () {
opts='--browsers --colors --config-file --environment --filter --host --launch --log-level --module --path --port --query --reporter --server --silent --test-page --test-port --watch -H -c -cf -e -f -m -r -s -tp -w'
;;
update )
opts='--all --dryRun --force --from --migrate-only --next --registry --to -d'
;;
v | version )
opts='--verbose'
;;
......@@ -69,9 +72,7 @@ _ng_completion () {
;;
esac
setopt shwordsplit
reply=($opts)
unset shwordsplit
reply=(${=opts})
}
compctl -K _ng_completion ng
......@@ -13,20 +13,20 @@
# -O - enable OS detection
# -sA - TCP ACK scan
# -F - fast scan
# --script=vulscan - also access vulnerabilities in target
# --script=vuln - also access vulnerabilities in target
alias nmap_open_ports="nmap --open"
alias nmap_list_interfaces="nmap --iflist"
alias nmap_slow="nmap -sS -v -T1"
alias nmap_fin="nmap -sF -v"
alias nmap_full="nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v"
alias nmap_check_for_firewall="nmap -sA -p1-65535 -v -T4"
alias nmap_slow="sudo nmap -sS -v -T1"
alias nmap_fin="sudo nmap -sF -v"
alias nmap_full="sudo nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v"
alias nmap_check_for_firewall="sudo nmap -sA -p1-65535 -v -T4"
alias nmap_ping_through_firewall="nmap -PS -PA"
alias nmap_fast="nmap -F -T5 --version-light --top-ports 300"
alias nmap_detect_versions="nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn"
alias nmap_check_for_vulns="nmap --script=vulscan"
alias nmap_full_udp="nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 "
alias nmap_traceroute="nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
alias nmap_detect_versions="sudo nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn"
alias nmap_check_for_vulns="nmap --script=vuln"
alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 "
alias nmap_traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
# node plugin
To use it, add `node` to the plugins array of your zshrc file:
```zsh
plugins=(... node)
```
This plugin adds `node-docs` function that open specific section in [Node.js](https://nodejs.org) documentation (depending on the installed version).
For example:
```zsh
# Opens https://nodejs.org/docs/latest-v10.x/api/fs.html
$ node-docs fs
# Opens https://nodejs.org/docs/latest-v10.x/api/path.html
$ node-docs path
```
# Open the node api for your current version to the optional section.
# TODO: Make the section part easier to use.
function node-docs {
open_command "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1"
local section=${1:-all}
open_command "https://nodejs.org/docs/$(node --version)/api/$section.html"
}
# Nomad
The `nomad` plugin provides a simple autocompletion for [Nomad](https://nomadproject.io/), a tool from Hashicorp for easily deploy applications at any scale.
## Usage
1. Enable the `nomad` plugin:
```zsh
plugins=(... nomad)
```
2. Install [Nomad](https://nomadproject.io/)
3. Type `nomad` into your prompt and hit `TAB` to see available completion options.
#compdef nomad
local -a _nomad_cmds
_nomad_cmds=(
'agent:Runs a Nomad agent'
'agent-info:Display status information about the local agent'
'alloc-status:Display allocation status information and metadata'
'client-config:View or modify client configuration details'
'eval-status:Display evaluation status and placement failure reasons'
'fs:Inspect the contents of an allocation directory'
'init:Create an example job file'
'inspect:Inspect a submitted job'
'logs:Streams the logs of a task.'
'node-drain:Toggle drain mode on a given node'
'node-status:Display status information about nodes'
'plan:Dry-run a job update to determine its effects'
'run:Run a new job or update an existing'
'server-force-leave:Force a server into the left state'
'server-join:Join server nodes together'
'server-members:Display a list of known servers and their'
'status:Display status information about jobs'
'stop:Stop a running job'
'validate:Checks if a given job specification is valid'
'version:Prints the Nomad version'
)
__allocstatus() {
_arguments \
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-short[Display short output. Shows only the most recent task event.]' \
'-stats[Display detailed resource usage statistics.]' \
'-verbose[Show full information.]' \
'-json[Output the allocation in its JSON format.]' \
'-t[Format and display allocation using a Go template.]'
}
__evalstatus() {
_arguments \
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-monitor[Monitor an outstanding evaluation.]' \
'-verbose[Show full information.]' \
'-json[Output the allocation in its JSON format.]' \
'-t[Format and display allocation using a Go template.]'
}
__inspect() {
_arguments \
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-json[Output the allocation in its JSON format.]' \
'-t[Format and display allocation using a Go template.]'
}
__logs() {
_arguments \
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-stderr[ Display stderr logs.]' \
'-job[<job-id> Use a random allocation from the specified job ID.]' \
'-verbose[Show full information.]' \
'-f[Causes the output to not stop when the end of the logs are reached, but rather to wait for additional output.]' \
'-tail[Show the logs contents with offsets relative to the end of the logs. If no offset is given, -n is defaulted to 10.]' \
'-n[Sets the tail location in best-efforted number of lines relative to the end of the logs.]' \
'-c[Sets the tail location in number of bytes relative to the end of the logs.]'
}
__nodestatus() {
_arguments \
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-self[Query the status of the local node.]' \
'-allocs[ Display a count of running allocations for each node.]' \
'-short[Display short output. Shows only the most recent task event.]' \
'-stats[Display detailed resource usage statistics.]' \
'-verbose[Show full information.]' \
'-json[Output the allocation in its JSON format.]' \
'-t[Format and display allocation using a Go template.]'
}
__plan() {
_arguments \
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]'
}
__run() {
_arguments \
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-check-index[If set, the job is only registered or updated if the the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with plan command.]' \
'-detach[Return immediately instead of entering monitor mode. After job submission, the evaluation ID will be printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \
'-output[Output the JSON that would be submitted to the HTTP API without submitting the job.]' \
'-verbose[Show full information.]'
}
__status() {
_arguments \
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-short[Display short output. Shows only the most recent task event.]' \
'-evals[Display the evaluations associated with the job.]' \
'-verbose[Show full information.]'
}
__stop() {
_arguments \
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-detach[Return immediately instead of entering monitor mode. After the deregister command is submitted, a new evaluation ID is printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \
'-yes[Automatic yes to prompts.]' \
'-verbose[Show full information.]'
}
_arguments '*:: :->command'
if (( CURRENT == 1 )); then
_describe -t commands "nomad command" _nomad_cmds
return
fi
local -a _command_args
case "$words[1]" in
alloc-status)
__allocstatus ;;
eval-status)
__evalstatus ;;
inspect)
__inspect ;;
logs)
__logs ;;
node-status)
__nodestatus ;;
plan)
__plan ;;
run)
__run ;;
status)
__status ;;
stop)
__stop ;;
esac
## npm plugin
The npm plugin provides completion as well as adding many useful aliases.
To use it, add npm to the plugins array of your zshrc file:
```
plugins=(... npm)
```
## Aliases
| Alias | Command | Descripton |
|:------ |:-----------------------------|:----------------------------------------------------------------|
| `npmg` | `npm i -g` | Install dependencies globally |
| `npmS` | `npm i -S` | Install and save to dependencies in your package.json |
| `npmD` | `npm i -D` | Install and save to dev-dependencies in your package.json |
| `npmE` | `PATH="$(npm bin)":"$PATH"` | Run command from node_modules folder based on current directory |
| `npmO` | `npm outdated` | Check which npm modules are outdated |
| `npmV` | `npm -v` | Check package versions |
| `npmL` | `npm list` | List installed packages |
| `npmL0` | `npm ls --depth=0` | List top-level installed packages |
| `npmst` | `npm start` | Run npm start |
| `npmt` | `npm test` | Run npm test |
| `npmR` | `npm run` | Run npm scripts |
| `npmP` | `npm publish` | Run npm publish |
| `npmI` | `npm init` | Run npm init |
(( $+commands[npm] )) && {
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion"
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
......@@ -38,9 +38,20 @@ alias npmV="npm -v"
# List packages
alias npmL="npm list"
# List top-level installed packages
alias npmL0="npm ls --depth=0"
# Run npm start
alias npmst="npm start"
# Run npm test
alias npmt="npm test"
# Run npm scripts
alias npmR="npm run"
# Run npm publish
alias npmP="npm publish"
# Run npm init
alias npmI="npm init"
# NPX Plugin
> npx(1) -- execute npm package binaries. ([more info](https://github.com/zkat/npx))
This plugin automatically registers npx command-not-found handler if `npx` exists in your `$PATH`.
## Setup
- Add plugin to `~/.zshrc`
```bash
plugins=(.... npx)
```
- Globally install npx binary (npx will be auto installed with recent versions of Node.js)
```bash
sudo npm install -g npx
```
## Note
The shell auto-fallback doesn't auto-install plain packages. In order to get it to install something, you need to add `@`:
```
➜ jasmine@latest # or just `jasmine@`
npx: installed 13 in 1.896s
Randomized with seed 54385
Started
```
It does it this way so folks using the fallback don't accidentally try to install regular typoes.
# NPX Plugin
# https://www.npmjs.com/package/npx
# Maintainer: Pooya Parsa <pooya@pi0.ir>
(( $+commands[npx] )) && {
source <(npx --shell-auto-fallback zsh)
}
# nvm plugin
This plugin adds autocompletions for [nvm](https://github.com/creationix/nvm) — a Node.js version manager.
It also automatically sources nvm, so you don't need to do it manually in your `.zshrc`.
To use it, add `nvm` to the plugins array of your zshrc file:
```zsh
plugins=(... nvm)
```
......@@ -6,16 +6,23 @@
local -a _1st_arguments
_1st_arguments=(
'help:show help'
'install:download and install a version'
'--version:print out the latest released version of nvm'
'install:download and install a version in <node|iojs|node version number>'
'uninstall:uninstall a version'
'use:modify PATH to use version'
'run:run version with given arguments'
'use:modify PATH to use <version>. Uses .nvmrc if available'
'exec:run <command> on <version>. Uses .nvmrc if available'
'run:run `node` on <version> with <args> as arguments. Uses .nvmrc if available'
'current:list installed versions'
'ls:list installed versions or versions matching a given description'
'version:resolve the given description to a single local version'
'version-remote:resolve the given description to a single remote version'
'ls-remote:list remote versions available for install'
'deactivate:undo effects of NVM on current shell'
'deactivate:undo effects of `nvm` on current shell'
'alias:show or set aliases'
'unalias:deletes an alias'
'copy-packages:install global NPM packages to current version'
'reinstall-packages:reinstall global `npm` packages contained in <version> to current version'
'unload:unload `nvm` from shell'
'which:display path to installed node version. Uses .nvmrc if available'
)
_arguments -C '*:: :->subcmds' && return 0
......
# Set NVM_DIR if it isn't already defined
[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm"
# Load nvm if it exists
[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
# Try to load nvm only if command not already available
if ! type "nvm" &> /dev/null; then
# Load nvm if it exists
[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment