summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-cli/src/meshbay_cli/commands
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-15 09:33:28 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-15 09:33:28 +0200
commit5044bdfdfffceceecc0d92a776983ad361079839 (patch)
tree4a80ab66ef53f9ba76cdf8db4276dfc07d0fc1f7 /packages/meshbay-cli/src/meshbay_cli/commands
parent1e8eae1f3de765fcd8163716de6e5fe5aab5a034 (diff)
downloadmeshbay-5044bdfdfffceceecc0d92a776983ad361079839.tar.gz
feat(cli): help, and right-click copy and paste in the interactive chat
help prints what --help prints; help ACTION, what ACTION --help prints. In the interactive chat a right-click on the conversation copies the text selected with the mouse, else the line under the pointer: to the terminal (OSC 52) and to the platform's clipboard tool. A right-click on the line written in pastes the system clipboard's text at the cursor, its lines side by side, read with wl-paste, xclip or xsel, pbpaste or PowerShell, else what was copied here last. The conversation is selectable with the mouse, which RichLog alone is not. The deb and rpm packages recommend wl-clipboard or xclip for the paste. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-cli/src/meshbay_cli/commands')
-rw-r--r--packages/meshbay-cli/src/meshbay_cli/commands/help.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/meshbay-cli/src/meshbay_cli/commands/help.py b/packages/meshbay-cli/src/meshbay_cli/commands/help.py
new file mode 100644
index 0000000..6515800
--- /dev/null
+++ b/packages/meshbay-cli/src/meshbay_cli/commands/help.py
@@ -0,0 +1,27 @@
+"""`help`: what `--help` prints, for the program or for one action."""
+
+from ..errors import USAGE, CliError
+from ..output import sentence
+from .context import Context
+
+HELP = "what --help prints: the actions, or one action's options"
+
+
+def add_parser(sub, parent) -> None:
+ p = sub.add_parser("help", parents=[parent], help=HELP, description=sentence(HELP) + ".")
+ p.add_argument("topic", nargs="?", metavar="ACTION", help="the action to explain")
+
+
+async def run(ctx: Context) -> int:
+ from ..__main__ import build_parser
+ parser = build_parser()
+ topic = ctx.args.topic
+ if topic is None:
+ parser.print_help()
+ return 0
+ actions = next(a for a in parser._actions if hasattr(a, "choices") and a.choices
+ and "help" in a.choices).choices
+ if topic not in actions:
+ raise CliError(USAGE, f"No action {topic!r}. The actions: {', '.join(actions)}.")
+ actions[topic].print_help()
+ return 0