~srivathsan/note

30504d3e8fd863fbbca1be93de9260f8d41b3168 — Srivathsan Murali 1 year, 9 months ago 277f44a
Make sure md is added to filenames
1 files changed, 7 insertions(+), 6 deletions(-)

M note
M note => note +7 -6
@@ 25,12 25,12 @@ cmd_init() {
}

cmd_open() {
  localpath="$1"
  localpath="$1.md"
  filepath="$NOTES_DIR/$localpath"
  folder_path=$(dirname "$filepath")
  
  mkdir -p "$folder_path"
  vim "$filepath"
  $EDITOR "$filepath"

  git_add "$localpath"
  git_commit "$localpath changed"


@@ 39,19 39,20 @@ cmd_open() {
cmd_move() {
  end_dir=$(dirname "$NOTES_DIR/$2")
  mkdir -p "$end_dir"
  git -C "$NOTES_DIR" mv "$1" "$2"
  git -C "$NOTES_DIR" mv "$1.md" "$2.md"
  git_commit "moved $1 -> $2"
  cmd_prune
}

cmd_remove() {
  git -C "$NOTES_DIR" rm "$@"  
  git_commit "deleted $*"
  git -C "$NOTES_DIR" rm "$1.md"  
  git_commit "deleted $1"
  cmd_prune
}

cmd_list() {
  tree -C "$NOTES_DIR"
  path=${1:-""}
	tree -C -l --noreport "$NOTES_DIR/$path" | tail -n +2 | sed -E 's/\.md(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .md at end of line, but keep colors
}

PROGRAM="${0##*/}"