Bladeren bron

Updated the add function

Samuel W. Flint 7 jaren geleden
bovenliggende
commit
a160920469
1 gewijzigde bestanden met toevoegingen van 18 en 1 verwijderingen
  1. 18 1
      library

+ 18 - 1
library

@@ -93,6 +93,7 @@ function run-query {
 
 # add-book, /home/swflint/org/library.org
 function add-single {
+    if [[ $# -lt 7]] ; then
     echo -n "Title: "
     read TITLE
     echo -n "Author: "
@@ -107,6 +108,22 @@ function add-single {
     read ISBN
     echo -n "Location: "
     read LOCATION
+    else
+        TITLE=$1
+        shift
+        AUTHOR=$1
+        shift
+        LCCN=$1
+        shift
+        COPYRIGHT=$1
+        shift
+        PUBLISHER=$1
+        shift
+        ISBN=$1
+        shift
+        LOCATION=$1
+        shift
+    fi
     recins -t Book \
            -f Title -v "${TITLE}" \
            -f Author -v "${AUTHOR}" \
@@ -263,7 +280,7 @@ case ${COMMAND} in
         exit
         ;;
     add)
-        add-single
+        add-single $@
         exit
         ;;
     git)