Browse Source

Added comments

Matteo Zeccoli Marazzini 5 years ago
parent
commit
08ef557deb
1 changed files with 20 additions and 7 deletions
  1. 20 7
      lcmlog

+ 20 - 7
lcmlog

@@ -10,7 +10,7 @@ usage()
 method_get()
 {
 	pipe=$1
-	while true; do
+	while true; do	# The user must say if he is looking for 150 or Admin logs
 		echo "Search for admin logs (a) or 150 logs (1)?"
 		read CHAR
 		if [ -z $CHAR ]; then continue; fi
@@ -55,22 +55,33 @@ method_post()
 		fi
 	done
 
-	echo "Date?"
-	read DATE
+	while true; do
+		echo "Date?"
+		read DATE
+		if [ ! -z $DATE ]; then
+			break;
+		fi
+	done
 
-	echo "Tags? (insert comma separated tags)"
-	read TAGS
+	while true; do
+		echo "Tags? (insert comma separated tags)"
+		read TAGS
+		if [ ! -z $DATE ]; then
+			break;
+		fi
+	done
 
 	printf "%s\n" "POST" >> $pipe
 	printf "%s\n" "${KIND}" >> $pipe
 	printf "%s\n" "${DATE}" >> $pipe
 	printf "%s\n" "${TAGS}" >> $pipe
 
+	printf "Please write your log\n\n"
+
 	cat - >> $pipe
-	
-	ssh -s log@tuc lcmlog < $pipe
 }
 
+# Entry point
 while getopts ":gpu" o; do
 	case $o in
 	g) METHOD="GET";;
@@ -85,6 +96,7 @@ if [ -z "${METHOD}" ] ; then
 	usage && exit
 fi
 
+# Temporary pipe to send input to the server
 pipe=$(mktemp)
 
 if [ "$METHOD" == "UPDATE" ]; then
@@ -95,6 +107,7 @@ elif [ "$METHOD" == "POST" ]; then
 	method_post $pipe
 fi
 	
+# Call the server
 ssh -s log@tuc lcmlog < $pipe
 
 RET=$?