diff --git a/gen/go_code.py b/gen/go_code.py index 6ef002120..5e5b7c4d8 100755 --- a/gen/go_code.py +++ b/gen/go_code.py @@ -428,7 +428,7 @@ def go_code_for_remote_command(name: str, cmd: RemoteCommand, template: str) -> # kittens {{{ @lru_cache -def wrapped_kittens() -> Sequence[str]: +def wrapped_kittens() -> Tuple[str, ...]: with open('shell-integration/ssh/kitty') as f: for line in f: if line.startswith(' wrapped_kittens="'): @@ -465,7 +465,7 @@ def generate_extra_cli_parser(name: str, spec: str) -> None: def kitten_clis() -> None: from kittens.runner import get_kitten_conf_docs, get_kitten_extra_cli_parsers - for kitten in wrapped_kittens(): + for kitten in wrapped_kittens() + ('pager',): defn = get_kitten_conf_docs(kitten) if defn is not None: generate_conf_parser(kitten, defn) diff --git a/kittens/pager/main.go b/kittens/pager/main.go new file mode 100644 index 000000000..7535d6ac5 --- /dev/null +++ b/kittens/pager/main.go @@ -0,0 +1,32 @@ +// License: GPLv3 Copyright: 2024, Kovid Goyal, + +package pager + +// TODO: +// Scroll to line when starting +// Visual mode elect with copy/paste and copy-on-select +// Mouse based wheel scroll, drag to select, drag scroll, double click to select +// Hyperlinks: Clicking should delegate to terminal and also allow user to specify action +// Keyboard hints mode for clicking hyperlinks +// Display images when used as scrollback pager +// automatic follow when input is a pipe/tty and on last line like tail -f +// syntax highlighting using chroma + +import ( + "fmt" + + "kitty/tools/cli" + "kitty/tools/tty" +) + +var _ = fmt.Print +var debugprintln = tty.DebugPrintln +var _ = debugprintln + +func main(_ *cli.Command, opts_ *Options, args []string) (rc int, err error) { + return +} + +func EntryPoint(parent *cli.Command) { + create_cmd(parent, main) +} diff --git a/kittens/pager/main.py b/kittens/pager/main.py new file mode 100644 index 000000000..aa2772552 --- /dev/null +++ b/kittens/pager/main.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# License: GPLv3 Copyright: 2024, Kovid Goyal + + +import sys +from typing import List + +from kitty.cli import CompletionSpec + +OPTIONS = ''' +--role +default=pager +choices=pager,scrollback +The role the pager is used for. The default is a standard less like pager. +'''.format + +help_text = 'Display text in a pager with various features such as searching, copy/paste, etc. Text can some from the specified file or from STDIN.' +usage = '[filename]' + + +def main(args: List[str]) -> None: + raise SystemExit('Must be run as kitten pager') + + +if __name__ == '__main__': + main(sys.argv) +elif __name__ == '__doc__': + cd = sys.cli_docs # type: ignore + cd['usage'] = usage + cd['options'] = OPTIONS + cd['help_text'] = help_text + cd['short_desc'] = 'Pretty, side-by-side diffing of files and images' + cd['args_completion'] = CompletionSpec.from_string('type:file mime:text/* group:"Text files"')