mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-04-25 12:00:39 +02:00
tools: don't print a carriage return if we're not on a tty
Otherwise redirecting the output to a file leaves us with ugly ^M Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
509747c01b
commit
f22d193879
1 changed files with 4 additions and 1 deletions
|
|
@ -30,6 +30,7 @@
|
|||
# Input is a libinput record yaml file
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
import libevdev
|
||||
|
|
@ -95,6 +96,8 @@ def main(argv):
|
|||
ignored_axes = [libevdev.evbit(axis) for axis in args.ignore.split(",") if axis]
|
||||
only_axes = [libevdev.evbit(axis) for axis in args.only.split(",") if axis]
|
||||
|
||||
cr = "\r" if os.isatty(sys.stdout.fileno()) else ""
|
||||
|
||||
yml = yaml.safe_load(open(args.path[0]))
|
||||
if yml["ndevices"] > 1:
|
||||
print(f"WARNING: Using only first {yml['ndevices']} devices in recording")
|
||||
|
|
@ -182,7 +185,7 @@ def main(argv):
|
|||
print(" | ".join(fields))
|
||||
else:
|
||||
continuation_count += 1
|
||||
print(f"\r ... +{continuation_count}", end="", flush=True)
|
||||
print(f"{cr} ... +{continuation_count}", end="", flush=True)
|
||||
|
||||
# Print out any rel/abs axes that not generate events in
|
||||
# this recording
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue