main.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env python
  2. # License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
  3. import sys
  4. from kitty.cli import CompletionSpec
  5. OPTIONS = '''
  6. --role
  7. default=pager
  8. choices=pager,scrollback
  9. The role the pager is used for. The default is a standard less like pager.
  10. --follow
  11. type=bool-set
  12. Follow changes in the specified file, automatically scrolling if currently on the last line.
  13. '''.format
  14. help_text = '''\
  15. Display text in a pager with various features such as searching, copy/paste, etc.
  16. Text can some from the specified file or from STDIN. If no filename is specified
  17. and STDIN is not a TTY, it is used.
  18. '''
  19. usage = '[filename]'
  20. def main(args: list[str]) -> None:
  21. raise SystemExit('Must be run as kitten pager')
  22. if __name__ == '__main__':
  23. main(sys.argv)
  24. elif __name__ == '__doc__':
  25. cd = sys.cli_docs # type: ignore
  26. cd['usage'] = usage
  27. cd['options'] = OPTIONS
  28. cd['help_text'] = help_text
  29. cd['short_desc'] = 'Pretty, side-by-side diffing of files and images'
  30. cd['args_completion'] = CompletionSpec.from_string('type:file mime:text/* group:"Text files"')