Skip to content
Snippets Groups Projects
Commit 4a847a98 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Add a new clear method in the Output class

In the cli output classes this method will clear terminal screen if
the standard output is a terminal.
parent 5f7e1e0c
No related branches found
No related tags found
No related merge requests found
......@@ -177,7 +177,7 @@ def extract_image(session):
device.out = out
image_os.out = out
out.output()
out.clear()
#Sysprep
device.mount(False)
......
......@@ -48,6 +48,9 @@ class Output(object):
def cleanup(self):
pass
def clear(self):
pass
def _get_progress(self):
progress = self._Progress
progress.output = self
......
......@@ -58,6 +58,12 @@ def success(msg, new_line=True, colored=True):
output(msg, new_line, color)
def clear():
#clear the page
if sys.stderr.isatty():
sys.stderr.write('\033[H\033[2J')
class SilentOutput(Output):
pass
......@@ -78,6 +84,9 @@ class SimpleOutput(Output):
def output(self, msg='', new_line=True):
output(msg, new_line)
def clear(self):
clear()
class OutputWthProgress(SimpleOutput):
class _Progress(Bar):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment