feat(cli): add a simplified command line over the logic layer

The window needs a display, which kept the package manager out of a script and
off a headless machine. The command line runs the same operations through
AppCore, before any widget exists, so providers, the pacman lock, the journal
and the history behave exactly as in the window.

Refs #22.
This commit is contained in:
BlackAngelTV committed 2026-10-03 22:53:47 +02:00
1 parent 78b279aeee
commit 3e4ed92c0a
11 files changed
+1055 -5

No files matched your search

+14 -1
View File
@@ -30,6 +30,9 @@ find_package(ZLIB REQUIRED)
set(SOURCES
app/main.cpp
app/main-window.cpp
# Command-line front-end: parsing, then the runner over the logic layer.
cli/cli-command.cpp
cli/cli-application.cpp
providers/pacman-manager.cpp
plugins/plugin-manager.cpp
history/history-manager.cpp
@@ -60,6 +63,8 @@ set(SOURCES
set(HEADERS
include/sdk/package-manager.h
cli/cli-command.h
cli/cli-application.h
providers/pacman-manager.h
plugins/plugin-manager.h
include/sdk/provider-plugin.h
@@ -97,7 +102,7 @@ add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
set_target_properties(${PROJECT_NAME} PROPERTIES ENABLE_EXPORTS ON)
target_include_directories(${PROJECT_NAME} PRIVATE
include pages pages/base pages/packages pages/overview pages/system pages/extensions include/sdk logging preferences history archive update plugins providers core app)
include pages pages/base pages/packages pages/overview pages/system pages/extensions include/sdk logging preferences history archive update plugins providers core app cli)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets Qt6::Network ZLIB::ZLIB)
target_compile_definitions(${PROJECT_NAME} PRIVATE
FWSPACMANAGE_VERSION="${PACMANAGER_VERSION}"
@@ -250,6 +255,14 @@ target_compile_definitions(language-manager-test PRIVATE
PACMANAGER_TRANSLATIONS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/translations")
add_test(NAME language-manager-test COMMAND language-manager-test)
# The command-line grammar: which arguments ask for the command line rather than
# the window, and what each keyword parses into. Pure parsing — no package
# manager, no display, nothing spawned (the runner is exercised by hand).
add_executable(cli-command-test tests/cli-command.test.cpp cli/cli-command.cpp)
target_include_directories(cli-command-test PRIVATE include include/sdk logging preferences history archive update plugins providers core app cli)
target_link_libraries(cli-command-test PRIVATE Qt6::Core)
add_test(NAME cli-command-test COMMAND cli-command-test)
# ---- Translations ----
#
# The language setting loads a catalogue named <code>.json out of a