-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc_functions
40 lines (38 loc) · 1.21 KB
/
.bashrc_functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#jump() {
# path=$(autojump "$@")
# if [[ $? -eq 0 ]]; then
# cd "$path"
# fi
#}
# Wraps a completion function, eg for use with an alias.
# Usage:
# make-completion-wrapper <actual completion function> <name of new func.>
# <command name> <list supplied arguments>
# eg.
# alias agi='apt-get install'
# make-completion-wrapper _apt_get _apt_get_install apt-get install
# # defines a function called _apt_get_install (that's $2) that will
# # complete the 'agi' alias.
# complete -F _apt_get_install agi
function make-completion-wrapper {
local function_name="$2"
local arg_count=$(( $#-3 ))
local comp_function_name="$1"
shift 2
local funktion="function $function_name {
(( COMP_CWORD += $arg_count ))
COMP_WORDS=( \"\$@\" \${COMP_WORDS[@]:1} )
\"$comp_function_name\"
}"
eval "$funktion"
# echo "$funktion"
}
export -f make-completion-wrapper
#function git-move-commit {
# local commit_hash="$1"
# local branch_dest="$2"
# local handler_branch="handler_branch_$branch_dest"
# git branch "handler_branch_$branch_dest" "$commit_hash"
# git rebase -p --onto "$branch_dest" "$commit_hash"^ "$handler_branch"
# git checkout "$branch_dest"
#}