MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / do_page_truncate

Method do_page_truncate

examples/paged_output.py:39–49  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

page_fileMethod · 0.95
perrorMethod · 0.80

Tested by

no test coverage detected