SolidGround Management Console

SolidGroundUX DocumentationSolidGroundUX
NL

Provide a modular console interface for SolidGroundUX tooling

Source: target-root/usr/local/libexec/solidgroundux/management-console.sh

Provide a modular console interface for SolidGroundUX tooling

Public functions

Internal functions
FunctionPurposeArgumentsOutput
_sgnd_console_state_ownerKeep per-user console state owned by the invoking standard user when the—Writes the target user name to stdout.
_sgnd_console_prepare_state_directoryCreate a per-user state directory with restricted permissions and ensure- $1 DIRECTORY - State directory to prepare.—
_sgnd_console_finalize_state_fileRestrict a state file to its owner and restore the invoking user's ownership- $1 FILE - State file that was just created or replaced.—
_sgnd_console_init_pathsDerive console host paths from SGND_FRAMEWORK_ROOT.——
_sgnd_console_resolve_app_rootDerive the root of the management application tree independently from the- $1 MODULE_PATH - Selected module file or directory.Writes the resolved application root to stdout.
_sgnd_console_set_app_contextEstablish the management-application root and executable locations from the- $1 MODULE_PATH - Selected module source used to resolve application directories.—
_sgnd_console_load_configResolve the module file or directory used by this console instance.—(globals):
_sgnd_console_execute_menu_itemExecute menu actions through the console tracking layer while leaving- $1 ITEM_KEY - Registered menu item key.—
_sgnd_console_refresh_action_statusesPopulate the current menu items with their previously persisted——
_sgnd_console_reset_page_resultsReset the persisted last-run status for every non-builtin action belonging——
_sgnd_console_register_builtin_itemsAdd the hidden previous/next page controls used by the menu dispatcher.——
_sgnd_console_register_fallback_groupRegister a fallback group for an item that references an unknown group key.- $1 GROUP_KEY—
_sgnd_console_group_existsTest whether a group key already exists in the console group model.- $1 GROUP_KEY—
_sgnd_console_show_module_metadataDisplay lightweight metadata for every console module present in the configured——
_sgnd_console_module_id_from_filenameStrip the optional two-digit prefix and .sh extension from a module's- $1 MODULE_FILE - Path or filename of a numbered module.—
_sgnd_console_module_state_getRead the module's persisted enabled/disabled state, defaulting to- $1 MODULE_ID - Filename-derived module identifier.—
_sgnd_console_module_enabledReturn success when a module is enabled (or has no saved state),- $1 MODULE_ID - Filename-derived module identifier.—
_sgnd_console_module_state_setSave one module's enabled/disabled state without sourcing that module.- $1 MODULE_ID - Filename-derived console module ID.—
_sgnd_console_manage_visibilityLet a root console session enable or disable discovered management pages.——
_sgnd_console_discover_module_filesList the selected module file or enumerate .sh files in the selected——
_sgnd_console_module_metadataRead lightweight page identity plus canonical header version and description.- $1 MODULE_FILE - Console module file.—
_sgnd_console_register_pagesDiscover enabled module files and register page metadata without sourcing them.——
_sgnd_console_open_pageSource a module the first time its index page is selected and activate its menu rows.- $1 PAGE_INDEX - Zero-based row index in SGND_CONSOLE_PAGE_ROWS.—
_sgnd_console_show_indexShow all enabled console pages without loading their implementation modules.——
_sgnd_console_rollback_module_registrationRestore the console registration model to its pre-load state when a module- $1 GROUP_COUNT Group-row count before module loading.—
_sgnd_console_source_moduleLoad a selected console module and register its page only after- $1 MODULE_FILE(globals):
_sgnd_build_command_argsCopy caller arguments into a target array and prepend --dryrun when the console- $1 RESULT_ARRAY - Name of the array receiving arguments.—
_sgnd_run_public_commandResolve a command from the console bin/sbin roots or PATH, propagate console- $1 COMMAND - Public SolidGroundUX command name.—
_sgnd_run_module_scriptLocates and executes a console helper script from the canonical- $1 Script filename.—
_sgnd_console_open_shellOpen a new interactive shell and return to the Management Console on exit.——
_sgnd_console_toggle_accessReplace the current console process with a root or standard-access instance.——
_sgnd_console_confirm_exitRequire explicit confirmation when Esc is pressed on the top-level console index.——
_sgnd_console_toggle_dryrunSwitch FLAG_DRYRUN between dry-run and commit mode and redraw immediately.—(globals)
_sgnd_console_cycle_loglevel_valueResolve and print the adjacent supported framework log level,- $1 Current log level.—
_sgnd_console_persist_framework_valueSave a quick-access setting to SGND_FRAMEWORK_STATEFILE when framework state- $1 KEY - Framework state variable name.—
_sgnd_console_cycle_console_loglevelSelect the adjacent console log level, persist it, and redraw immediately.- $1 DIRECTION - Optional: 1 forward (default), -1 backward.—
_sgnd_console_cycle_file_loglevelSelect the adjacent file log level, persist it, and redraw immediately.- $1 DIRECTION - Optional: 1 forward (default), -1 backward.—
_sgnd_console_cycle_themeSelect the adjacent installed style file, apply it through sgnd_theme, and- $1 DIRECTION - Optional: 1 forward (default), -1 backward.—
_sgnd_console_handle_controlHandle console-wide direct controls before index or module-page dispatch.- $1 CONTROL - Normalized key returned by sgnd_menu_read_choice.—
_sgnd_console_runRun the interactive console event loop.——

Description

Provides a generic, modular console host that discovers management pages at startup and lazy-loads each implementation module when its page is first opened.

The script:

  • Discovers enabled console modules and reads lightweight page metadata
  • Renders a top-level index without sourcing module implementations
  • Sources each selected page module once and retains it for the console session
  • Allows loaded modules to register menu groups and items dynamically
  • Builds and renders interactive menus
  • Handles user input, page navigation, paging, and action dispatch
  • Persists console layout and framework UI/logging state

Design principles

  • Modular architecture with clear separation of host and modules
  • Convention-based module registration
  • Minimal assumptions about module implementation
  • Consistent user interaction patterns across all tools

Role in framework

  • Generic console engine for module-defined interactive applications
  • Hosts functionality registered by ordered console modules

Non-goals

  • Implementing business logic directly in the console host
  • Managing module-specific state beyond registration and dispatch
  • Providing a widget-based or cursor-addressed full-screen TUI

Usage

Run the executable from its shell command (or installed wrapper):

sgnd-console
sgnd-console --appcfg ./10-sgnd-config.sh
sgnd-console --appcfg ./20-machine-config.sh

Script-specific options:

  • --appcfg VALUE: Console module file or module directory.
  • --maxrows VALUE: Maximum menu rows per page.
  • --title VALUE: Override console title.
Script metadata (framework integration)

Console module API

Public menu registration functions are defined by sgnd-menu.sh. Modules should use sgnd_menu_register_group/item; the public sgnd_console_register_group/item compatibility API remains available there.