hb

Log | Files | Refs | README | LICENSE

commit 7964882a79717654bc830f18406807ce715fbdeb
parent 1222309b87ee285b7602871ced7f51361727c988
Author: Bharatvaj <bharatvaj@yahoo.com>
Date:   Wed,  8 Jun 2022 23:39:26 +0530

Add basic support busybox-w32 sh

Diffstat:
Mnb | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/nb b/nb @@ -4,12 +4,11 @@ nb_fatal_error() { echo "nb: $1" - exit 1 } nb_browse() { file="$(fzf)" - [ "${file}" != "" ] && ${EDITOR} "${file}" + [ -f "${file}" ] && ${EDITOR} "${file}" } nb_sync() { @@ -40,12 +39,13 @@ nb_usage() { " } -test -z "${EDITOR}" && export EDITOR=vi -#TODO if vi is not found, cat the note +test -z "${EDITOR}" && { export EDITOR=vi; } +# type on windows invokes a different command, this should be fixed before merging to main +where "${EDITOR}" >/dev/null 2>/dev/null || { export EDITOR=cat; } -#TODO ask user to clone repo -# if folder does not exist -cd "${NB_PATH}" || nb_fatal_error "NB_PATH is not a directory" +test -d "${NB_PATH}" || { nb_fatal_error "NB_PATH is not a directory"; exit 1; } +# TODO it's possible for this cd to fail +cd "${NB_PATH}" nb_option=${1} [ $? -gt 1 ] && shift case $nb_option in