Read in a text file and display its output in a pager, truncating long lines if they don't fit. Truncated lines can still be accessed by scrolling to the right using the arrow keys. Usage: page_chop
(self, args: list[str])
| 37 | |
| 38 | @cmd2.with_argument_list |
| 39 | def do_page_truncate(self, args: list[str]) -> None: |
| 40 | """Read in a text file and display its output in a pager, truncating long lines if they don't fit. |
| 41 | |
| 42 | Truncated lines can still be accessed by scrolling to the right using the arrow keys. |
| 43 | |
| 44 | Usage: page_chop <file_path> |
| 45 | """ |
| 46 | if not args: |
| 47 | self.perror("page_truncate requires a path to a file as an argument") |
| 48 | return |
| 49 | self.page_file(args[0], chop=True) |
| 50 | |
| 51 | complete_page_truncate = cmd2.Cmd.path_complete |
| 52 |