Skip to content

Commit

Permalink
if user has n then try and use node 6 bin directly
Browse files Browse the repository at this point in the history
  • Loading branch information
machellerogden committed Mar 6, 2017
1 parent f5b4f0a commit e793e1b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const output = require('./lib/output');

module.exports = cli;

process.on('SIGINT', () => {
process.exit(1);
});

function setSearchTerm(options) {
let searchTerm;
let defaultToCurrent = _.pick(options, [
Expand Down
14 changes: 12 additions & 2 deletions dotfiles/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@ function bitcar_cli() {

local target="$HOME/.bitcar/.bitcar_target"

if bitcar "$@" && [ -f "$target" ]; then
local cmd=()
local nbin="$(ls -d1 $HOME/n/n/versions/node/* | egrep '6\.\d\.\d' | tail -1 | tr -d '[:space:]')/bin/node"
if [[ -x "$nbin" ]]; then
cmd+=( "$nbin" "$(which bitcar)" "$@" );
else
cmd=("bitcar" "$@")
fi

if "${cmd[@]}"; then
cd "$(cat "$target")"
if [ "$1" = "--edit" ] || [ "$2" = "--edit" ] || [ "$1" = "-e" ] || [ "$2" = "-e" ]; then
if [ -n "$BITCAR_EDITOR_CMD" ]; then
$BITCAR_EDITOR_CMD "$(cat "$target")/"
"$BITCAR_EDITOR_CMD" "$(cat "$target")/"
fi
fi
rm "$target"
fi

}

alias bit=bitcar_cli

0 comments on commit e793e1b

Please sign in to comment.