#!/bin/bash _basename_no_extension () { sed -e 's/^.*\/\(.*\)\.inc$/\1/' } _composure_functions () { _list_composure_files | _basename_no_extension } _load_tab_completions () { # support tab completion for 'revise' command # you may disable this by adding the following line to your shell startup: # export COMPOSURE_TAB_COMPLETION=0 if [ "$COMPOSURE_TAB_COMPLETION" = "0" ]; then return # if you say so... fi case "$(_shell)" in zsh) read -r -d '' SCRIPT <> $grouplist.$group; echo $grouplist.$group >> $grouplist; done; # clear progress message printf '\r%s\n' ' ' typeset group; typeset gfile; for gfile in $(cat $grouplist | sort | uniq); do printf '%s\n' "${gfile##*.}:"; cat $gfile; printf '\n'; command rm $gfile 2> /dev/null; done | less command rm $grouplist 2> /dev/null } recompose () { about 'loads a stored function from ~/.composure repo' param '1: name of function' example '$ load myfunc' group 'composure' . $(_get_composure_dir)/$1.inc } unique_metafor () { about 'displays all unique metadata for a given keyword' param '1: keyword' example '$ unique_metafor group' group 'composure' typeset keyword=$1 typeset file=$(mktemp /tmp/composure.XXXX) typeset -f | metafor $keyword >> $file cat $file | sort | uniq command rm $file 2>/dev/null } compost () { about 'delete function stored in composure repo' param '1: name of function' example '$ compost myfunc' group 'composure' typeset func=$1 [ -z "$func" ] && echo "you must specify a function name!" && return 1 ( cd $(_get_composure_dir) git rm "$func.inc" && git commit -m "Delete function $func" ) } _load_tab_completions