-
Notifications
You must be signed in to change notification settings - Fork 1
migrate #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
migrate #23
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
af6a28d
new file: interface/info_box.conf
Tearran d1eb2fe
renamed: interface/info_box.conf -> staging/interface/info_box.conf
Tearran 9ca42ea
modified: staging/interface/info_box.conf
Tearran 9f9ae0e
modified: staging/interface/info_box.conf
Tearran 14b4a77
modified: staging/interface/info_box.sh
Tearran 6cf51d7
modified: staging/interface/info_box.sh
Tearran 627938b
modified: src/initialize/debug.conf
Tearran 65a0fe8
fix name
Tearran 27f8879
modified: staging/interface/info_box.sh
Tearran 292fad2
Update staging/interface/info_box.sh
Tearran 3c5049e
Update staging/interface/info_box.sh
Tearran 9c0fc08
fix help message
Tearran a35e751
deleted: templates/doc_templates.md
Tearran 374e746
Update staging/interface/info_box.sh
Tearran 8e8c671
deleted: staging/interface/info_box.conf
Tearran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [interface_info_box] | ||
| description=Display a rolling info box with dialog/whiptail; reads and shows lines from stdin or a single message. | ||
| extend_desc=This helper provides a live-updating infobox for progress or log output in TUI (dialog/whiptail). When piped, shows the last N lines as they arrive. If called with an argument, displays it as a static message. Useful for monitoring, user feedback, or background task reporting in config-v3. | ||
| documents=false | ||
| options=[message] | (via stdin/pipe) | ||
| parent=framework | ||
| group=helpers | ||
| contributor=Tearran | ||
| maintainer=true | ||
| arch=arm64 armhf x86-64 | ||
| require_os=Debian Ubuntu Armbian | ||
| require_kernel=5.15+ | ||
| port=false | ||
|
|
||
|
|
||
| [_about_interface_info_box] | ||
| description=Display usage and about information for the interface_info_box helper. | ||
| extend_disc=Provides concise usage instructions and example commands for the interface_info_box module. Intended for internal and help display use only. | ||
| documents=false | ||
| options= | ||
| parent=framework | ||
| group=helpers | ||
| contributor=Tearran | ||
| maintainer=true | ||
| arch=arm64 armhf x86-64 | ||
| require_os=Debian Ubuntu Armbian | ||
| require_kernel=5.15+ | ||
| port=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| _about_interface_info_box() { | ||
| cat <<EOF | ||
| Usage: interface_info_box | ||
|
|
||
| Displays a rolling info box using dialog/whiptail. | ||
| Reads lines from stdin and displays them live. | ||
| If not used with a pipe, shows a single message. | ||
|
|
||
| Examples: | ||
| some_command | interface_info_box | ||
| echo "Hello" | interface_info_box | ||
| interface_info_box -h|--help|help | ||
| EOF | ||
| } | ||
|
|
||
| interface_info_box() { | ||
| # Help flag: show about if -h or --help is the first argument | ||
| case "${1:-}" in | ||
| -h|--help|help) | ||
| _about_interface_info_box | ||
| return 0 | ||
| ;; | ||
| esac | ||
|
|
||
| local input | ||
| local dialog="${DIALOG:-}" | ||
| if [[ "$dialog" != "dialog" && "$dialog" != "whiptail" ]]; then | ||
| dialog="whiptail" | ||
| fi | ||
| local title="${TITLE:-Info}" | ||
| local -a buffer | ||
| local lines=16 width=90 max_lines=18 | ||
Tearran marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if [ -p /dev/stdin ]; then | ||
| while IFS= read -r line; do | ||
| buffer+=("$line") | ||
| # Limit buffer size to max_lines | ||
| ((${#buffer[@]} > max_lines)) && buffer=("${buffer[@]:1}") | ||
| # Show buffer in infobox | ||
| TERM=ansi $dialog --title "$title" --infobox "$(printf "%s\n" "${buffer[@]}")" $lines $width | ||
| sleep 0.5 | ||
| done | ||
| else | ||
| input="${1:-}" | ||
| if [[ -z "$input" ]]; then | ||
| echo "Error: No input provided." >&2 | ||
| _about_interface_info_box | ||
| return 1 | ||
| fi | ||
| TERM=ansi $dialog --title "$title" --infobox "$input" 6 80 | ||
| sleep 2 | ||
| fi | ||
| echo -ne '\033[3J' # clear the screen | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| [interface_message] | ||
| feature=interface_message | ||
| description=Displays a message to the user using the configured dialog tool. | ||
| extend_disc=Reads input text (either from standard input or as an argument) and presents it to the user with the selected dialog frontend. Supports dialog, whiptail, or plain read/echo. Handles input flexibly and routes output appropriately depending on the tool. | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| extend_docs=false | ||
| options=<message> | ||
| parent=framework | ||
| group=helpers | ||
| contributor=Tearran | ||
| maintainer=true | ||
| arch=arm64 armhf x86-64 | ||
| require_os=Debian Ubuntu Armbian | ||
| require_kernel=5.15+ | ||
| port=false | ||
|
|
||
| [_about_interface_message] | ||
| feature=_about_interface_message | ||
| description=Show help and usage information for the interface_message helper. | ||
| extend_disc=Outputs usage, available options, and example commands for the interface_message helper function. | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Tearran marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| extend_docs=false | ||
| options= | ||
| parent=framework | ||
| group=helpers | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||
| #!/usr/bin/env bash | ||||||
|
|
||||||
|
|
||||||
| function _about_interface_message() { | ||||||
| cat <<EOF | ||||||
| Usage: interface_message ["message"] | ||||||
| Examples: | ||||||
| interface_ok_box "Operation completed successfully." | ||||||
| echo "Hello from stdin" | interface_ok_box | ||||||
| interface_ok_box <<< "Message from here-string" | ||||||
| EOF | ||||||
Tearran marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| } | ||||||
|
|
||||||
| function interface_ok_box() { | ||||||
| local message="${1:-}" | ||||||
|
|
||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| if [[ "$message" == "help" || "$message" == "-h" ]]; then | ||||||
| _about_interface_message | ||||||
| return 0 | ||||||
| fi | ||||||
|
|
||||||
| if [[ -z "$message" ]]; then | ||||||
| echo "Error: Missing message." >&2 | ||||||
| _about_interface_message | ||||||
| return 1 | ||||||
| fi | ||||||
|
|
||||||
| local dialog="${DIALOG:-whiptail}" | ||||||
|
|
||||||
| case "$dialog" in | ||||||
| dialog) | ||||||
| dialog --title "${TITLE:-Info}" --msgbox "$message" 10 80 >/dev/tty 2>&1 | ||||||
| ;; | ||||||
| whiptail) | ||||||
| whiptail --title "${TITLE:-Info}" --msgbox "$message" 10 80 3>&1 1>&2 2>&3 | ||||||
| ;; | ||||||
| read) | ||||||
| echo "$message" | ||||||
| ;; | ||||||
| *) | ||||||
| echo "$message" | ||||||
|
||||||
| echo "$message" | |
| echo "Error: Unsupported dialog tool '$dialog'. Supported tools are: dialog, whiptail, read." >&2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| # info_box - Armbian Config V3 test | ||
|
|
||
| if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then | ||
| echo "info_box - Armbian Config V3 test" | ||
| echo "# TODO: implement module logic" | ||
| exit 1 | ||
| fi | ||
Tearran marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| # ok_box - Armbian Config V3 test | ||
|
|
||
| if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then | ||
| echo "ok_box - Armbian Config V3 test" | ||
| echo "# TODO: implement module logic" | ||
| exit 1 | ||
| fi | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.