Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend _GIT_ENABLED Support to Note/Todo Deletions in nb CLI #290

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions nb
Original file line number Diff line number Diff line change
Expand Up @@ -14363,27 +14363,28 @@ _delete() {
then
_pin unpin "${_notebook_path}/${_relative_path}" &> /dev/null || :

if [[ -d "${_notebook_path}/${_relative_path}" ]] &&
if [[ -d "${_notebook_path}/${_relative_path}" ]] &&
[[ -z "$(ls -A "${_notebook_path}/${_relative_path}")" ]]
then
rm -r "${_notebook_path:?}/${_relative_path:?}"
else
if git -C "${_notebook_path:?}" check-ignore \
"${_notebook_path:?}/${_relative_path:?}" 1>/dev/null
if [[ -z "${_GIT_ENABLED}" ]] &&
git -C "${_notebook_path:?}" check-ignore "${_notebook_path:?}/${_relative_path:?}" 1>/dev/null
then
rm -r "${_notebook_path:?}/${_relative_path:?}"
elif [[ -z "${_GIT_ENABLED}" ]]; then
git -C "${_notebook_path:?}" rm -r "${_notebook_path:?}/${_relative_path:?}" 1>/dev/null
else
git -C "${_notebook_path:?}" rm -r \
"${_notebook_path:?}/${_relative_path:?}" 1>/dev/null
rm -r "${_notebook_path:?}/${_relative_path:?}"
fi
fi

if [[ ! -e "${_notebook_path}/${_relative_path}" ]]
if [[ ! -e "${_notebook_path}/${_relative_path}" ]]
then
_index delete "${_basename}" "${_folder_path}"

_git checkpoint "${_notebook_path}" "[${_ME}] Delete: ${_relative_path}"

printf "Deleted: %s\\n" "${_info_line}"
fi
else
Expand Down