Merge branch 'master' of https://github.com/revans/bash-it
commit
a56a897db2
|
|
@ -0,0 +1,15 @@
|
||||||
|
cite 'about-alias'
|
||||||
|
about-alias 'common svn abbreviations'
|
||||||
|
|
||||||
|
# Aliases
|
||||||
|
alias svs='svn status'
|
||||||
|
alias sa='svn add'
|
||||||
|
alias sci='svn ci -m'
|
||||||
|
alias sco='svn co'
|
||||||
|
alias sup='svn up'
|
||||||
|
alias scu='svn cleanup'
|
||||||
|
alias sli='svn list'
|
||||||
|
alias sdel='svn delete'
|
||||||
|
alias sdif='svn diff'
|
||||||
|
alias slog='svn log'
|
||||||
|
alias smv='svn move'
|
||||||
|
|
@ -0,0 +1,366 @@
|
||||||
|
# hub tab-completion script for bash.
|
||||||
|
# This script complements the completion script that ships with git.
|
||||||
|
|
||||||
|
# Check that git tab completion is available
|
||||||
|
if declare -F _git > /dev/null; then
|
||||||
|
# Duplicate and rename the 'list_all_commands' function
|
||||||
|
eval "$(declare -f __git_list_all_commands | \
|
||||||
|
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
||||||
|
|
||||||
|
# Wrap the 'list_all_commands' function with extra hub commands
|
||||||
|
__git_list_all_commands() {
|
||||||
|
cat <<-EOF
|
||||||
|
alias
|
||||||
|
pull-request
|
||||||
|
fork
|
||||||
|
create
|
||||||
|
browse
|
||||||
|
compare
|
||||||
|
ci-status
|
||||||
|
release
|
||||||
|
issue
|
||||||
|
update
|
||||||
|
EOF
|
||||||
|
__git_list_all_commands_without_hub
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure cached commands are cleared
|
||||||
|
__git_all_commands=""
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# hub command completions
|
||||||
|
##########################
|
||||||
|
|
||||||
|
# hub alias [-s] [SHELL]
|
||||||
|
_git_alias() {
|
||||||
|
local i c=2 s=-s sh shells="bash zsh sh ksh csh fish"
|
||||||
|
while [ $c -lt $cword ]; do
|
||||||
|
i="${words[c]}"
|
||||||
|
case "$i" in
|
||||||
|
-s)
|
||||||
|
unset s
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
for sh in $shells; do
|
||||||
|
if [ "$sh" = "$i" ]; then
|
||||||
|
unset shells
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
((c++))
|
||||||
|
done
|
||||||
|
__gitcomp "$s $shells"
|
||||||
|
}
|
||||||
|
|
||||||
|
# hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE]
|
||||||
|
_git_browse() {
|
||||||
|
local i c=2 u=-u repo subpage
|
||||||
|
local subpages_="commits issues tree wiki pulls branches stargazers
|
||||||
|
contributors network network/ graphs graphs/"
|
||||||
|
local subpages_network="members"
|
||||||
|
local subpages_graphs="commit-activity code-frequency punch-card"
|
||||||
|
while [ $c -lt $cword ]; do
|
||||||
|
i="${words[c]}"
|
||||||
|
case "$i" in
|
||||||
|
-u)
|
||||||
|
unset u
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -z "$repo" ]; then
|
||||||
|
repo=$i
|
||||||
|
else
|
||||||
|
subpage=$i
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
((c++))
|
||||||
|
done
|
||||||
|
if [ -z "$repo" ]; then
|
||||||
|
__gitcomp "$u -- $(__hub_github_repos '\p')"
|
||||||
|
elif [ -z "$subpage" ]; then
|
||||||
|
case "$cur" in
|
||||||
|
*/*)
|
||||||
|
local pfx="${cur%/*}" cur_="${cur#*/}"
|
||||||
|
local subpages_var="subpages_$pfx"
|
||||||
|
__gitcomp "${!subpages_var}" "$pfx/" "$cur_"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
__gitcomp "$u ${subpages_}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
__gitcomp "$u"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# hub compare [-u] [USER[/REPOSITORY]] [[START...]END]
|
||||||
|
_git_compare() {
|
||||||
|
local i c=$((cword - 1)) u=-u user remote owner repo arg_repo rev
|
||||||
|
while [ $c -gt 1 ]; do
|
||||||
|
i="${words[c]}"
|
||||||
|
case "$i" in
|
||||||
|
-u)
|
||||||
|
unset u
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -z "$rev" ]; then
|
||||||
|
# Even though the logic below is able to complete both user/repo
|
||||||
|
# and revision in the right place, when there is only one argument
|
||||||
|
# (other than -u) in the command, that argument will be taken as
|
||||||
|
# revision. For example:
|
||||||
|
# $ hub compare -u upstream
|
||||||
|
# > https://github.com/USER/REPO/compare/upstream
|
||||||
|
if __hub_github_repos '\p' | grep -Eqx "^$i(/[^/]+)?"; then
|
||||||
|
arg_repo=$i
|
||||||
|
else
|
||||||
|
rev=$i
|
||||||
|
fi
|
||||||
|
elif [ -z "$arg_repo" ]; then
|
||||||
|
arg_repo=$i
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
((c--))
|
||||||
|
done
|
||||||
|
|
||||||
|
# Here we want to find out the git remote name of user/repo, in order to
|
||||||
|
# generate an appropriate revision list
|
||||||
|
if [ -z "$arg_repo" ]; then
|
||||||
|
user=$(__hub_github_user)
|
||||||
|
if [ -z "$user" ]; then
|
||||||
|
for i in $(__hub_github_repos); do
|
||||||
|
remote=${i%%:*}
|
||||||
|
repo=${i#*:}
|
||||||
|
if [ "$remote" = origin ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for i in $(__hub_github_repos); do
|
||||||
|
remote=${i%%:*}
|
||||||
|
repo=${i#*:}
|
||||||
|
owner=${repo%%/*}
|
||||||
|
if [ "$user" = "$owner" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
for i in $(__hub_github_repos); do
|
||||||
|
remote=${i%%:*}
|
||||||
|
repo=${i#*:}
|
||||||
|
owner=${repo%%/*}
|
||||||
|
case "$arg_repo" in
|
||||||
|
"$repo"|"$owner")
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
local pfx cur_="$cur"
|
||||||
|
case "$cur_" in
|
||||||
|
*..*)
|
||||||
|
pfx="${cur_%%..*}..."
|
||||||
|
cur_="${cur_##*..}"
|
||||||
|
__gitcomp_nl "$(__hub_revlist $remote)" "$pfx" "$cur_"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -z "${arg_repo}${rev}" ]; then
|
||||||
|
__gitcomp "$u $(__hub_github_repos '\o\n\p') $(__hub_revlist $remote)"
|
||||||
|
elif [ -z "$rev" ]; then
|
||||||
|
__gitcomp "$u $(__hub_revlist $remote)"
|
||||||
|
else
|
||||||
|
__gitcomp "$u"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]
|
||||||
|
_git_create() {
|
||||||
|
local i c=2 name repo flags="-p -d -h"
|
||||||
|
while [ $c -lt $cword ]; do
|
||||||
|
i="${words[c]}"
|
||||||
|
case "$i" in
|
||||||
|
-d|-h)
|
||||||
|
((c++))
|
||||||
|
flags=${flags/$i/}
|
||||||
|
;;
|
||||||
|
-p)
|
||||||
|
flags=${flags/$i/}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
name=$i
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
((c++))
|
||||||
|
done
|
||||||
|
if [ -z "$name" ]; then
|
||||||
|
repo=$(basename "$(pwd)")
|
||||||
|
fi
|
||||||
|
case "$prev" in
|
||||||
|
-d|-h)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
-p|*)
|
||||||
|
__gitcomp "$repo $flags"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# hub fork [--no-remote]
|
||||||
|
_git_fork() {
|
||||||
|
local i c=2 remote=yes
|
||||||
|
while [ $c -lt $cword ]; do
|
||||||
|
i="${words[c]}"
|
||||||
|
case "$i" in
|
||||||
|
--no-remote)
|
||||||
|
unset remote
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
((c++))
|
||||||
|
done
|
||||||
|
if [ -n "$remote" ]; then
|
||||||
|
__gitcomp "--no-remote"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>]
|
||||||
|
_git_pull_request() {
|
||||||
|
local i c=2 flags="-f -m -F -i -b -h"
|
||||||
|
while [ $c -lt $cword ]; do
|
||||||
|
i="${words[c]}"
|
||||||
|
case "$i" in
|
||||||
|
-m|-F|-i|-b|-h)
|
||||||
|
((c++))
|
||||||
|
flags=${flags/$i/}
|
||||||
|
;;
|
||||||
|
-f)
|
||||||
|
flags=${flags/$i/}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
((c++))
|
||||||
|
done
|
||||||
|
case "$prev" in
|
||||||
|
-i)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
-b|-h)
|
||||||
|
# (Doesn't seem to need this...)
|
||||||
|
# Uncomment the following line when 'owner/repo:[TAB]' misbehaved
|
||||||
|
#_get_comp_words_by_ref -n : cur
|
||||||
|
__gitcomp_nl "$(__hub_heads)"
|
||||||
|
# __ltrim_colon_completions "$cur"
|
||||||
|
;;
|
||||||
|
-F)
|
||||||
|
COMPREPLY=( "$cur"* )
|
||||||
|
;;
|
||||||
|
-f|*)
|
||||||
|
__gitcomp "$flags"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Helper functions
|
||||||
|
###################
|
||||||
|
|
||||||
|
# __hub_github_user [HOST]
|
||||||
|
# Return $GITHUB_USER or the default github user defined in hub config
|
||||||
|
# HOST - Host to be looked-up in hub config. Default is "github.com"
|
||||||
|
__hub_github_user() {
|
||||||
|
if [ -n "$GITHUB_USER" ]; then
|
||||||
|
echo $GITHUB_USER
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
local line h k v host=${1:-github.com} config=${HUB_CONFIG:-~/.config/gh}
|
||||||
|
if [ -f "$config" ]; then
|
||||||
|
while read line; do
|
||||||
|
if [ "$line" = "---" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
k=${line%%:*}
|
||||||
|
v=${line#*:}
|
||||||
|
if [ -z "$v" ]; then
|
||||||
|
if [ "$h" = "$host" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
h=$k
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
k=${k#* }
|
||||||
|
v=${v#* }
|
||||||
|
if [ "$h" = "$host" ] && [ "$k" = "user" ]; then
|
||||||
|
echo "$v"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done < "$config"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# __hub_github_repos [FORMAT]
|
||||||
|
# List all github hosted repository
|
||||||
|
# FORMAT - Format string contains multiple of these:
|
||||||
|
# \m remote
|
||||||
|
# \p owner/repo
|
||||||
|
# \o owner
|
||||||
|
# escaped characters (\n, \t ...etc) work
|
||||||
|
# If omitted, prints all github repos in the format of "remote:owner/repo"
|
||||||
|
__hub_github_repos() {
|
||||||
|
local f format=$1
|
||||||
|
if [ -z "$(__gitdir)" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ -z "$format" ]; then
|
||||||
|
format='\1:\2'
|
||||||
|
else
|
||||||
|
format=${format//\m/\1}
|
||||||
|
format=${format//\p/\2}
|
||||||
|
format=${format//\o/\3}
|
||||||
|
fi
|
||||||
|
command git config --get-regexp 'remote\.[^.]*\.url' |
|
||||||
|
grep -E ' ((https?|git)://|git@)github\.com[:/][^:/]+/[^/]+$' |
|
||||||
|
sed -E 's#^remote\.([^.]+)\.url +.+[:/](([^/]+)/[^.]+)(\.git)?$#'"$format"'#'
|
||||||
|
}
|
||||||
|
|
||||||
|
# __hub_heads
|
||||||
|
# List all local "branch", and remote "owner/repo:branch"
|
||||||
|
__hub_heads() {
|
||||||
|
local i remote repo branch dir=$(__gitdir)
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||||
|
"refs/heads/"
|
||||||
|
for i in $(__hub_github_repos); do
|
||||||
|
remote=${i%%:*}
|
||||||
|
repo=${i#*:}
|
||||||
|
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||||
|
"refs/remotes/${remote}/" | while read branch; do
|
||||||
|
echo "${repo}:${branch#${remote}/}"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# __hub_revlist [REMOTE]
|
||||||
|
# List all tags, and branches under REMOTE, without the "remote/" prefix
|
||||||
|
# REMOTE - Remote name to search branches from. Default is "origin"
|
||||||
|
__hub_revlist() {
|
||||||
|
local i remote=${1:-origin} dir=$(__gitdir)
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||||
|
"refs/remotes/${remote}/" | while read i; do
|
||||||
|
echo "${i#${remote}/}"
|
||||||
|
done
|
||||||
|
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||||
|
"refs/tags/"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Enable completion for hub even when not using the alias
|
||||||
|
complete -o bashdefault -o default -o nospace -F _git gh 2>/dev/null \
|
||||||
|
|| complete -o default -o nospace -F _git gh
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
@ -0,0 +1,510 @@
|
||||||
|
#!bash
|
||||||
|
#
|
||||||
|
# git-flow-completion
|
||||||
|
# ===================
|
||||||
|
#
|
||||||
|
# Bash completion support for [git-flow (AVH Edition)](http://github.com/petervanderdoes/gitflow)
|
||||||
|
#
|
||||||
|
# The contained completion routines provide support for completing:
|
||||||
|
#
|
||||||
|
# * git-flow init and version
|
||||||
|
# * feature, hotfix and release branches
|
||||||
|
# * remote feature, hotfix and release branch names
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Installation
|
||||||
|
# ------------
|
||||||
|
#
|
||||||
|
# To achieve git-flow completion nirvana:
|
||||||
|
#
|
||||||
|
# 0. Install git-completion.
|
||||||
|
#
|
||||||
|
# 1. Install this file. Either:
|
||||||
|
#
|
||||||
|
# a. Place it in a `bash-completion.d` folder:
|
||||||
|
#
|
||||||
|
# * /etc/bash-completion.d
|
||||||
|
# * /usr/local/etc/bash-completion.d
|
||||||
|
# * ~/bash-completion.d
|
||||||
|
#
|
||||||
|
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in
|
||||||
|
# your .bashrc:
|
||||||
|
#
|
||||||
|
# source ~/.git-flow-completion.sh
|
||||||
|
#
|
||||||
|
# 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant
|
||||||
|
# $command case in _git:
|
||||||
|
#
|
||||||
|
# flow) _git_flow ;;
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# The Fine Print
|
||||||
|
# --------------
|
||||||
|
#
|
||||||
|
# Author:
|
||||||
|
# Copyright 2012-2013 Peter van der Does.
|
||||||
|
#
|
||||||
|
# Original Author:
|
||||||
|
# Copyright (c) 2011 [Justin Hileman](http://justinhileman.com)
|
||||||
|
#
|
||||||
|
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
|
||||||
|
|
||||||
|
__git_flow_config_file_options="
|
||||||
|
--local --global --system --file=
|
||||||
|
"
|
||||||
|
|
||||||
|
_git_flow ()
|
||||||
|
{
|
||||||
|
local subcommands="init feature release hotfix support help version config finish delete publish rebase"
|
||||||
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
if [ -z "$subcommand" ]; then
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$subcommand" in
|
||||||
|
init)
|
||||||
|
__git_flow_init
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
feature)
|
||||||
|
__git_flow_feature
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
release)
|
||||||
|
__git_flow_release
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
hotfix)
|
||||||
|
__git_flow_hotfix
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
support)
|
||||||
|
__git_flow_support
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
config)
|
||||||
|
__git_flow_config
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_init ()
|
||||||
|
{
|
||||||
|
local subcommands="help"
|
||||||
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
if [ -z "$subcommand" ]; then
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nodefaults --defaults
|
||||||
|
--noforce --force
|
||||||
|
$__git_flow_config_file_options
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_feature ()
|
||||||
|
{
|
||||||
|
local subcommands="list start finish publish track diff rebase checkout pull help delete"
|
||||||
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
|
||||||
|
if [ -z "$subcommand" ]; then
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$subcommand" in
|
||||||
|
pull)
|
||||||
|
__gitcomp_nl "$(__git_remotes)"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
checkout)
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
delete)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--noforce --force
|
||||||
|
--noremote --remote
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
finish)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nofetch --fetch
|
||||||
|
--norebase --rebase
|
||||||
|
--nopreserve-merges --preserve-merges
|
||||||
|
--nokeep --keep
|
||||||
|
--keepremote
|
||||||
|
--keeplocal
|
||||||
|
--noforce_delete --force_delete
|
||||||
|
--nosquash --squash
|
||||||
|
--no-ff
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
diff)
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
rebase)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nointeractive --interactive
|
||||||
|
--nopreserve-merges --preserve-merges
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
publish)
|
||||||
|
__gitcomp_nl "$(__git_flow_list_branches 'feature')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
track)
|
||||||
|
__gitcomp_nl "$(__git_flow_list_branches 'feature')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_release ()
|
||||||
|
{
|
||||||
|
local subcommands="list start finish track publish help delete"
|
||||||
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
if [ -z "$subcommand" ]; then
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$subcommand" in
|
||||||
|
finish)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nofetch --fetch
|
||||||
|
--sign
|
||||||
|
--signingkey
|
||||||
|
--message
|
||||||
|
--nomessagefile --messagefile=
|
||||||
|
--nopush --push
|
||||||
|
--nokeep --keep
|
||||||
|
--keepremote
|
||||||
|
--keeplocal
|
||||||
|
--noforce_delete --force_delete
|
||||||
|
--notag --tag
|
||||||
|
--nonobackmerge --nobackmerge
|
||||||
|
--nosquash --squash
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'release')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
rebase)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nointeractive --interactive
|
||||||
|
--nopreserve-merges --preserve-merges
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'release')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
delete)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--noforce --force
|
||||||
|
--noremote --remote
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'release')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
publish)
|
||||||
|
__gitcomp_nl "$(__git_flow_list_branches 'release')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
track)
|
||||||
|
__gitcomp_nl "$(__git_flow_list_branches 'release')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
start)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nofetch --fetch
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_hotfix ()
|
||||||
|
{
|
||||||
|
local subcommands="list start finish track publish help delete"
|
||||||
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
if [ -z "$subcommand" ]; then
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$subcommand" in
|
||||||
|
finish)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nofetch --fetch
|
||||||
|
--sign
|
||||||
|
--signingkey
|
||||||
|
--message
|
||||||
|
--nomessagefile --messagefile=
|
||||||
|
--nopush --push
|
||||||
|
--nokeep --keep
|
||||||
|
--keepremote
|
||||||
|
--keeplocal
|
||||||
|
--noforce_delete --force_delete
|
||||||
|
--notag --tag
|
||||||
|
--nonobackmerge --nobackmerge
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'hotfix')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
rebase)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nointeractive --interactive
|
||||||
|
--nopreserve-merges --preserve-merges
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'hotfix')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
delete)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--noforce --force
|
||||||
|
--noremote --remote
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'hotfix')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
publish)
|
||||||
|
__gitcomp_nl "$(__git_flow_list_branches 'hotfix')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
track)
|
||||||
|
__gitcomp_nl "$(__git_flow_list_branches 'hotfix')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
start)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nofetch --fetch
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_support ()
|
||||||
|
{
|
||||||
|
local subcommands="list start help"
|
||||||
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
if [ -z "$subcommand" ]; then
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$subcommand" in
|
||||||
|
start)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nofetch --fetch
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
rebase)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
--nointeractive --interactive
|
||||||
|
--nopreserve-merges --preserve-merges
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches 'support')"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_config ()
|
||||||
|
{
|
||||||
|
local subcommands="list set base"
|
||||||
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
if [ -z "$subcommand" ]; then
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$subcommand" in
|
||||||
|
set)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
$__git_flow_config_file_options
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp "
|
||||||
|
master develop
|
||||||
|
feature hotfix release support
|
||||||
|
versiontagprefix
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
base)
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "
|
||||||
|
set get
|
||||||
|
"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__gitcomp_nl "$(__git_flow_list_local_branches)"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_prefix ()
|
||||||
|
{
|
||||||
|
case "$1" in
|
||||||
|
feature|release|hotfix|support)
|
||||||
|
git config "gitflow.prefix.$1" 2> /dev/null || echo "$1/"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_list_local_branches ()
|
||||||
|
{
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
local prefix="$(__git_flow_prefix $1)"
|
||||||
|
git for-each-ref --shell --format="ref=%(refname:short)" refs/heads/$prefix | \
|
||||||
|
while read -r entry; do
|
||||||
|
eval "$entry"
|
||||||
|
ref="${ref#$prefix}"
|
||||||
|
echo "$ref"
|
||||||
|
done | sort
|
||||||
|
else
|
||||||
|
git for-each-ref --format="ref=%(refname:short)" refs/heads/ | sort
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_list_remote_branches ()
|
||||||
|
{
|
||||||
|
local prefix="$(__git_flow_prefix $1)"
|
||||||
|
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
|
||||||
|
git for-each-ref --shell --format='%(refname:short)' refs/remotes/$origin/$prefix | \
|
||||||
|
while read -r entry; do
|
||||||
|
eval "$entry"
|
||||||
|
ref="${ref##$prefix}"
|
||||||
|
echo "$ref"
|
||||||
|
done | sort
|
||||||
|
}
|
||||||
|
|
||||||
|
__git_flow_list_branches ()
|
||||||
|
{
|
||||||
|
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
local prefix="$(__git_flow_prefix $1)"
|
||||||
|
git for-each-ref --shell --format="ref=%(refname:short)" refs/heads/$prefix refs/remotes/$origin/$prefix | \
|
||||||
|
while read -r entry; do
|
||||||
|
eval "$entry"
|
||||||
|
ref="${ref##$prefix}"
|
||||||
|
echo "$ref"
|
||||||
|
done | sort
|
||||||
|
else
|
||||||
|
git for-each-ref --format="%(refname:short)" refs/heads/ refs/remotes/$origin | sort
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# alias __git_find_on_cmdline for backwards compatibility
|
||||||
|
if [ -z "`type -t __git_find_on_cmdline`" ]; then
|
||||||
|
alias __git_find_on_cmdline=__git_find_subcommand
|
||||||
|
fi
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,222 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
_vboxmanage_realopts() {
|
||||||
|
echo $(vboxmanage|grep -i vboxmanage|cut -d' ' -f2|grep '\['|tr -s '[\[\|\]\n' ' ')
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
|
||||||
|
__vboxmanage_startvm() {
|
||||||
|
RUNNING=$(vboxmanage list runningvms | cut -d' ' -f1 | tr -d '"')
|
||||||
|
TOTAL=$(vboxmanage list vms | cut -d' ' -f1 | tr -d '"')
|
||||||
|
|
||||||
|
AVAILABLE=""
|
||||||
|
for VM in $TOTAL; do
|
||||||
|
MATCH=0;
|
||||||
|
for RUN in $RUNNING "x"; do
|
||||||
|
if [ "$VM" == "$RUN" ]; then
|
||||||
|
MATCH=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
(( $MATCH == 0 )) && AVAILABLE="$AVAILABLE $VM "
|
||||||
|
done
|
||||||
|
echo $AVAILABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
__vboxmanage_list() {
|
||||||
|
INPUT=$(vboxmanage list | tr -s '[\[\]\|\n]' ' ' | cut -d' ' -f4-)
|
||||||
|
|
||||||
|
PRUNED=""
|
||||||
|
if [ "$1" == "long" ]; then
|
||||||
|
for WORD in $INPUT; do
|
||||||
|
[ "$WORD" == "-l" ] && continue;
|
||||||
|
[ "$WORD" == "--long" ] && continue;
|
||||||
|
|
||||||
|
PRUNED="$PRUNED $WORD"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
PRUNED=$INPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $PRUNED
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__vboxmanage_list_vms() {
|
||||||
|
VMS=""
|
||||||
|
if [ "x$1" == "x" ]; then
|
||||||
|
SEPARATOR=" "
|
||||||
|
else
|
||||||
|
SEPARATOR=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for VM in $(vboxmanage list vms | cut -d' ' -f1 | tr -d '"'); do
|
||||||
|
[ "$VMS" != "" ] && VMS="${VMS}${SEPARATOR}"
|
||||||
|
VMS="${VMS}${VM}"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $VMS
|
||||||
|
}
|
||||||
|
|
||||||
|
__vboxmanage_list_runningvms() {
|
||||||
|
VMS=""
|
||||||
|
if [ "$1" == "" ]; then
|
||||||
|
SEPARATOR=" "
|
||||||
|
else
|
||||||
|
SEPARATOR=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for VM in $(vboxmanage list runningvms | cut -d' ' -f1 | tr -d '"'); do
|
||||||
|
[ "$VMS" != "" ] && VMS="${VMS}${SEPARATOR}"
|
||||||
|
VMS="${VMS}${VM}"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $VMS
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
__vboxmanage_controlvm() {
|
||||||
|
echo "pause resume reset poweroff savestate acpipowerbutton"
|
||||||
|
echo "acpisleepbutton keyboardputscancode guestmemoryballoon"
|
||||||
|
echo "gueststatisticsinterval usbattach usbdetach vrde vrdeport"
|
||||||
|
echo "vrdeproperty vrdevideochannelquality setvideomodehint"
|
||||||
|
echo "screenshotpng setcredentials teleport plugcpu unplugcpu"
|
||||||
|
echo "cpuexecutioncap"
|
||||||
|
|
||||||
|
# setlinkstate<1-N>
|
||||||
|
# nic<1-N> null|nat|bridged|intnet|hostonly|generic
|
||||||
|
# [<devicename>] |
|
||||||
|
# nictrace<1-N> on|off
|
||||||
|
# nictracefile<1-N> <filename>
|
||||||
|
# nicproperty<1-N> name=[value]
|
||||||
|
# natpf<1-N> [<rulename>],tcp|udp,[<hostip>],
|
||||||
|
# <hostport>,[<guestip>],<guestport>
|
||||||
|
# natpf<1-N> delete <rulename>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
__vboxmanage_default() {
|
||||||
|
realopts=$(_vboxmanage_realopts)
|
||||||
|
opts=$realopts$(vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | grep -v '\[' | sort | uniq)
|
||||||
|
pruned=""
|
||||||
|
|
||||||
|
# echo ""
|
||||||
|
# echo "DEBUG: cur: $cur, prev: $prev"
|
||||||
|
# echo "DEBUG: default: |$p1|$p2|$p3|$p4|"
|
||||||
|
case ${cur} in
|
||||||
|
-*)
|
||||||
|
echo $opts
|
||||||
|
# COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac;
|
||||||
|
|
||||||
|
for WORD in $opts; do
|
||||||
|
MATCH=0
|
||||||
|
for OPT in ${COMP_WORDS[@]}; do
|
||||||
|
# opts=$(echo ${opts} | grep -v $OPT);
|
||||||
|
if [ "$OPT" == "$WORD" ]; then
|
||||||
|
MATCH=1
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
if [ "$OPT" == "-v" ] && [ "$WORD" == "--version" ]; then
|
||||||
|
MATCH=1
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
if [ "$OPT" == "--version" ] && [ "$WORD" == "-v" ]; then
|
||||||
|
MATCH=1
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
if [ "$OPT" == "-q" ] && [ "$WORD" == "--nologo" ]; then
|
||||||
|
MATCH=1
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
if [ "$OPT" == "--nologo" ] && [ "$WORD" == "-q" ]; then
|
||||||
|
MATCH=1
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
(( $MATCH == 1 )) && continue;
|
||||||
|
pruned="$pruned $WORD"
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# COMPREPLY=($(compgen -W "${pruned}" -- ${cur}))
|
||||||
|
echo $pruned
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_vboxmanage() {
|
||||||
|
# vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | sort | uniq
|
||||||
|
local cur p1 p2 p3 p4 opts
|
||||||
|
COMPREPLY=()
|
||||||
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
|
||||||
|
# echo "cur: |$cur|"
|
||||||
|
# echo "prev: |$prev|"
|
||||||
|
|
||||||
|
# In case current is complete command
|
||||||
|
case $cur in
|
||||||
|
startvm|list|controlvm)
|
||||||
|
COMPREPLY=($(compgen -W "$cur "))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $prev in
|
||||||
|
-v|--version)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
|
||||||
|
-l|--long)
|
||||||
|
opts=$(__vboxmanage_list "long")
|
||||||
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
startvm|list)
|
||||||
|
opts=$(__vboxmanage_$prev)
|
||||||
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--type)
|
||||||
|
COMPREPLY=($(compgen -W "gui headless" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
gui|headless)
|
||||||
|
# Done. no more completion possible
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
vboxmanage|-q|--nologo)
|
||||||
|
# echo "Got vboxmanage"
|
||||||
|
opts=$(__vboxmanage_default)
|
||||||
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
controlvm)
|
||||||
|
opts=$(__vboxmanage_list_vms)
|
||||||
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for VM in $(__vboxmanage_list_vms); do
|
||||||
|
if [ "$VM" == "$prev" ]; then
|
||||||
|
pprev=${COMP_WORDS[COMP_CWORD-2]}
|
||||||
|
# echo "previous: $pprev"
|
||||||
|
case $pprev in
|
||||||
|
startvm)
|
||||||
|
opts="--type"
|
||||||
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
controlvm)
|
||||||
|
opts=$(__vboxmanage_controlvm)
|
||||||
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
|
return 0;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# echo "Got to end withoug completion"
|
||||||
|
}
|
||||||
|
complete -F _vboxmanage vboxmanage
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
cite about-plugin
|
||||||
|
about-plugin 'load fzf, if you are using it'
|
||||||
|
|
||||||
|
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
cite about-plugin
|
||||||
|
about-plugin 'load gh, if you are using it.'
|
||||||
|
|
||||||
|
command -v gh >/dev/null 2>&1 && eval "$(gh alias -s)"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
cite about-plugin
|
||||||
|
about-plugin 'load pipsi, if you are using it'
|
||||||
|
|
||||||
|
if [[ -f $HOME/.local/bin/pipsi ]]
|
||||||
|
then
|
||||||
|
export PATH=~/.local/bin:$PATH
|
||||||
|
fi
|
||||||
|
|
@ -82,8 +82,17 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# checks if the plugin is installed before calling battery_charge
|
||||||
|
safe_battery_charge() {
|
||||||
|
if [ -e "${BASH_IT}/plugins/enabled/battery.plugin.bash" ];
|
||||||
|
then
|
||||||
|
battery_charge
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# -------------------------------------------------------------- PROMPT OUTPUT
|
# -------------------------------------------------------------- PROMPT OUTPUT
|
||||||
prompt() {
|
prompt() {
|
||||||
|
local LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed)
|
||||||
local SAVE_CURSOR='\033[s'
|
local SAVE_CURSOR='\033[s'
|
||||||
local RESTORE_CURSOR='\033[u'
|
local RESTORE_CURSOR='\033[u'
|
||||||
local MOVE_CURSOR_RIGHTMOST='\033[500C'
|
local MOVE_CURSOR_RIGHTMOST='\033[500C'
|
||||||
|
|
@ -93,11 +102,11 @@ prompt() {
|
||||||
then
|
then
|
||||||
PS1="${TITLEBAR}
|
PS1="${TITLEBAR}
|
||||||
${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\
|
${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\
|
||||||
$(battery_charge)${RESTORE_CURSOR}\
|
$(safe_battery_charge)${RESTORE_CURSOR}\
|
||||||
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
|
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
|
||||||
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
|
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
|
||||||
in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\
|
in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\
|
||||||
$(mitsuhikos_lastcommandfailed)\
|
${LAST_COMMAND_FAILED}\
|
||||||
$(demula_vcprompt)\
|
$(demula_vcprompt)\
|
||||||
$(is_vim_shell)
|
$(is_vim_shell)
|
||||||
${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
||||||
|
|
@ -106,10 +115,10 @@ ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
||||||
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
|
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
|
||||||
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
|
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
|
||||||
in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\
|
in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\
|
||||||
$(mitsuhikos_lastcommandfailed)\
|
${LAST_COMMAND_FAILED}\
|
||||||
$(demula_vcprompt)\
|
$(demula_vcprompt)\
|
||||||
$(is_vim_shell)\
|
$(is_vim_shell)\
|
||||||
$(battery_charge)
|
$(safe_battery_charge)
|
||||||
${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SCM_THEME_PROMPT_PREFIX="${cyan} on ${green}"
|
||||||
|
SCM_THEME_PROMPT_SUFFIX=""
|
||||||
|
SCM_THEME_PROMPT_DIRTY=" ${red}with changes"
|
||||||
|
SCM_THEME_PROMPT_CLEAN=""
|
||||||
|
|
||||||
|
venv() {
|
||||||
|
if [ ! -z "$VIRTUAL_ENV" ]
|
||||||
|
then
|
||||||
|
local env=$VIRTUAL_ENV
|
||||||
|
echo "${gray} in ${orange}${env##*/} "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
last_two_dirs() {
|
||||||
|
pwd|rev|awk -F / '{print $1,$2}'|rev|sed s_\ _/_|sed "s|$(sed 's,\/,,'<<<$HOME)|~|g"
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt() {
|
||||||
|
PS1="${yellow}# ${reset_color}$(last_two_dirs)$(scm_prompt_info)${reset_color}$(venv)${reset_color} ${cyan}\n> ${reset_color}"
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT_COMMAND=prompt
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||||
|
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||||
|
SCM_THEME_PROMPT_PREFIX="(${yellow}"
|
||||||
|
SCM_THEME_PROMPT_SUFFIX="${normal})"
|
||||||
|
|
||||||
|
GIT_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||||
|
GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||||
|
GIT_THEME_PROMPT_PREFIX="(${yellow}"
|
||||||
|
GIT_THEME_PROMPT_SUFFIX="${normal})"
|
||||||
|
|
||||||
|
RVM_THEME_PROMPT_PREFIX=""
|
||||||
|
RVM_THEME_PROMPT_SUFFIX=""
|
||||||
|
|
||||||
|
function prompt_command() {
|
||||||
|
dtime="${yellow}\T${normal}"
|
||||||
|
user_host="${green}\u@${cyan}\h${normal}"
|
||||||
|
current_dir="${bold_blue}\w${normal}"
|
||||||
|
rvm_ruby="${bold_red}$(ruby_version_prompt)${normal}"
|
||||||
|
git_branch="$(scm_prompt_info)${normal}"
|
||||||
|
prompt="${bold_green}\$${normal} "
|
||||||
|
arrow="${bold_white}▶${normal} "
|
||||||
|
prompt="${bold_green}\$${normal} "
|
||||||
|
|
||||||
|
PS1="${dtime} ${user_host}:${current_dir} ${rvm_ruby} ${git_branch}
|
||||||
|
$arrow $prompt"
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT_COMMAND=prompt_command;
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
export GIT_PS1_SHOWDIRTYSTATE=true
|
||||||
|
export GIT_PS1_SHOWUNTRACKEDFILES=true
|
||||||
|
export GIT_PS1_SHOWSTASHSTATE=true
|
||||||
|
|
||||||
|
export PROMPT_DIRTRIM=3
|
||||||
|
|
||||||
|
function prompt_command() {
|
||||||
|
if [[ ${EUID} == 0 ]] ; then
|
||||||
|
PS1="[\t]${yellow}[${red}\u@\h ${green}\w${yellow}]${red}$(__git_ps1 "(%s)")${normal}\\$ "
|
||||||
|
else
|
||||||
|
PS1="[\t]${yellow}[${cyan}\u@\h ${green}\w${yellow}]${red}$(__git_ps1 "(%s)")${normal}\\$ "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT_COMMAND=prompt_command;
|
||||||
Loading…
Reference in New Issue