micro change )
This commit is contained in:
parent
c577c7c76e
commit
145846d37a
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Simple pass like notes manager on bash.
|
Simple pass like notes manager on bash.
|
||||||
To-Do:
|
To-Do:
|
||||||
* [ ] Update help
|
* [x] Update help
|
||||||
* [ ] rm/del notes feature
|
* [x] rm/del notes feature
|
||||||
* [x] Autocomplite feature
|
* [x] Autocomplite feature
|
||||||
* [ ] Sync with git
|
* [ ] Sync with git
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
PN="$HOME/.note-store/"
|
PN="$HOME/.note-store/"
|
||||||
touch $PN/readme.md
|
touch $PN/readme.md
|
||||||
echo "# NotesMenu" > $PN/readme.md
|
echo "# NotesMenu" > $PN/readme.md
|
||||||
@ -16,4 +16,4 @@ fi
|
|||||||
CHOISE="$ED '$PN$CHOISE'"
|
CHOISE="$ED '$PN$CHOISE'"
|
||||||
env TEMP=xterm-256color $TR "$CHOISE"
|
env TEMP=xterm-256color $TR "$CHOISE"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
36
note
36
note
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
VER=0.0.1
|
VER=0.0.1
|
||||||
NOTESPATH="$HOME/.note-store"
|
NOTESPATH="$HOME/.note-store"
|
||||||
|
|
||||||
@ -18,10 +18,12 @@ CMD_HELP(){
|
|||||||
Usage:
|
Usage:
|
||||||
$PROGRAM init
|
$PROGRAM init
|
||||||
Initialize new note storage.
|
Initialize new note storage.
|
||||||
$PROGRAM [ls]
|
$PROGRAM [ls] [subfolder]
|
||||||
List notes.
|
List notes.
|
||||||
$PROGRAM [edit] note-name
|
$PROGRAM edit note-name
|
||||||
Insert a new note or edit an existing note using editor.
|
Insert a new note or edit an existing note using editor.
|
||||||
|
$PROGRAM rm [--recursive,-r] [--force,-f] note-name
|
||||||
|
Remove existing note or directory, optionally forcefully.
|
||||||
$PROGRAM help
|
$PROGRAM help
|
||||||
Show this text.
|
Show this text.
|
||||||
$PROGRAM version
|
$PROGRAM version
|
||||||
@ -32,19 +34,31 @@ _EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMD_INIT(){
|
CMD_INIT(){
|
||||||
test -d "$NOTESPATH" && echo "Note Store already exist" && exit 0 ||
|
local path="${1%/}"
|
||||||
mkdir "$NOTESPATH" &> /dev/null
|
local notefile="$NOTESPATH/$path.md"
|
||||||
|
check_sneaky_paths "$path"
|
||||||
|
|
||||||
|
[[ $force -eq 0 && -e $passfile ]] && yesno "An entry already exists for $path. Overwrite it?"
|
||||||
|
|
||||||
|
mkdir -p -v "$NOTESPATH/$(dirname -- "$path")"
|
||||||
|
|
||||||
echo "New note storage creted to: "$NOTESPATH""
|
echo "New note storage creted to: "$NOTESPATH""
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
CMD_SHOWTREE(){
|
CMD_SHOWTREE(){
|
||||||
if [ ! -z "$1" ]; then
|
local path="$1"
|
||||||
glow -p $NOTESPATH/"$1.md"
|
local notefile="$NOTESPATH/$path.md"
|
||||||
else
|
if [ -d $NOTESPATH/$path ]; then
|
||||||
echo "Note Store"
|
if [[ -z $path ]]; then
|
||||||
tree -N -C -l --noreport "$NOTESPATH" | tail -n +2 |\
|
echo "Note Store"
|
||||||
|
else
|
||||||
|
echo "${path%\/}"
|
||||||
|
fi
|
||||||
|
tree -N -C -l --noreport "$NOTESPATH/$path" | tail -n +2 |\
|
||||||
sed -E 's/\.md(\x1B\[[0-9]+m)?( ->|$)/\1\2/g'
|
sed -E 's/\.md(\x1B\[[0-9]+m)?( ->|$)/\1\2/g'
|
||||||
|
else
|
||||||
|
glow -p $NOTESPATH/$path.md
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
@ -63,6 +77,7 @@ CMD_GREP(){
|
|||||||
|
|
||||||
CMD_DELETE(){
|
CMD_DELETE(){
|
||||||
local opts recursive="" force=0
|
local opts recursive="" force=0
|
||||||
|
te
|
||||||
opts="$($GETOPT -o rf -l recursive,force -n "$PROGRAM" -- "$@")"
|
opts="$($GETOPT -o rf -l recursive,force -n "$PROGRAM" -- "$@")"
|
||||||
local err=$?
|
local err=$?
|
||||||
eval set -- "$opts"
|
eval set -- "$opts"
|
||||||
@ -134,7 +149,6 @@ PROGRAM="${0##*/}"
|
|||||||
COMMAND="$1"
|
COMMAND="$1"
|
||||||
GETOPT="getopt"
|
GETOPT="getopt"
|
||||||
SHRED="shred -f -z"
|
SHRED="shred -f -z"
|
||||||
BASE64="base64"
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
init) shift; CMD_INIT "$@" ;;
|
init) shift; CMD_INIT "$@" ;;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user