From 1ac65fdbc8159bd973e9b50444ea111079333a96 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 13 Nov 2024 02:43:48 +0000 Subject: [PATCH] Fix the notice screen Signed-off-by: Ethan Lee --- src/fosslight_binary/cli.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/fosslight_binary/cli.py b/src/fosslight_binary/cli.py index 11301e3..2c58fc2 100644 --- a/src/fosslight_binary/cli.py +++ b/src/fosslight_binary/cli.py @@ -14,6 +14,23 @@ _PKG_NAME = "fosslight_binary" +def get_terminal_size(): + size = shutil.get_terminal_size() + return size.lines + + +def paginate_file(file_path): #, lines_per_page=25): + lines_per_page = get_terminal_size() - 1 + with open(file_path, 'r') as file: + lines = file.readlines() + + for i in range(0, len(lines), lines_per_page): + os.system('clear' if os.name == 'posix' else 'cls') + print(''.join(lines[i: i + lines_per_page])) + if i + lines_per_page < len(lines): + input("Press Enter to see the next page...") + + def main(): global windows path_to_find_bin = ""