Commit 7576f856 authored by Ramses Ladlani's avatar Ramses Ladlani
Browse files

Merge remote-tracking branch 'robyrussel/master' into fix-atom_plugin_for_cygwin

Discarded all previous changes to atom plugin for easier review in next commit.
parents 6e0fcf80 918d26e7
#!/usr/bin/env zsh
# vim:ft=zsh ts=2 sw=2 sts=2
# Note: The heavy_black_heart emoji requires $emoji2[emoji_style]
# to be rendered as the emoji red heart.
_emotty_sets[love]="
green_heart
blue_heart
purple_heart
yellow_heart
heavy_black_heart
broken_heart
heart_with_arrow
heart_with_ribbon
sparkling_heart
two_hearts
revolving_hearts
growing_heart
beating_heart
heart_decoration
couple_with_heart
kiss
man_and_woman_holding_hands
two_women_holding_hands
two_men_holding_hands
kiss_mark
smiling_face_with_heart_shaped_eyes
kissing_face
face_throwing_a_kiss
kissing_face_with_smiling_eyes
kissing_face_with_closed_eyes
smiling_cat_face_with_heart_shaped_eyes
kissing_cat_face_with_closed_eyes
"
#!/usr/bin/env zsh
# vim:ft=zsh ts=2 sw=2 sts=2
_emotty_sets[nature]="
mouse_face
hamster_face
rabbit_face
dog_face
cat_face
tiger_face
bear_face
monkey_face
koala
panda_face
chicken
baby_chick
bird
penguin
cow_face
pig_face
frog_face
boar
wolf_face
horse_face
snail
bug
ant
honeybee
lady_beetle
spouting_whale
dolphin
octopus
fish
tropical_fish
snake
turtle
lemon
tangerine
peach
mushroom
tomato
strawberry
red_apple
cherries
grapes
aubergine
watermelon
banana
pineapple
melon
pear
green_apple
ear_of_maize
sunflower
seedling
herb
four_leaf_clover
"
#!/usr/bin/env zsh
# vim:ft=zsh ts=2 sw=2 sts=2
# NOTE: The following emoji show as $'character' in the title
# white_medium_star
# sparkles
# dizzy_symbol
_emotty_sets[stellar]="
full_moon_symbol
waning_gibbous_moon_symbol
waning_crescent_moon_symbol
last_quarter_moon_symbol
new_moon_symbol
new_moon_with_face
waxing_crescent_moon_symbol
first_quarter_moon_symbol
waxing_gibbous_moon_symbol
full_moon_with_face
sun_with_face
glowing_star
crescent_moon
first_quarter_moon_with_face
last_quarter_moon_with_face
"
#!/usr/bin/env zsh
# vim:ft=zsh ts=2 sw=2 sts=2
_emotty_sets[zodiac]="
aries
taurus
gemini
cancer
leo
virgo
libra
scorpius
sagittarius
capricorn
aquarius
pisces
rat
ox
tiger
rabbit
dragon
snake
horse
goat
monkey
rooster
dog
pig
"
# Use Ctrl-Z to switch back to Vim
I frequently need to execute random command in my shell. To achieve it I pause
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
The fg part really hurt sme. I just wanted to hit Ctrl-z once again to get back
to Vim. I could not find a solution, so I developed one on my own that
works wonderfully with ZSH
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
Credits:
- original idea by @sheerun
- added to OMZ by @mbologna
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
zle accept-line
else
zle push-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
...@@ -3,19 +3,20 @@ ...@@ -3,19 +3,20 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for git-extras (http://github.com/visionmedia/git-extras). # Completion script for git-extras (http://github.com/tj/git-extras).
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
# ------- # -------
# #
# * Alexis GRIMALDI (https://github.com/agrimaldi) # * Alexis GRIMALDI (https://github.com/agrimaldi)
# * spacewander (https://github.com/spacewander)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Inspirations # Inspirations
# ----------- # -----------
# #
# * git-extras (http://github.com/visionmedia/git-extras) # * git-extras (http://github.com/tj/git-extras)
# * git-flow-completion (http://github.com/bobthecow/git-flow-completion) # * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
...@@ -30,10 +31,21 @@ __git_command_successful () { ...@@ -30,10 +31,21 @@ __git_command_successful () {
} }
__git_commits() {
declare -A commits
git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit
do
hash=$(echo $commit | cut -d':' -f1)
commits[$hash]="$commit"
done
local ret=1
_describe -t commits commit commits && ret=0
}
__git_tag_names() { __git_tag_names() {
local expl local expl
declare -a tag_names declare -a tag_names
tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
__git_command_successful || return __git_command_successful || return
_wanted tag-names expl tag-name compadd $* - $tag_names _wanted tag-names expl tag-name compadd $* - $tag_names
} }
...@@ -47,31 +59,27 @@ __git_branch_names() { ...@@ -47,31 +59,27 @@ __git_branch_names() {
_wanted branch-names expl branch-name compadd $* - $branch_names _wanted branch-names expl branch-name compadd $* - $branch_names
} }
__git_specific_branch_names() {
__git_feature_branch_names() {
local expl local expl
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/}) branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
__git_command_successful || return __git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names _wanted branch-names expl branch-name compadd $* - $branch_names
} }
__git_feature_branch_names() {
__git_specific_branch_names 'feature'
}
__git_refactor_branch_names() { __git_refactor_branch_names() {
local expl __git_specific_branch_names 'refactor'
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
} }
__git_bug_branch_names() { __git_bug_branch_names() {
local expl __git_specific_branch_names 'bug'
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
} }
...@@ -92,19 +100,43 @@ __git_author_names() { ...@@ -92,19 +100,43 @@ __git_author_names() {
_wanted author-names expl author-name compadd $* - $author_names _wanted author-names expl author-name compadd $* - $author_names
} }
# subcommands
_git-changelog() { _git-bug() {
_arguments \ local curcontext=$curcontext state line ret=1
'(-l --list)'{-l,--list}'[list commits]' \ declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'finish:merge bug into the current branch'
)
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(finish)
_arguments -C \
':branch-name:__git_bug_branch_names'
;;
esac
esac
} }
_git-effort() { _git-changelog() {
_arguments \ _arguments \
'--above[ignore file with less than x commits]' \ '(-l --list)'{-l,--list}'[list commits]' \
} }
_git-contrib() { _git-contrib() {
_arguments \ _arguments \
':author:__git_author_names' ':author:__git_author_names'
...@@ -135,6 +167,11 @@ _git-delete-tag() { ...@@ -135,6 +167,11 @@ _git-delete-tag() {
} }
_git-effort() {
_arguments \
'--above[ignore file with less than x commits]'
}
_git-extras() { _git-extras() {
local curcontext=$curcontext state line ret=1 local curcontext=$curcontext state line ret=1
declare -A opt_args declare -A opt_args
...@@ -154,20 +191,7 @@ _git-extras() { ...@@ -154,20 +191,7 @@ _git-extras() {
esac esac
_arguments \ _arguments \
'(-v --version)'{-v,--version}'[show current version]' \ '(-v --version)'{-v,--version}'[show current version]'
}
_git-graft() {
_arguments \
':src-branch-name:__git_branch_names' \
':dest-branch-name:__git_branch_names'
}
_git-squash() {
_arguments \
':branch-name:__git_branch_names'
} }
...@@ -199,6 +223,25 @@ _git-feature() { ...@@ -199,6 +223,25 @@ _git-feature() {
} }
_git-graft() {
_arguments \
':src-branch-name:__git_branch_names' \
':dest-branch-name:__git_branch_names'
}
_git-ignore() {
_arguments -C \
'(--local -l)'{--local,-l}'[show local gitignore]' \
'(--global -g)'{--global,-g}'[show global gitignore]'
}
_git-missing() {
_arguments \
':first-branch-name:__git_branch_names' \
':second-branch-name:__git_branch_names'
}
_git-refactor() { _git-refactor() {
local curcontext=$curcontext state line ret=1 local curcontext=$curcontext state line ret=1
declare -A opt_args declare -A opt_args
...@@ -227,59 +270,62 @@ _git-refactor() { ...@@ -227,59 +270,62 @@ _git-refactor() {
} }
_git-bug() { _git-squash() {
local curcontext=$curcontext state line ret=1 _arguments \
declare -A opt_args ':branch-name:__git_branch_names'
}
_arguments -C \ _git-summary() {
': :->command' \ _arguments '--line[summarize with lines other than commits]'
'*:: :->option-or-argument' && ret=0 __git_commits
}
case $state in
(command) _git-undo(){
declare -a commands
commands=(
'finish:merge bug into the current branch'
)
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(finish)
_arguments -C \ _arguments -C \
':branch-name:__git_bug_branch_names' '(--soft -s)'{--soft,-s}'[only rolls back the commit but changes remain un-staged]' \
;; '(--hard -h)'{--hard,-h}'[wipes your commit(s)]'
esac
esac
} }
zstyle ':completion:*:*:git:*' user-commands \ zstyle ':completion:*:*:git:*' user-commands \
alias:'define, search and show aliases' \
archive-file:'export the current HEAD of the git repository to a archive' \
back:'undo and stage latest commits' \
bug:'create a bug branch' \
changelog:'populate changelog file with commits since the previous tag' \ changelog:'populate changelog file with commits since the previous tag' \
commits-since:'list commits since a given date' \
contrib:'display author contributions' \ contrib:'display author contributions' \
count:'count commits' \ count:'count commits' \
create-branch:'create local and remote branch' \
delete-branch:'delete local and remote branch' \ delete-branch:'delete local and remote branch' \
delete-merged-brancees:'delete merged branches'\
delete-submodule:'delete submodule' \ delete-submodule:'delete submodule' \
delete-tag:'delete local and remote tag' \ delete-tag:'delete local and remote tag' \
effort:'display effort statistics' \
extras:'git-extras' \ extras:'git-extras' \
graft:'merge commits from source branch to destination branch' \
squash:'merge commits from source branch into the current one as a single commit' \
feature:'create a feature branch' \ feature:'create a feature branch' \
refactor:'create a refactor branch' \ fork:'fork a repo on github' \
bug:'create a bug branch' \ fresh-branch:'create empty local branch' \
summary:'repository summary' \ gh-pages:'create the GitHub Pages branch' \
effort:'display effort statistics' \ graft:'merge commits from source branch to destination branch' \
repl:'read-eval-print-loop' \
commits-since:'list commits since a given date' \
release:'release commit with the given tag' \
alias:'define, search and show aliases' \
ignore:'add patterns to .gitignore' \ ignore:'add patterns to .gitignore' \
info:'show info about the repository' \ info:'show info about the repository' \
create-branch:'create local and remote branch' \ local-commits:'list unpushed commits on the local branch' \
fresh-branch:'create empty local branch' \ lock:'lock a file excluded from version control' \
undo:'remove the latest commit' \ locked:'ls files that have been locked' \
missing:'show commits missing from another branch' \
pr:'checks out a pull request locally' \
rebase-patch:'rebases a patch' \
refactor:'create a refactor branch' \
release:'commit, tag and push changes to the repository' \
rename-tag:'rename a tag' \
repl:'read-eval-print-loop' \
reset-file:'reset one file' \
root:'show path of root' \
setup:'setup a git repository' \ setup:'setup a git repository' \
show-tree:'show branch tree of commit history' \
squash:'merge commits from source branch into the current one as a single commit' \
summary:'repository summary' \
touch:'one step creation of new files' \ touch:'one step creation of new files' \
obliterate:'Completely remove a file from the repository, including past commits and tags' \ undo:'remove the latest commit' \
local-commits:'list unpushed commits on the local branch' \ unlock:'unlock a file excluded from version control'
...@@ -29,7 +29,10 @@ if [[ -x "${commands[gwhoami]}" ]]; then ...@@ -29,7 +29,10 @@ if [[ -x "${commands[gwhoami]}" ]]; then
'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho' 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
'gwhoami' 'gyes') 'gwhoami' 'gyes')
# Not part of coreutils, installed separately. # findutils
gcmds+=('gfind' 'gxargs' 'glocate')
# Not part of either coreutils or findutils, installed separately.
gcmds+=('gsed' 'gtar' 'gtime') gcmds+=('gsed' 'gtar' 'gtime')
for gcmd in "${gcmds[@]}"; do for gcmd in "${gcmds[@]}"; do
......
...@@ -54,23 +54,42 @@ __go_tool_complete() { ...@@ -54,23 +54,42 @@ __go_tool_complete() {
'-installsuffix[suffix to add to package directory]:suffix' '-installsuffix[suffix to add to package directory]:suffix'
'-tags[list of build tags to consider satisfied]:tags' '-tags[list of build tags to consider satisfied]:tags'
) )
__go_list() { __go_packages() {
local expl importpaths local gopaths
declare -a importpaths declare -a gopaths
importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null)) gopaths=("${(s/:/)$(go env GOPATH)}")
_wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}" gopaths+=("$(go env GOROOT)")
for p in $gopaths; do
_path_files -W "$p/src" -/
done
}
__go_identifiers() {
compadd $(godoc -templates $ZSH/plugins/golang/templates ${words[-2]} 2> /dev/null)
} }
case ${words[2]} in case ${words[2]} in
clean|doc) doc)
_arguments -s -w : '*:importpaths:__go_list' _arguments -s -w \
"-c[symbol matching honors case (paths not affected)]" \
"-cmd[show symbols with package docs even if package is a command]" \
"-u[show unexported symbols as well as exported]" \
"2:importpaths:__go_packages" \
":next identifiers:__go_identifiers"
;;
clean)
_arguments -s -w \
"-i[remove the corresponding installed archive or binary (what 'go install' would create)]" \
"-n[print the remove commands it would execute, but not run them]" \
"-r[apply recursively to all the dependencies of the packages named by the import paths]" \
"-x[print remove commands as it executes them]" \
"*:importpaths:__go_packages"
;; ;;
fix|fmt|list|vet) fix|fmt|list|vet)
_alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"' _alternative ':importpaths:__go_packages' ':files:_path_files -g "*.go"'
;; ;;
install) install)
_arguments -s -w : ${build_flags[@]} \ _arguments -s -w : ${build_flags[@]} \
"-v[show package names]" \ "-v[show package names]" \
'*:importpaths:__go_list' '*:importpaths:__go_packages'
;; ;;
get) get)
_arguments -s -w : \ _arguments -s -w : \
...@@ -81,7 +100,7 @@ __go_tool_complete() { ...@@ -81,7 +100,7 @@ __go_tool_complete() {
${build_flags[@]} \ ${build_flags[@]} \
"-v[show package names]" \ "-v[show package names]" \
"-o[output file]:file:_files" \ "-o[output file]:file:_files" \
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }" "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
;; ;;
test) test)
_arguments -s -w : \ _arguments -s -w : \
...@@ -103,7 +122,7 @@ __go_tool_complete() { ...@@ -103,7 +122,7 @@ __go_tool_complete() {
"-cpuprofile[write CPU profile to file]:file:_files" \ "-cpuprofile[write CPU profile to file]:file:_files" \
"-memprofile[write heap profile to file]:file:_files" \ "-memprofile[write heap profile to file]:file:_files" \
"-memprofilerate[set heap profiling rate]:number" \ "-memprofilerate[set heap profiling rate]:number" \
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }" "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
;; ;;
help) help)
_values "${commands[@]}" \ _values "${commands[@]}" \
......
{{with .PDoc}}{{/*
Constants
---------------------------------------
*/}}{{with .Consts}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/*
Variables
---------------------------------------
*/}}{{with .Vars}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/*
Functions
---------------------------------------
*/}}{{with .Funcs}}{{range .}}{{ .Name }} {{end}}{{end}}{{/*
Types
---------------------------------------
*/}}{{with .Types}}{{range .}}{{ $TypeName := .Name }}{{ $TypeName }} {{/*
*/}}{{range .Methods}}{{ $TypeName }}.{{.Name}} {{end}}{{/*
*/}}{{range .Funcs}}{{.Name}} {{end}}{{/*
*/}}{{range .Consts}}{{range .Names}}{{.}} {{end}}{{end}}{{/*
*/}}{{range .Vars}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{end}}{{end}}
...@@ -82,7 +82,7 @@ _gradlew_tasks () { ...@@ -82,7 +82,7 @@ _gradlew_tasks () {
if [ in_gradle ]; then if [ in_gradle ]; then
_gradle_arguments _gradle_arguments
if _gradle_does_task_list_need_generating; then if _gradle_does_task_list_need_generating; then
gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache ./gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
fi fi
compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache` compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache`
fi fi
......
#!/usr/bin/env zsh
#
# gulp-autocompletion-zsh
#
# Autocompletion for your gulp.js tasks
#
# Copyright(c) 2014 André König <andre.koenig@posteo.de>
# MIT Licensed
#
#
# André König
# Github: https://github.com/akoenig
# Twitter: https://twitter.com/caiifr
#
#
# Grabs all available tasks from the `gulpfile.js`
# in the current directory.
#
function $$gulp_completion() {
compls=$(grep -Eo "gulp.task\(('(([a-zA-Z0-9]|-)*)',)" gulpfile.js 2>/dev/null | grep -Eo "'(([a-zA-Z0-9]|-)*)'" | sed s/"'"//g | sort)
completions=(${=compls})
compadd -- $completions
}
compdef $$gulp_completion gulp
\ No newline at end of file
# Jira plugin #
CLI support for JIRA interaction
## Description ##
This plugin provides command line tools for interacting with Atlassian's [JIRA](https://www.atlassian.com/software/jira) bug tracking software.
The interaction is all done through the web. No local installation of JIRA is necessary.
In this document, "JIRA" refers to the JIRA issue tracking server, and `jira` refers to the command this plugin supplies.
## Usage ##
This plugin supplies one command, `jira`, through which all its features are exposed. Most forms of this command open a JIRA page in your web browser.
```
jira # performs the default action
jira new # opens a new issue
jira dashboard # opens your JIRA dashboard
jira reported [username] # queries for issues reported by a user
jira assigned [username] # queries for issues assigned to a user
jira ABC-123 # opens an existing issue
jira ABC-123 m # opens an existing issue for adding a comment
```
#### Debugging usage ####
These calling forms are for developers' use, and may change at any time.
```
jira dumpconfig # displays the effective configuration
```
## Setup ##
The URL for your JIRA instance is set by `$JIRA_URL` or a `.jira_url` file.
Add a `.jira-url` file in the base of your project. You can also set `$JIRA_URL` in your `~/.zshrc` or put a `.jira-url` in your home directory. A `.jira-url` in the current directory takes precedence, so you can make per-project customizations.
The same goes with `.jira-prefix` and `$JIRA_PREFIX`. These control the prefix added to all issue IDs, which differentiates projects within a JIRA instance.
For example:
```
cd to/my/project
echo "https://jira.atlassian.com" >> .jira-url
```
(Note: The current implementation only looks in the current directory for `.jira-url` and `.jira-prefix`, not up the path, so if you are in a subdirectory of your project, it will fall back to your default JIRA URL. This will probably change in the future though.)
### Variables ###
* `$JIRA_URL` - Your JIRA instance's URL
* `$JIRA_NAME` - Your JIRA username; used as the default user for `assigned`/`reported` searches
* `$JIRA_PREFIX` - Prefix added to issue ID arguments
* `$JIRA_RAPID_BOARD` - Set to `true` if you use Rapid Board
* `$JIRA_DEFAULT_ACTION` - Action to do when `jira` is called with no arguments; defaults to "new"
### Browser ###
Your default web browser, as determined by how `open_command` handles `http://` URLs, is used for interacting with the JIRA instance. If you change your system's URL handler associations, it will change the browser that `jira` uses.
...@@ -7,6 +7,7 @@ _1st_arguments=( ...@@ -7,6 +7,7 @@ _1st_arguments=(
'dashboard:open the dashboard' 'dashboard:open the dashboard'
'reported:search for issues reported by a user' 'reported:search for issues reported by a user'
'assigned:search for issues assigned to a user' 'assigned:search for issues assigned to a user'
'dumpconfig:display effective jira configuration'
) )
_arguments -C \ _arguments -C \
......
# CLI support for JIRA interaction # CLI support for JIRA interaction
# #
# Setup: # See README.md for details
# Add a .jira-url file in the base of your project
# You can also set $JIRA_URL in your .zshrc or put .jira-url in your home directory
# A .jira-url in the current directory takes precedence.
# The same goes with .jira-prefix and $JIRA_PREFIX.
#
# For example:
# cd to/my/project
# echo "https://name.jira.com" >> .jira-url
#
# Variables:
# $JIRA_RAPID_BOARD - set to "true" if you use Rapid Board
# $JIRA_DEFAULT_ACTION - action to do when `jira` is called witn no args
# defaults to "new"
# $JIRA_NAME - Your JIRA username. Used as default for assigned/reported
# $JIRA_PREFIX - Prefix added to issue ID arguments
#
#
# Usage:
# jira # Performs the default action
# jira new # opens a new issue
# jira reported [username]
# jira assigned [username]
# jira dashboard
# jira ABC-123 # Opens an existing issue
# jira ABC-123 m # Opens an existing issue for adding a comment
: ${JIRA_DEFAULT_ACTION:=new} : ${JIRA_DEFAULT_ACTION:=new}
function jira() { function jira() {
emulate -L zsh
local action=${1:=$JIRA_DEFAULT_ACTION} local action=${1:=$JIRA_DEFAULT_ACTION}
local jira_url jira_prefix local jira_url jira_prefix
...@@ -63,6 +39,12 @@ function jira() { ...@@ -63,6 +39,12 @@ function jira() {
elif [[ "$action" == "dashboard" ]]; then elif [[ "$action" == "dashboard" ]]; then
echo "Opening dashboard" echo "Opening dashboard"
open_command "${jira_url}/secure/Dashboard.jspa" open_command "${jira_url}/secure/Dashboard.jspa"
elif [[ "$action" == "dumpconfig" ]]; then
echo "JIRA_URL=$jira_url"
echo "JIRA_PREFIX=$jira_prefix"
echo "JIRA_NAME=$JIRA_NAME"
echo "JIRA_RAPID_BOARD=$JIRA_RAPID_BOARD"
echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION"
else else
# Anything that doesn't match a special action is considered an issue name # Anything that doesn't match a special action is considered an issue name
local issue_arg=$action local issue_arg=$action
...@@ -84,15 +66,17 @@ function jira() { ...@@ -84,15 +66,17 @@ function jira() {
function _jira_url_help() { function _jira_url_help() {
cat << EOF cat << EOF
JIRA url is not specified anywhere. error: JIRA URL is not specified anywhere.
Valid options, in order of precedence: Valid options, in order of precedence:
.jira-url file .jira-url file
\$HOME/.jira-url file \$HOME/.jira-url file
JIRA_URL environment variable \$JIRA_URL environment variable
EOF EOF
} }
function _jira_query() { function _jira_query() {
emulate -L zsh
local verb="$1" local verb="$1"
local jira_name lookup preposition query local jira_name lookup preposition query
if [[ "${verb}" == "reported" ]]; then if [[ "${verb}" == "reported" ]]; then
...@@ -102,12 +86,12 @@ function _jira_query() { ...@@ -102,12 +86,12 @@ function _jira_query() {
lookup=assignee lookup=assignee
preposition=to preposition=to
else else
echo "not a valid lookup: $verb" >&2 echo "error: not a valid lookup: $verb" >&2
return 1 return 1
fi fi
jira_name=${2:=$JIRA_NAME} jira_name=${2:=$JIRA_NAME}
if [[ -z $jira_name ]]; then if [[ -z $jira_name ]]; then
echo "JIRA_NAME not specified" >&2 echo "error: JIRA_NAME not specified" >&2
return 1 return 1
fi fi
......
...@@ -12,3 +12,6 @@ alias npmS="npm i -S " ...@@ -12,3 +12,6 @@ alias npmS="npm i -S "
# Install and save to dev-dependencies in your package.json # Install and save to dev-dependencies in your package.json
# npmd is used by https://github.com/dominictarr/npmd # npmd is used by https://github.com/dominictarr/npmd
alias npmD="npm i -D " alias npmD="npm i -D "
# Execute command from node_modules folder based on current directory
# i.e npmE gulp
alias npmE='PATH="$(npm bin)":"$PATH"'
...@@ -5,29 +5,35 @@ ...@@ -5,29 +5,35 @@
# VERSION: 1.1.0 # VERSION: 1.1.0
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
function tab() { function _omz_osx_get_frontmost_app() {
local command="cd \\\"$PWD\\\"; clear" local the_app=$(
(( $# > 0 )) && command="${command}; $*"
the_app=$(
osascript 2>/dev/null <<EOF osascript 2>/dev/null <<EOF
tell application "System Events" tell application "System Events"
name of first item of (every process whose frontmost is true) name of first item of (every process whose frontmost is true)
end tell end tell
EOF EOF
) )
echo "$the_app"
}
[[ "$the_app" == 'Terminal' ]] && { function tab() {
osascript 2>/dev/null <<EOF # Must not have trailing semicolon, for iTerm compatibility
local command="cd \\\"$PWD\\\"; clear"
(( $# > 0 )) && command="${command}; $*"
local the_app=$(_omz_osx_get_frontmost_app)
if [[ "$the_app" == 'Terminal' ]]; then
# Discarding stdout to quash "tab N of window id XXX" output
osascript >/dev/null <<EOF
tell application "System Events" tell application "System Events"
tell process "Terminal" to keystroke "t" using command down tell process "Terminal" to keystroke "t" using command down
tell application "Terminal" to do script "${command}" in front window
end tell end tell
tell application "Terminal" to do script "${command}" in front window
EOF EOF
}
[[ "$the_app" == 'iTerm' ]] && { elif [[ "$the_app" == 'iTerm' ]]; then
osascript 2>/dev/null <<EOF osascript <<EOF
tell application "iTerm" tell application "iTerm"
set current_terminal to current terminal set current_terminal to current terminal
tell current_terminal tell current_terminal
...@@ -35,29 +41,27 @@ EOF ...@@ -35,29 +41,27 @@ EOF
set current_session to current session set current_session to current session
tell current_session tell current_session
write text "${command}" write text "${command}"
keystroke return
end tell end tell
end tell end tell
end tell end tell
EOF EOF
}
else
echo "tab: unsupported terminal app: $the_app"
false
fi
} }
function vsplit_tab() { function vsplit_tab() {
local command="cd \\\"$PWD\\\"" local command="cd \\\"$PWD\\\"; clear"
(( $# > 0 )) && command="${command}; $*" (( $# > 0 )) && command="${command}; $*"
the_app=$( local the_app=$(_omz_osx_get_frontmost_app)
osascript 2>/dev/null <<EOF
tell application "System Events"
name of first item of (every process whose frontmost is true)
end tell
EOF
)
[[ "$the_app" == 'iTerm' ]] && { if [[ "$the_app" == 'iTerm' ]]; then
osascript 2>/dev/null <<EOF osascript <<EOF
tell application "iTerm" to activate -- tell application "iTerm" to activate
tell application "System Events" tell application "System Events"
tell process "iTerm" tell process "iTerm"
...@@ -65,26 +69,24 @@ EOF ...@@ -65,26 +69,24 @@ EOF
click click
end tell end tell
end tell end tell
keystroke "${command}; clear;" keystroke "${command} \n"
keystroke return
end tell end tell
EOF EOF
}
else
echo "$0: unsupported terminal app: $the_app" >&2
false
fi
} }
function split_tab() { function split_tab() {
local command="cd \\\"$PWD\\\"" local command="cd \\\"$PWD\\\"; clear"
(( $# > 0 )) && command="${command}; $*" (( $# > 0 )) && command="${command}; $*"
the_app=$( local the_app=$(_omz_osx_get_frontmost_app)
osascript 2>/dev/null <<EOF
tell application "System Events"
name of first item of (every process whose frontmost is true)
end tell
EOF
)
[[ "$the_app" == 'iTerm' ]] && { if [[ "$the_app" == 'iTerm' ]]; then
osascript 2>/dev/null <<EOF osascript 2>/dev/null <<EOF
tell application "iTerm" to activate tell application "iTerm" to activate
...@@ -94,11 +96,15 @@ EOF ...@@ -94,11 +96,15 @@ EOF
click click
end tell end tell
end tell end tell
keystroke "${command}; clear;" keystroke "${command} \n"
keystroke return
end tell end tell
EOF EOF
}
else
echo "$0: unsupported terminal app: $the_app" >&2
false
fi
} }
function pfd() { function pfd() {
......
...@@ -54,10 +54,12 @@ alias rdrs='rake db:reset' ...@@ -54,10 +54,12 @@ alias rdrs='rake db:reset'
alias rdtc='rake db:test:clone' alias rdtc='rake db:test:clone'
alias rdtp='rake db:test:prepare' alias rdtp='rake db:test:prepare'
alias rdmtc='rake db:migrate db:test:clone' alias rdmtc='rake db:migrate db:test:clone'
alias rlc='rake log:clear' alias rlc='rake log:clear'
alias rn='rake notes' alias rn='rake notes'
alias rr='rake routes' alias rr='rake routes'
alias rrg='rake routes | grep'
alias rt='rake test'
# legacy stuff # legacy stuff
alias sstat='thin --stats "/thin/stats" start' alias sstat='thin --stats "/thin/stats" start'
......
## Scaleway CLI autocomplete plugin
[scw](https://github.com/scaleway/scaleway-cli): Manage Bare Metal servers from Command Line (as easily as with Docker)
- Adds autocomplete options for all `scw` commands.
Maintainer : Manfred Touron ([@moul](https://github.com/moul))
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