For Shellcheck: ${@:1:1} -> ${*:1:1}

This commit is contained in:
Jon Lewis
2018-02-05 17:50:44 -06:00
parent b1d2236e07
commit 21239b9442

12
vns
View File

@@ -113,7 +113,7 @@ vns_list () {
# If no notebook is specified, the entire store is used
# Check for default behavior
if [ -z "${@:1:1}" ]; then
if [ -z "${*:1:1}" ]; then
readonly NOTEBOOK=""
printf "%s\n" "Store"
else
@@ -133,7 +133,7 @@ vns_rm () {
# removes (note) from the store
# 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
if [ ! -r "$VNS_STORE/$1.gpg" ]; then
@@ -155,7 +155,7 @@ vns_create () {
# Edit a previously non-existant note
# 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
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
# 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
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
# 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
gpg2 -d "$VNS_STORE/$1.gpg"
@@ -224,7 +224,7 @@ vns () {
# 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
declare -A -r ACTIONS=( ["-c"]="vns_create" ["-d"]="vns_rm"\