main.py 1.1 KB

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