Skip to content

Commit

Permalink
Add nb index edit subcommand.
Browse files Browse the repository at this point in the history
refs gh-316
  • Loading branch information
xwmx committed May 22, 2024
1 parent 466d18e commit f9795dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10276,6 +10276,7 @@ so ids are preserved across systems.
Usage:
nb index add <filename>
nb index delete <filename>
nb index edit
nb index get_basename <id>
nb index get_id <filename>
nb index get_max_id
Expand All @@ -10294,6 +10295,7 @@ Options:
Subcommands:
add Add <filename> to the index.
delete Delete <filename> from the index.
edit Open the index file in `$EDITOR`.
get_basename Print the filename / basename at the specified <id>.
get_id Get the id for <filename>.
get_max_id Get the maximum id for the folder.
Expand Down
2 changes: 2 additions & 0 deletions docs/index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10282,6 +10282,7 @@ so ids are preserved across systems.
Usage:
nb index add <filename>
nb index delete <filename>
nb index edit
nb index get_basename <id>
nb index get_id <filename>
nb index get_max_id
Expand All @@ -10300,6 +10301,7 @@ Options:
Subcommands:
add Add <filename> to the index.
delete Delete <filename> from the index.
edit Open the index file in `$EDITOR`.
get_basename Print the filename / basename at the specified <id>.
get_id Get the id for <filename>.
get_max_id Get the maximum id for the folder.
Expand Down
11 changes: 9 additions & 2 deletions nb
Original file line number Diff line number Diff line change
Expand Up @@ -4582,6 +4582,7 @@ _describe_index() {
$(_color_primary "Usage"):
${_ME} index add <filename>
${_ME} index delete <filename>
${_ME} index edit
${_ME} index get_basename <id>
${_ME} index get_id <filename>
${_ME} index get_max_id
Expand All @@ -4600,6 +4601,7 @@ $(_color_primary "Options"):
$(_color_primary "Subcommands"):
add Add <filename> to the index.
delete Delete <filename> from the index.
edit Open the index file in \`\$EDITOR\`.
get_basename Print the filename / basename at the specified <id>.
get_id Get the id for <filename>.
get_max_id Get the maximum id for the folder.
Expand Down Expand Up @@ -4631,7 +4633,7 @@ _index() {
local _subcommand="${1:-}"

case "${_subcommand:-}" in
get_max_id|show|verify)
edit|get_max_id|show|verify)
_folder_path="${2:-}"
;;
rebuild|reconcile)
Expand Down Expand Up @@ -4681,7 +4683,7 @@ _index() {
add)
_index reconcile "${_folder_path}" --ancestors
;;
rebuild|reconcile)
edit|rebuild|reconcile)
:
;;
*)
Expand Down Expand Up @@ -4729,6 +4731,11 @@ _index() {
return 1
fi
;;
edit)
_edit_file "${_index_path}" --no-wait

return 0
;;
get_basename)
# Usage: _index_get_basename <id> <index-path>
_index_get_basename() {
Expand Down

0 comments on commit f9795dc

Please sign in to comment.