scripts: Adopted height-relative negative values for -n/--lines
This mirrors how -H/--height and -W/--width work, with -n-1 using the terminal height - 1 for the output. This is very useful for carving out space for the shell prompt and other things, without sacrificing automatic sizing.
This commit is contained in:
+28
-12
@@ -92,12 +92,36 @@ class RingIO:
|
|||||||
def __init__(self, maxlen=None, head=False):
|
def __init__(self, maxlen=None, head=False):
|
||||||
self.maxlen = maxlen
|
self.maxlen = maxlen
|
||||||
self.head = head
|
self.head = head
|
||||||
self.lines = co.deque(maxlen=maxlen)
|
self.lines = co.deque(
|
||||||
|
maxlen=max(maxlen, 0) if maxlen is not None else None)
|
||||||
self.tail = io.StringIO()
|
self.tail = io.StringIO()
|
||||||
|
|
||||||
# trigger automatic sizing
|
# trigger automatic sizing
|
||||||
if maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
@property
|
||||||
|
def width(self):
|
||||||
|
# just fetch this on demand, we don't actually use width
|
||||||
|
return shutil.get_terminal_size((80, 5))[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def height(self):
|
||||||
|
# calculate based on terminal height?
|
||||||
|
if self.maxlen is None or self.maxlen <= 0:
|
||||||
|
return max(
|
||||||
|
shutil.get_terminal_size((80, 5))[1]
|
||||||
|
+ (self.maxlen or 0),
|
||||||
|
0)
|
||||||
|
# limit to maxlen
|
||||||
|
else:
|
||||||
|
return self.maxlen
|
||||||
|
|
||||||
|
def resize(self, maxlen):
|
||||||
|
self.maxlen = maxlen
|
||||||
|
if maxlen is not None and maxlen <= 0:
|
||||||
|
maxlen = self.height
|
||||||
|
if maxlen != self.lines.maxlen:
|
||||||
|
self.lines = co.deque(self.lines, maxlen=maxlen)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.lines)
|
return len(self.lines)
|
||||||
@@ -116,18 +140,10 @@ class RingIO:
|
|||||||
if lines[-1]:
|
if lines[-1]:
|
||||||
self.tail.write(lines[-1])
|
self.tail.write(lines[-1])
|
||||||
|
|
||||||
def resize(self, maxlen):
|
|
||||||
self.maxlen = maxlen
|
|
||||||
if maxlen == 0:
|
|
||||||
maxlen = shutil.get_terminal_size((80, 5))[1]
|
|
||||||
if maxlen != self.lines.maxlen:
|
|
||||||
self.lines = co.deque(self.lines, maxlen=maxlen)
|
|
||||||
|
|
||||||
canvas_lines = 1
|
canvas_lines = 1
|
||||||
def draw(self):
|
def draw(self):
|
||||||
# did terminal size change?
|
# did terminal size change?
|
||||||
if self.maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
|
||||||
# copy lines
|
# copy lines
|
||||||
lines = self.lines.copy()
|
lines = self.lines.copy()
|
||||||
|
|||||||
+29
-14
@@ -3645,17 +3645,40 @@ else:
|
|||||||
else:
|
else:
|
||||||
self.add_watch(path, flags)
|
self.add_watch(path, flags)
|
||||||
|
|
||||||
# TODO negative maxlen from terminal height? like -H nowadays?
|
|
||||||
class RingIO:
|
class RingIO:
|
||||||
def __init__(self, maxlen=None, head=False):
|
def __init__(self, maxlen=None, head=False):
|
||||||
self.maxlen = maxlen
|
self.maxlen = maxlen
|
||||||
self.head = head
|
self.head = head
|
||||||
self.lines = co.deque(maxlen=maxlen)
|
self.lines = co.deque(
|
||||||
|
maxlen=max(maxlen, 0) if maxlen is not None else None)
|
||||||
self.tail = io.StringIO()
|
self.tail = io.StringIO()
|
||||||
|
|
||||||
# trigger automatic sizing
|
# trigger automatic sizing
|
||||||
if maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
@property
|
||||||
|
def width(self):
|
||||||
|
# just fetch this on demand, we don't actually use width
|
||||||
|
return shutil.get_terminal_size((80, 5))[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def height(self):
|
||||||
|
# calculate based on terminal height?
|
||||||
|
if self.maxlen is None or self.maxlen <= 0:
|
||||||
|
return max(
|
||||||
|
shutil.get_terminal_size((80, 5))[1]
|
||||||
|
+ (self.maxlen or 0),
|
||||||
|
0)
|
||||||
|
# limit to maxlen
|
||||||
|
else:
|
||||||
|
return self.maxlen
|
||||||
|
|
||||||
|
def resize(self, maxlen):
|
||||||
|
self.maxlen = maxlen
|
||||||
|
if maxlen is not None and maxlen <= 0:
|
||||||
|
maxlen = self.height
|
||||||
|
if maxlen != self.lines.maxlen:
|
||||||
|
self.lines = co.deque(self.lines, maxlen=maxlen)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.lines)
|
return len(self.lines)
|
||||||
@@ -3674,18 +3697,10 @@ class RingIO:
|
|||||||
if lines[-1]:
|
if lines[-1]:
|
||||||
self.tail.write(lines[-1])
|
self.tail.write(lines[-1])
|
||||||
|
|
||||||
def resize(self, maxlen):
|
|
||||||
self.maxlen = maxlen
|
|
||||||
if maxlen == 0:
|
|
||||||
maxlen = shutil.get_terminal_size((80, 5))[1]
|
|
||||||
if maxlen != self.lines.maxlen:
|
|
||||||
self.lines = co.deque(self.lines, maxlen=maxlen)
|
|
||||||
|
|
||||||
canvas_lines = 1
|
canvas_lines = 1
|
||||||
def draw(self):
|
def draw(self):
|
||||||
# did terminal size change?
|
# did terminal size change?
|
||||||
if self.maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
|
||||||
# copy lines
|
# copy lines
|
||||||
lines = self.lines.copy()
|
lines = self.lines.copy()
|
||||||
@@ -5030,7 +5045,7 @@ if __name__ == "__main__":
|
|||||||
nargs='?',
|
nargs='?',
|
||||||
type=lambda x: int(x, 0),
|
type=lambda x: int(x, 0),
|
||||||
const=0,
|
const=0,
|
||||||
help="Show this many lines of history. 0 uses the terminal "
|
help="Show this many lines of history. <=0 uses the terminal "
|
||||||
"height. Defaults to 1.")
|
"height. Defaults to 1.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-^', '--head',
|
'-^', '--head',
|
||||||
|
|||||||
+28
-12
@@ -175,12 +175,36 @@ class RingIO:
|
|||||||
def __init__(self, maxlen=None, head=False):
|
def __init__(self, maxlen=None, head=False):
|
||||||
self.maxlen = maxlen
|
self.maxlen = maxlen
|
||||||
self.head = head
|
self.head = head
|
||||||
self.lines = co.deque(maxlen=maxlen)
|
self.lines = co.deque(
|
||||||
|
maxlen=max(maxlen, 0) if maxlen is not None else None)
|
||||||
self.tail = io.StringIO()
|
self.tail = io.StringIO()
|
||||||
|
|
||||||
# trigger automatic sizing
|
# trigger automatic sizing
|
||||||
if maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
@property
|
||||||
|
def width(self):
|
||||||
|
# just fetch this on demand, we don't actually use width
|
||||||
|
return shutil.get_terminal_size((80, 5))[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def height(self):
|
||||||
|
# calculate based on terminal height?
|
||||||
|
if self.maxlen is None or self.maxlen <= 0:
|
||||||
|
return max(
|
||||||
|
shutil.get_terminal_size((80, 5))[1]
|
||||||
|
+ (self.maxlen or 0),
|
||||||
|
0)
|
||||||
|
# limit to maxlen
|
||||||
|
else:
|
||||||
|
return self.maxlen
|
||||||
|
|
||||||
|
def resize(self, maxlen):
|
||||||
|
self.maxlen = maxlen
|
||||||
|
if maxlen is not None and maxlen <= 0:
|
||||||
|
maxlen = self.height
|
||||||
|
if maxlen != self.lines.maxlen:
|
||||||
|
self.lines = co.deque(self.lines, maxlen=maxlen)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.lines)
|
return len(self.lines)
|
||||||
@@ -199,18 +223,10 @@ class RingIO:
|
|||||||
if lines[-1]:
|
if lines[-1]:
|
||||||
self.tail.write(lines[-1])
|
self.tail.write(lines[-1])
|
||||||
|
|
||||||
def resize(self, maxlen):
|
|
||||||
self.maxlen = maxlen
|
|
||||||
if maxlen == 0:
|
|
||||||
maxlen = shutil.get_terminal_size((80, 5))[1]
|
|
||||||
if maxlen != self.lines.maxlen:
|
|
||||||
self.lines = co.deque(self.lines, maxlen=maxlen)
|
|
||||||
|
|
||||||
canvas_lines = 1
|
canvas_lines = 1
|
||||||
def draw(self):
|
def draw(self):
|
||||||
# did terminal size change?
|
# did terminal size change?
|
||||||
if self.maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
|
||||||
# copy lines
|
# copy lines
|
||||||
lines = self.lines.copy()
|
lines = self.lines.copy()
|
||||||
|
|||||||
+29
-13
@@ -38,12 +38,36 @@ class RingIO:
|
|||||||
def __init__(self, maxlen=None, head=False):
|
def __init__(self, maxlen=None, head=False):
|
||||||
self.maxlen = maxlen
|
self.maxlen = maxlen
|
||||||
self.head = head
|
self.head = head
|
||||||
self.lines = co.deque(maxlen=maxlen)
|
self.lines = co.deque(
|
||||||
|
maxlen=max(maxlen, 0) if maxlen is not None else None)
|
||||||
self.tail = io.StringIO()
|
self.tail = io.StringIO()
|
||||||
|
|
||||||
# trigger automatic sizing
|
# trigger automatic sizing
|
||||||
if maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
@property
|
||||||
|
def width(self):
|
||||||
|
# just fetch this on demand, we don't actually use width
|
||||||
|
return shutil.get_terminal_size((80, 5))[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def height(self):
|
||||||
|
# calculate based on terminal height?
|
||||||
|
if self.maxlen is None or self.maxlen <= 0:
|
||||||
|
return max(
|
||||||
|
shutil.get_terminal_size((80, 5))[1]
|
||||||
|
+ (self.maxlen or 0),
|
||||||
|
0)
|
||||||
|
# limit to maxlen
|
||||||
|
else:
|
||||||
|
return self.maxlen
|
||||||
|
|
||||||
|
def resize(self, maxlen):
|
||||||
|
self.maxlen = maxlen
|
||||||
|
if maxlen is not None and maxlen <= 0:
|
||||||
|
maxlen = self.height
|
||||||
|
if maxlen != self.lines.maxlen:
|
||||||
|
self.lines = co.deque(self.lines, maxlen=maxlen)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.lines)
|
return len(self.lines)
|
||||||
@@ -62,18 +86,10 @@ class RingIO:
|
|||||||
if lines[-1]:
|
if lines[-1]:
|
||||||
self.tail.write(lines[-1])
|
self.tail.write(lines[-1])
|
||||||
|
|
||||||
def resize(self, maxlen):
|
|
||||||
self.maxlen = maxlen
|
|
||||||
if maxlen == 0:
|
|
||||||
maxlen = shutil.get_terminal_size((80, 5))[1]
|
|
||||||
if maxlen != self.lines.maxlen:
|
|
||||||
self.lines = co.deque(self.lines, maxlen=maxlen)
|
|
||||||
|
|
||||||
canvas_lines = 1
|
canvas_lines = 1
|
||||||
def draw(self):
|
def draw(self):
|
||||||
# did terminal size change?
|
# did terminal size change?
|
||||||
if self.maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
|
||||||
# copy lines
|
# copy lines
|
||||||
lines = self.lines.copy()
|
lines = self.lines.copy()
|
||||||
@@ -191,7 +207,7 @@ if __name__ == "__main__":
|
|||||||
nargs='?',
|
nargs='?',
|
||||||
type=lambda x: int(x, 0),
|
type=lambda x: int(x, 0),
|
||||||
const=0,
|
const=0,
|
||||||
help="Show this many lines of history. 0 uses the terminal "
|
help="Show this many lines of history. <=0 uses the terminal "
|
||||||
"height. Defaults to 5.")
|
"height. Defaults to 5.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-c', '--cat',
|
'-c', '--cat',
|
||||||
|
|||||||
+29
-14
@@ -145,17 +145,40 @@ def rbydaddr(s):
|
|||||||
return tuple(addr)
|
return tuple(addr)
|
||||||
|
|
||||||
|
|
||||||
# TODO negative maxlen from terminal height? like -H nowadays?
|
|
||||||
class RingIO:
|
class RingIO:
|
||||||
def __init__(self, maxlen=None, head=False):
|
def __init__(self, maxlen=None, head=False):
|
||||||
self.maxlen = maxlen
|
self.maxlen = maxlen
|
||||||
self.head = head
|
self.head = head
|
||||||
self.lines = co.deque(maxlen=maxlen)
|
self.lines = co.deque(
|
||||||
|
maxlen=max(maxlen, 0) if maxlen is not None else None)
|
||||||
self.tail = io.StringIO()
|
self.tail = io.StringIO()
|
||||||
|
|
||||||
# trigger automatic sizing
|
# trigger automatic sizing
|
||||||
if maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
@property
|
||||||
|
def width(self):
|
||||||
|
# just fetch this on demand, we don't actually use width
|
||||||
|
return shutil.get_terminal_size((80, 5))[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def height(self):
|
||||||
|
# calculate based on terminal height?
|
||||||
|
if self.maxlen is None or self.maxlen <= 0:
|
||||||
|
return max(
|
||||||
|
shutil.get_terminal_size((80, 5))[1]
|
||||||
|
+ (self.maxlen or 0),
|
||||||
|
0)
|
||||||
|
# limit to maxlen
|
||||||
|
else:
|
||||||
|
return self.maxlen
|
||||||
|
|
||||||
|
def resize(self, maxlen):
|
||||||
|
self.maxlen = maxlen
|
||||||
|
if maxlen is not None and maxlen <= 0:
|
||||||
|
maxlen = self.height
|
||||||
|
if maxlen != self.lines.maxlen:
|
||||||
|
self.lines = co.deque(self.lines, maxlen=maxlen)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.lines)
|
return len(self.lines)
|
||||||
@@ -174,18 +197,10 @@ class RingIO:
|
|||||||
if lines[-1]:
|
if lines[-1]:
|
||||||
self.tail.write(lines[-1])
|
self.tail.write(lines[-1])
|
||||||
|
|
||||||
def resize(self, maxlen):
|
|
||||||
self.maxlen = maxlen
|
|
||||||
if maxlen == 0:
|
|
||||||
maxlen = shutil.get_terminal_size((80, 5))[1]
|
|
||||||
if maxlen != self.lines.maxlen:
|
|
||||||
self.lines = co.deque(self.lines, maxlen=maxlen)
|
|
||||||
|
|
||||||
canvas_lines = 1
|
canvas_lines = 1
|
||||||
def draw(self):
|
def draw(self):
|
||||||
# did terminal size change?
|
# did terminal size change?
|
||||||
if self.maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
|
||||||
# copy lines
|
# copy lines
|
||||||
lines = self.lines.copy()
|
lines = self.lines.copy()
|
||||||
@@ -2764,7 +2779,7 @@ if __name__ == "__main__":
|
|||||||
nargs='?',
|
nargs='?',
|
||||||
type=lambda x: int(x, 0),
|
type=lambda x: int(x, 0),
|
||||||
const=0,
|
const=0,
|
||||||
help="Show this many lines of history. 0 uses the terminal "
|
help="Show this many lines of history. <=0 uses the terminal "
|
||||||
"height. Defaults to 1.")
|
"height. Defaults to 1.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-^', '--head',
|
'-^', '--head',
|
||||||
|
|||||||
+28
-12
@@ -85,12 +85,36 @@ class RingIO:
|
|||||||
def __init__(self, maxlen=None, head=False):
|
def __init__(self, maxlen=None, head=False):
|
||||||
self.maxlen = maxlen
|
self.maxlen = maxlen
|
||||||
self.head = head
|
self.head = head
|
||||||
self.lines = co.deque(maxlen=maxlen)
|
self.lines = co.deque(
|
||||||
|
maxlen=max(maxlen, 0) if maxlen is not None else None)
|
||||||
self.tail = io.StringIO()
|
self.tail = io.StringIO()
|
||||||
|
|
||||||
# trigger automatic sizing
|
# trigger automatic sizing
|
||||||
if maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
@property
|
||||||
|
def width(self):
|
||||||
|
# just fetch this on demand, we don't actually use width
|
||||||
|
return shutil.get_terminal_size((80, 5))[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def height(self):
|
||||||
|
# calculate based on terminal height?
|
||||||
|
if self.maxlen is None or self.maxlen <= 0:
|
||||||
|
return max(
|
||||||
|
shutil.get_terminal_size((80, 5))[1]
|
||||||
|
+ (self.maxlen or 0),
|
||||||
|
0)
|
||||||
|
# limit to maxlen
|
||||||
|
else:
|
||||||
|
return self.maxlen
|
||||||
|
|
||||||
|
def resize(self, maxlen):
|
||||||
|
self.maxlen = maxlen
|
||||||
|
if maxlen is not None and maxlen <= 0:
|
||||||
|
maxlen = self.height
|
||||||
|
if maxlen != self.lines.maxlen:
|
||||||
|
self.lines = co.deque(self.lines, maxlen=maxlen)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.lines)
|
return len(self.lines)
|
||||||
@@ -109,18 +133,10 @@ class RingIO:
|
|||||||
if lines[-1]:
|
if lines[-1]:
|
||||||
self.tail.write(lines[-1])
|
self.tail.write(lines[-1])
|
||||||
|
|
||||||
def resize(self, maxlen):
|
|
||||||
self.maxlen = maxlen
|
|
||||||
if maxlen == 0:
|
|
||||||
maxlen = shutil.get_terminal_size((80, 5))[1]
|
|
||||||
if maxlen != self.lines.maxlen:
|
|
||||||
self.lines = co.deque(self.lines, maxlen=maxlen)
|
|
||||||
|
|
||||||
canvas_lines = 1
|
canvas_lines = 1
|
||||||
def draw(self):
|
def draw(self):
|
||||||
# did terminal size change?
|
# did terminal size change?
|
||||||
if self.maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
|
||||||
# copy lines
|
# copy lines
|
||||||
lines = self.lines.copy()
|
lines = self.lines.copy()
|
||||||
|
|||||||
+37
-19
@@ -76,12 +76,36 @@ class RingIO:
|
|||||||
def __init__(self, maxlen=None, head=False):
|
def __init__(self, maxlen=None, head=False):
|
||||||
self.maxlen = maxlen
|
self.maxlen = maxlen
|
||||||
self.head = head
|
self.head = head
|
||||||
self.lines = co.deque(maxlen=maxlen)
|
self.lines = co.deque(
|
||||||
|
maxlen=max(maxlen, 0) if maxlen is not None else None)
|
||||||
self.tail = io.StringIO()
|
self.tail = io.StringIO()
|
||||||
|
|
||||||
# trigger automatic sizing
|
# trigger automatic sizing
|
||||||
if maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
@property
|
||||||
|
def width(self):
|
||||||
|
# just fetch this on demand, we don't actually use width
|
||||||
|
return shutil.get_terminal_size((80, 5))[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def height(self):
|
||||||
|
# calculate based on terminal height?
|
||||||
|
if self.maxlen is None or self.maxlen <= 0:
|
||||||
|
return max(
|
||||||
|
shutil.get_terminal_size((80, 5))[1]
|
||||||
|
+ (self.maxlen or 0),
|
||||||
|
0)
|
||||||
|
# limit to maxlen
|
||||||
|
else:
|
||||||
|
return self.maxlen
|
||||||
|
|
||||||
|
def resize(self, maxlen):
|
||||||
|
self.maxlen = maxlen
|
||||||
|
if maxlen is not None and maxlen <= 0:
|
||||||
|
maxlen = self.height
|
||||||
|
if maxlen != self.lines.maxlen:
|
||||||
|
self.lines = co.deque(self.lines, maxlen=maxlen)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.lines)
|
return len(self.lines)
|
||||||
@@ -100,18 +124,10 @@ class RingIO:
|
|||||||
if lines[-1]:
|
if lines[-1]:
|
||||||
self.tail.write(lines[-1])
|
self.tail.write(lines[-1])
|
||||||
|
|
||||||
def resize(self, maxlen):
|
|
||||||
self.maxlen = maxlen
|
|
||||||
if maxlen == 0:
|
|
||||||
maxlen = shutil.get_terminal_size((80, 5))[1]
|
|
||||||
if maxlen != self.lines.maxlen:
|
|
||||||
self.lines = co.deque(self.lines, maxlen=maxlen)
|
|
||||||
|
|
||||||
canvas_lines = 1
|
canvas_lines = 1
|
||||||
def draw(self):
|
def draw(self):
|
||||||
# did terminal size change?
|
# did terminal size change?
|
||||||
if self.maxlen == 0:
|
self.resize(self.maxlen)
|
||||||
self.resize(0)
|
|
||||||
|
|
||||||
# copy lines
|
# copy lines
|
||||||
lines = self.lines.copy()
|
lines = self.lines.copy()
|
||||||
@@ -200,9 +216,10 @@ def main(command, *,
|
|||||||
mpty, spty = pty.openpty()
|
mpty, spty = pty.openpty()
|
||||||
|
|
||||||
# forward terminal size
|
# forward terminal size
|
||||||
w, h = shutil.get_terminal_size((80, 5))
|
if cat:
|
||||||
if lines:
|
w, h = shutil.get_terminal_size((80, 5))
|
||||||
h = lines
|
else:
|
||||||
|
w, h = ring.width, ring.height
|
||||||
fcntl.ioctl(spty, termios.TIOCSWINSZ,
|
fcntl.ioctl(spty, termios.TIOCSWINSZ,
|
||||||
struct.pack('HHHH', h, w, 0, 0))
|
struct.pack('HHHH', h, w, 0, 0))
|
||||||
|
|
||||||
@@ -278,7 +295,7 @@ if __name__ == "__main__":
|
|||||||
nargs='?',
|
nargs='?',
|
||||||
type=lambda x: int(x, 0),
|
type=lambda x: int(x, 0),
|
||||||
const=0,
|
const=0,
|
||||||
help="Show this many lines of history. 0 uses the terminal "
|
help="Show this many lines of history. <=0 uses the terminal "
|
||||||
"height. Defaults to 0.")
|
"height. Defaults to 0.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-^', '--head',
|
'-^', '--head',
|
||||||
@@ -295,13 +312,14 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-k', '--keep-open',
|
'-k', '--keep-open',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Try to use inotify to wait for changes.")
|
help="Try to use inotify to wait for changes. Defaults to "
|
||||||
|
"guessing, or explicit paths can be provided with "
|
||||||
|
"-K/--keep-open-path.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-K', '--keep-open-path',
|
'-K', '--keep-open-path',
|
||||||
dest='keep_open_paths',
|
dest='keep_open_paths',
|
||||||
action='append',
|
action='append',
|
||||||
help="Use this path for inotify. Defaults to guessing. Implies "
|
help="Use this path for inotify. Implies --keep-open.")
|
||||||
"--keep-open.")
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-b', '--buffer',
|
'-b', '--buffer',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|||||||
Reference in New Issue
Block a user