From e1b97dcc9d4ad47bf4ceab66466fde2ce895cbe0 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Sun, 15 May 2016 16:17:21 +0000
Subject: [PATCH] Added a file paramikoTest.py, an attempt to make remote connection

---
 python/trisurf/tsmgr.py |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/python/trisurf/tsmgr.py b/python/trisurf/tsmgr.py
index e376805..66e5a45 100644
--- a/python/trisurf/tsmgr.py
+++ b/python/trisurf/tsmgr.py
@@ -1,17 +1,33 @@
 import sys, getopt
 import tabulate
 
+
+def printHelp():
+	print('Python module tsmgr accept following switches:\n')
+	print('tsmgr [-n process number] [-R] [-h] [-r] [-s] [-c comment text] [-a comment text]\n')
+	print('[-n process number]: number of process for which -s -r -c or -a switch apply. Should be placed before any other switch');
+	print('[-R]               : raw output for -s switch');
+	print('[-r]               : run process');
+	print('[-s]               : process status');
+	print('[-c comment text]  : write new comment for process');
+	print('[-a comment text]  : append additional comment for process');
+	print('[-h]               : print help');
+
+
 def start(Runs):
 	argv=sys.argv[1:]
 	processno=0
+	raw=False
 	try:
-		opts, args = getopt.getopt(argv,"a:n:hrsc:")
+		opts, args = getopt.getopt(argv,"Ra:n:hrsc:")
 	except getopt.GetoptError:
-		print('tsmgr [-n process number] [-h] [-r] [-s] [-c comment text] [-a comment text]')
+		printHelp()
 		sys.exit(2)
 	for opt, arg in opts:
-		if opt == '-h':
-			print ('tsmgr [-n process number] [-h] [-r] [-s] [-c comment text] [-a comment text]')
+		if opt == '-R':
+			raw=True
+		elif opt == '-h':
+			printHelp()
 			sys.exit()
 		elif opt == '-r':
 			if processno:
@@ -32,9 +48,11 @@
 				line.insert(0,i)
 				report.append(line)
 				i=i+1
-				#print(reportstr)
-			print ("\n\nTrisurf running processes report\n")
-			print (tabulate.tabulate(report,headers=["Run no.", "Run start time", "ETA", "Status", "PID", "Path", "Comment"], tablefmt='fancy_grid'))
+			if(raw):
+				print(report)
+			else:
+				print ("\n\nTrisurf running processes report\n")
+				print (tabulate.tabulate(report,headers=["Run no.", "Run start time", "ETA", "Status", "PID", "Path", "Comment"], tablefmt='fancy_grid'))
 		elif opt == '-n':
 			processno=int(arg)
 			if processno<1 or processno>len(Runs) :
@@ -50,7 +68,7 @@
 
 			
 		else:
-			print('tsmgr [-n process number] [-h] [-r] [-s] [-c comment text] [-a comment text]')
+			printHelp()
 			sys.exit(2)
 
 

--
Gitblit v1.9.3