# or implied, of GRNET S.A.
import pbs
+from clint.textui import puts, puts_err, colored, progress
def get_command(command):
return pbs.__getattr__(command)
except pbs.CommadNotFount as e:
return find_sbin_command(command, e)
+
+
+def error(msg, new_line=True):
+ puts_err(colored.red("Error: %s\n" % msg), new_line)
+
+
+def warn(msg, new_line=True):
+ puts_err(colored.yellow("Warning: %s" % msg), new_line)
+
+
+def success(msg, new_line=True):
+ puts(colored.green(msg), new_line)
+
+
+def progress_generator(label='', n=100):
+ position = 0
+ for i in progress.bar(range(n), label):
+ if i < position:
+ continue
+ position = yield
+ yield # suppress the StopIteration exception
+
+
+# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :