Skip to content

Commit

Permalink
rake completion, new bashrc
Browse files Browse the repository at this point in the history
  • Loading branch information
nonrational committed Jul 28, 2023
1 parent d61a5cb commit b21bb14
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .bash_completion.d/rake.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

# Bash completion support for Rake, Ruby Make.

# This messes up COMP_WORDBREAKS throughout the system.
# Fixing it to restrict changes to rakecomplete only.
# export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}

_rakecomplete() {
local cur
_get_comp_words_by_ref -n : cur
rakefile=""
seek_path="."
while true; do
rakefile="${seek_path}/Rakefile"
[[ $(readlink -f $seek_path) == "/" || -f "$rakefile" ]] && break
seek_path="../${seek_path}"
done

if [[ -f "$rakefile" ]]; then
recent=`ls -t $seek_path/.rake_tasks~ ${rakefile} **/*.rake 2> /dev/null | head -n 1`
if [[ $recent != "$seek_path/.rake_tasks~" ]]; then
rake --silent --prereqs | grep "rake" | cut -d " " -f 2 > $seek_path/.rake_tasks~
fi
COMPREPLY=($(compgen -W "`cat $seek_path/.rake_tasks~`" -- "$cur"))
# remove colon containing prefix from COMPREPLY items
__ltrim_colon_completions "$cur"
return 0
else
COMPREPLY=()
fi
}

complete -o default -o nospace -F _rakecomplete rake
22 changes: 22 additions & 0 deletions .bashrc.prodigal
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

export ERL_AFLAGS="-kernel shell_history enabled"
export PATH="$PATH:/usr/local/opt/postgresql@15/bin"

alias standup="subl ~/Documents/standup.md"
alias fmcode="code ~/wrk/futurism.code-workspace"
alias fmstart="tmuxinator start futurism"
alias fmstop="tmuxinator stop futurism"

fmcov() {
(
cd $HOME/wrk/pm-backend
for f in $(git df origin/master); do
coverf="cover/Elixir.$(head -n1 $f | awk '{print $2}').html"

if [ -f "$coverf" ]; then
open "$coverf"
fi
done
)
}

0 comments on commit b21bb14

Please sign in to comment.