redirect output to less when pisi-cli used for history
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
# Please read the COPYING file.
|
# Please read the COPYING file.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
import optparse
|
import optparse
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
@@ -70,9 +72,15 @@ Lists previous operations."""
|
|||||||
print " *", pkg
|
print " *", pkg
|
||||||
print
|
print
|
||||||
|
|
||||||
|
def redirect_output(self):
|
||||||
|
if os.isatty(sys.stdout.fileno()):
|
||||||
|
output = os.popen("less","w")
|
||||||
|
sys.stdout = sys.stderr = output
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.init(database = False, write = False)
|
self.init(database = False, write = False)
|
||||||
ctx.set_option('ignore_build_no', True)
|
ctx.set_option('ignore_build_no', True)
|
||||||
|
self.redirect_output()
|
||||||
if ctx.get_option('snapshot'):
|
if ctx.get_option('snapshot'):
|
||||||
self.take_snapshot()
|
self.take_snapshot()
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user