Terminal renderer for berhtjan UI contributions
  • Lua 96.4%
  • Shell 2.5%
  • Makefile 1.1%
Find a file
2026-08-11 19:38:27 +02:00
.github feat(cli): migrate to daw_error/v1 and daw-modul-berhtjan-core 2.1 2026-08-11 18:18:51 +02:00
config feat(cli): migrate to daw_error/v1 and daw-modul-berhtjan-core 2.1 2026-08-11 18:18:51 +02:00
dispatch feat(cli): migrate to daw_error/v1 and daw-modul-berhtjan-core 2.1 2026-08-11 18:18:51 +02:00
docs feat(cli): migrate to daw_error/v1 and daw-modul-berhtjan-core 2.1 2026-08-11 18:18:51 +02:00
scripts Initial commit 2026-05-04 10:01:54 +02:00
test feat(cli): migrate to daw_error/v1 and daw-modul-berhtjan-core 2.1 2026-08-11 18:18:51 +02:00
.fragjan fix(dispatch): render flags in CLI help output 2026-05-24 09:01:49 +02:00
.gitignore fix: route requires through pcall, fix gitignore and fragjan violations 2026-06-02 07:04:54 +02:00
.merkwerk chore(config): add .merkwerk project config 2026-05-22 17:30:30 +02:00
.version_history chore: merkwerk auto-update 2026-08-11 19:38:27 +02:00
init.lua feat(cli): migrate to daw_error/v1 and daw-modul-berhtjan-core 2.1 2026-08-11 18:18:51 +02:00
LICENSE fix: route requires through pcall, fix gitignore and fragjan violations 2026-06-02 07:04:54 +02:00
Makefile feat(ui): implement render() for ui_types/v1 2026-06-02 09:33:19 +02:00
prompt.lua feat(cli): migrate to daw_error/v1 and daw-modul-berhtjan-core 2.1 2026-08-11 18:18:51 +02:00
README.md fix(readme): translate to English 2026-08-11 19:38:21 +02:00
render.lua feat(cli): migrate to daw_error/v1 and daw-modul-berhtjan-core 2.1 2026-08-11 18:18:51 +02:00
VERSION chore: bump version to 2.1.0 2026-08-11 18:21:22 +02:00

daw-modul-berhtjan-cli

Terminal renderer for berhtjan UI contributions.

daw-modul-berhtjan-cli renders composed contributions from daw-modul-berhtjan-core in the terminal -- prompts, record views, tables and command dispatch -- so a host program never has to implement its own CLI logic.

Status: In development · Lua: 5.1 / 5.4 · License: ISC

❤️ Contribute and support our work

What is daw-modul-berhtjan-cli?

daw-modul-berhtjan-cli is the terminal renderer of the berhtjan UI layer. It knows no field type names -- every value is read and displayed generically as text, regardless of what field.type means in the domain. Commands, subcommands, and their order come from daw-modul-berhtjan-core's build_index()/sorted_subcommands().

What problem does it solve?

Without it, every host program would need its own CLI dispatch logic -- argument parsing, subcommand selection, table output, language resolution. daw-modul-berhtjan-cli does this once, generically, for every Dragons@Work module: a module ships a contribution.json, and it becomes usable in the terminal automatically -- without daw-modul-berhtjan-cli ever needing a change.

Status

  • In active development, Lua 5.1 and 5.4 supported
  • Fully migrated to daw_error/v1 (structured error objects) and the current daw-modul-berhtjan-core contract (resolve_lang/ resolve_label with default_lang, centralized sorted_subcommands())
  • Known limitation: default_lang must be supplied by the host/adapter via ctx.default_lang -- daw-modul-berhtjan-cli owns no configuration itself

Installation

daw-modul-berhtjan-cli is included as a git dependency, not installed via a package manager:

git clone https://smida.dragons-at-work.de/DAW/daw-modul-berhtjan-cli.git \
  lib/daw/berhtjan_cli

Usage

local cli = require("daw.berhtjan_cli")

-- render field labels as a form overview
local ok, err = cli.render_form(composed, lang, default_lang)

-- render a single record
local ok, err = cli.render_record(data, fields)

-- render a list of records as a table
local ok, err = cli.render_table(rows, fields)

-- prompt the user for all fields
local values, err = cli.prompt(composed, groups, lang, default_lang)

-- ask for confirmation
local yes, err = cli.confirm("Really delete?")

-- dispatch a command line to the matching module
local ok, err = cli.dispatch(args, roots, ctx)

composed is the result of daw-modul-berhtjan-core's compose(). fields is a list of field definitions from composed.groups.*.fields. All runtime I/O goes through daw.common.sys -- never directly through io.* (tests inject/capture io.stdin/io.stdout deliberately, that's test code only).

Every public function follows the daw_error/v1 contract: value, nil | nil, daw_error/v1 -- never a raw error string.

Documentation

Development and Testing

Requirements: Lua 5.1 or 5.4, daw-lua-common, daw-modul-berhtjan-core.

git clone https://smida.dragons-at-work.de/DAW/daw-modul-berhtjan-cli.git
cd daw-modul-berhtjan-cli
git clone https://smida.dragons-at-work.de/DAW/daw-lua-common.git lib/daw/common
git clone https://smida.dragons-at-work.de/DAW/daw-modul-berhtjan-core.git lib/daw/berhtjan_core
make test
echo "DAW_LUA_VERSION = 5.1" > config/local.mk && make test  # check against Lua 5.1

Contributing

Bug reports, tests, feedback, and contributions are welcome.

The primary development repository is on Forgejo: Development repository

The GitHub repository is a public mirror for better discoverability. Please submit issues and contributions to the primary repository.

Open Knowledge Needs People

We develop ideas, share knowledge, and build open source software and tools. Projects like this one don't grow on their own -- they live because people ask questions, experiment, share knowledge, find bugs, and help make things better.

You can contribute in different ways:

  • reporting bugs
  • reviewing code
  • testing on other platforms
  • improving documentation
  • translating content
  • or, if you like, supporting us financially

Every contribution helps us keep developing open knowledge and open source software.

Contribute and support our work →

License

Released under the ISC License as part of the Dragons@Work open source ecosystem.