This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch quick-fix/tui-tape-guide-link in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1b05f8772f189b098d8ccff6792cefcef9838718 Author: Claus Ibsen <[email protected]> AuthorDate: Sat Oct 10 16:19:17 2026 +0200 chore: camel-jbang - the tape recording guide in the actions menu links to the online documentation Keeps the three steps (record, play with --record, convert with agg) and links to the Screenshots and Demo Recordings page for the tape commands, so the two do not drift apart. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../jbang/core/commands/tui/DocViewerPopup.java | 46 ++++++++++---------- .../tui/DocViewerPopupTapeInstructionsTest.java | 49 ++++++++++++++++++++++ 2 files changed, 72 insertions(+), 23 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DocViewerPopup.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DocViewerPopup.java index a29c9497ba10..8183cdd16b8e 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DocViewerPopup.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DocViewerPopup.java @@ -54,6 +54,9 @@ import static org.apache.camel.dsl.jbang.core.commands.tui.TuiHelper.hintLast; class DocViewerPopup { + /** The documentation of screenshots and demo recordings, with all the tape commands. */ + static final String RECORDING_DOCS_URL = "https://camel.apache.org/manual/camel-jbang-tui-recording.html"; + private boolean showViewer; private boolean showPicker; private String docContent; @@ -364,29 +367,26 @@ class DocViewerPopup { // --- Content generators --- void openTapeInstructions() { - openMarkdown("Tape Recording Guide", - "# Tape Recording Guide\n\n" - + "Record your live TUI session as a `.tape` file that captures keystrokes\n" - + "with timing. The tape can be replayed inside the TUI to produce\n" - + "an Asciinema `.cast` recording.\n\n" - + "## Starting and Stopping\n\n" - + "- Use the **F2** actions menu → Start/Stop Tape Recording\n\n" - + "When recording stops, the tape is saved to the current directory as\n" - + "`camel-tui-tape-<timestamp>.tape`.\n\n" - + "## Replaying a Tape\n\n" - + "Replay the tape inside the TUI with the `--record` option:\n\n" - + " camel tui monitor --record=camel-tui-tape-20260525-153000.tape\n\n" - + "This replays the keystrokes inside the live TUI and produces\n" - + "an Asciinema `.cast` file.\n\n" - + "## Converting to Animated GIF\n\n" - + "Use `agg` to convert the `.cast` file to an animated GIF:\n\n" - + " brew install asciinema/tap/agg\n" - + " agg recording.cast demo.gif\n\n" - + "Or upload to [asciinema.org](https://asciinema.org) for a shareable link.\n\n" - + "## Tips\n\n" - + "- Tape recording toggle is not captured in the tape, keeping the script clean\n" - + "- Natural pauses between keystrokes are preserved as `Sleep` commands\n" - + "- Keep recordings focused — one workflow at a time works best\n"); + openMarkdown("Tape Recording Guide", tapeInstructions()); + } + + /** + * The steps of recording a demo. The tape commands, an example tape and the tips are in the online documentation, + * which the guide links to with its address in sight, for terminals that do not open links. + */ + static String tapeInstructions() { + return "# Tape Recording Guide\n\n" + + "Record a session as a `.tape` file and turn it into an animated GIF.\n\n" + + "**1.** Use **F2** → Start Tape Recording, show what you want, then **F2** → Stop Tape Recording. " + + "The tape is saved in the current directory as `camel-tui-tape-<timestamp>.tape`.\n\n" + + "**2.** Play the tape in the TUI and record it to an Asciinema `.cast` file next to the tape:\n\n" + + "```\ncamel tui <name> --record=<file>.tape --record-size=120x32\n```\n\n" + + "**3.** Convert the recording to a GIF with agg (<https://github.com/asciinema/agg>):\n\n" + + "```\nagg <file>.cast demo.gif\n```\n\n" + + "A tape can also be written by hand or by an AI agent, with commands for captions, highlights, " + + "tabs and themes. The tape commands, an example tape and tips are in the Camel documentation, " + + "Screenshots and Demo Recordings:\n\n" + + "<" + RECORDING_DOCS_URL + ">\n"; } void openSetupAI() { diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/DocViewerPopupTapeInstructionsTest.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/DocViewerPopupTapeInstructionsTest.java new file mode 100644 index 000000000000..6e2ce7b1ab99 --- /dev/null +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/DocViewerPopupTapeInstructionsTest.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dsl.jbang.core.commands.tui; + +import java.util.HashSet; +import java.util.Set; + +import dev.tamboui.buffer.Buffer; +import dev.tamboui.layout.Rect; +import dev.tamboui.markdown.MarkdownView; +import dev.tamboui.style.Hyperlink; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +class DocViewerPopupTapeInstructionsTest { + + @Test + void showsTheAddressOfTheDocumentationAndLinksToIt() { + Buffer buffer = Buffer.empty(new Rect(0, 0, 100, 40)); + MarkdownView.builder().source(DocViewerPopup.tapeInstructions()).build().render(buffer.area(), buffer); + + assertThat(TapePlayer.screenText(buffer)) + .contains(DocViewerPopup.RECORDING_DOCS_URL) + .contains("camel tui <name> --record=<file>.tape") + .contains("agg <file>.cast demo.gif"); + Set<String> links = new HashSet<>(); + for (int y = 0; y < 40; y++) { + for (int x = 0; x < 100; x++) { + buffer.get(x, y).style().hyperlink().map(Hyperlink::url).ifPresent(links::add); + } + } + assertThat(links).contains(DocViewerPopup.RECORDING_DOCS_URL); + } +}
