diff --git a/gen/go_code.py b/gen/go_code.py index 2a5bfd7f8..cd7dcf268 100755 --- a/gen/go_code.py +++ b/gen/go_code.py @@ -466,7 +466,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() + ('pager',): + for kitten in wrapped_kittens() + ('pager', 'notify',): defn = get_kitten_conf_docs(kitten) if defn is not None: generate_conf_parser(kitten, defn) diff --git a/kittens/notify/__init__.py b/kittens/notify/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/kittens/notify/main.go b/kittens/notify/main.go new file mode 100644 index 000000000..e5073b2fb --- /dev/null +++ b/kittens/notify/main.go @@ -0,0 +1,17 @@ +package notify + +import ( + "fmt" + + "kitty/tools/cli" +) + +var _ = fmt.Print + +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/notify/main.py b/kittens/notify/main.py new file mode 100644 index 000000000..68729d1c3 --- /dev/null +++ b/kittens/notify/main.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# License: GPL v3 Copyright: 2018, Kovid Goyal + +import sys + +OPTIONS = r''' +--identifier -i +The identifier of this notification. If a notification with the same identifier +is already displayed, it is replaced/updated. + + +--wait-till-closed +type=bool-set +Wait until the notification is closed. If the user activates the notification, +"activated" is printed to STDOUT before quitting. +'''.format +help_text = '''\ +Send notifications to the user that are displayed to them via the +desktop environment's notifications service. Works over SSH as well. +''' + +usage = 'TITLE [BODY ...]' +if __name__ == '__main__': + raise SystemExit('This should be run as kitten clipboard') +elif __name__ == '__doc__': + cd = sys.cli_docs # type: ignore + cd['usage'] = usage + cd['options'] = OPTIONS + cd['help_text'] = help_text + cd['short_desc'] = 'Send notifications to the user' diff --git a/tools/cmd/tool/main.go b/tools/cmd/tool/main.go index e5f44ef5c..1fb0839f6 100644 --- a/tools/cmd/tool/main.go +++ b/tools/cmd/tool/main.go @@ -12,6 +12,7 @@ import ( "kitty/kittens/hints" "kitty/kittens/hyperlinked_grep" "kitty/kittens/icat" + "kitty/kittens/notify" "kitty/kittens/query_terminal" "kitty/kittens/show_key" "kitty/kittens/ssh" @@ -70,8 +71,10 @@ func KittyToolEntryPoints(root *cli.Command) { ask.EntryPoint(root) // hints hints.EntryPoint(root) - // hints + // diff diff.EntryPoint(root) + // notify + notify.EntryPoint(root) // themes themes.EntryPoint(root) themes.ParseEntryPoint(root)