For Shellcheck: ${@:1:1} -> ${*:1:1}
This commit is contained in:
12
vns
12
vns
@@ -113,7 +113,7 @@ vns_list () {
|
|||||||
# If no notebook is specified, the entire store is used
|
# If no notebook is specified, the entire store is used
|
||||||
|
|
||||||
# Check for default behavior
|
# Check for default behavior
|
||||||
if [ -z "${@:1:1}" ]; then
|
if [ -z "${*:1:1}" ]; then
|
||||||
readonly NOTEBOOK=""
|
readonly NOTEBOOK=""
|
||||||
printf "%s\n" "Store"
|
printf "%s\n" "Store"
|
||||||
else
|
else
|
||||||
@@ -133,7 +133,7 @@ vns_rm () {
|
|||||||
# removes (note) from the store
|
# removes (note) from the store
|
||||||
|
|
||||||
# Verify $1 is bound
|
# Verify $1 is bound
|
||||||
if [ -z "${@:1:1}" ]; then vns_raise "Insufficient arguments" 11; fi
|
if [ -z "${*:1:1}" ]; then vns_raise "Insufficient arguments" 11; fi
|
||||||
|
|
||||||
# Verify the note exists
|
# Verify the note exists
|
||||||
if [ ! -r "$VNS_STORE/$1.gpg" ]; then
|
if [ ! -r "$VNS_STORE/$1.gpg" ]; then
|
||||||
@@ -155,7 +155,7 @@ vns_create () {
|
|||||||
# Edit a previously non-existant note
|
# Edit a previously non-existant note
|
||||||
|
|
||||||
# Verify $1 is bound
|
# Verify $1 is bound
|
||||||
if [ -z "${@:1:1}" ]; then vns_raise "Insufficient arguments" 11; fi
|
if [ -z "${*:1:1}" ]; then vns_raise "Insufficient arguments" 11; fi
|
||||||
|
|
||||||
# Refuse to overwrite a note
|
# Refuse to overwrite a note
|
||||||
if [ -r "$VNS_STORE/$1.gpg" ]; then vns_raise "Note already exists" 31; fi
|
if [ -r "$VNS_STORE/$1.gpg" ]; then vns_raise "Note already exists" 31; fi
|
||||||
@@ -185,7 +185,7 @@ vns_edit () {
|
|||||||
# edit (note) in the store
|
# edit (note) in the store
|
||||||
|
|
||||||
# Verify $1 is bound
|
# Verify $1 is bound
|
||||||
if [ -z "${@:1:1}" ]; then vns_raise "Insufficient arguments" 11; fi
|
if [ -z "${*:1:1}" ]; then vns_raise "Insufficient arguments" 11; fi
|
||||||
|
|
||||||
# Refuse to edit non-existant notes
|
# Refuse to edit non-existant notes
|
||||||
if [ ! -r "$VNS_STORE/$1.gpg" ]; then vns_raise "Note not found: $1" 41; fi
|
if [ ! -r "$VNS_STORE/$1.gpg" ]; then vns_raise "Note not found: $1" 41; fi
|
||||||
@@ -204,7 +204,7 @@ vns_print () {
|
|||||||
# print the given note to stdout
|
# print the given note to stdout
|
||||||
|
|
||||||
# Verify $1 is bound
|
# Verify $1 is bound
|
||||||
if [ -z "${@:1:1}" ]; then vns_raise "Insufficient arguments" 11; fi
|
if [ -z "${*:1:1}" ]; then vns_raise "Insufficient arguments" 11; fi
|
||||||
|
|
||||||
# Decrypt the specified note
|
# Decrypt the specified note
|
||||||
gpg2 -d "$VNS_STORE/$1.gpg"
|
gpg2 -d "$VNS_STORE/$1.gpg"
|
||||||
@@ -224,7 +224,7 @@ vns () {
|
|||||||
|
|
||||||
|
|
||||||
# Default action is to list all notes
|
# Default action is to list all notes
|
||||||
if [ -z "${@:1:1}" ]; then vns_list ""; exit 0; fi
|
if [ -z "${*:1:1}" ]; then vns_list ""; exit 0; fi
|
||||||
|
|
||||||
# List of valid arguments
|
# List of valid arguments
|
||||||
declare -A -r ACTIONS=( ["-c"]="vns_create" ["-d"]="vns_rm"\
|
declare -A -r ACTIONS=( ["-c"]="vns_create" ["-d"]="vns_rm"\
|
||||||
|
|||||||
Reference in New Issue
Block a user