Turnip Helper, Part 2
I wrote some helpers for turnip <a href='http://coderwall.com/p/senquw'>earlier</a>, but I expanded them to allow for multiple arguments.
It's not quite as pretty, but it works:
turnips() {
args=(${@:-'*'})
args=("${args[@]/#/-o -iname }")
args="${args[@]/%/.feature}"
args=${args/#-o /}
eval "find ./spec/acceptance $args"
}
turnip() {
files=$(turnips $@ | tr '\n' ' ')
echo "rspec $files"
rspec $files
}
Now, if you have the same directory structure as before:
└── spec
└── acceptance
├── admin
│ └── baz.feature
├── bar.feature
└── foo.feature
Calling turnip foo baz
will run
rspec ./spec/acceptance/foo.feature ./spec/acceptance/admin/baz.feature
Enjoy!
Written by Ryland Herrick
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#