implement lp/lpstat reference tools + CI integration tests#11
implement lp/lpstat reference tools + CI integration tests#11Abd002 wants to merge 2 commits intoOpenPrinting:mainfrom
Conversation
6bef114 to
2fcc412
Compare
|
Also I think I have flag it earlier about the cli thing, this is a library not a cli implementation so the example should not contain the cli that yu are making (Please keep this in mind for future ) See the other examples that were already there, yu wil need to make small specific examples for lpstat And also please split the pr into digestible size that a maintainner can review, reviewing 1764+ lines of code with a single commit is pretty difficult,either make small commits showing what done and compress it into a pr or make small small pr Thanks |
I got it, I’ll break this PR down into smaller PRs that are easier to review. |
|
I can split it into small focused examples under examples/lpstat/ for things like scheduler status, classes, and the other missing parts, with the goal of improving library examples rather than reimplementing the lpstat CLI. yes, |
Summary
This PR implements WoC 2026 deliverables by adding Rust reference implementations of core CUPS CLI workflows:
lp(job submission)lpstat(status / discovery)…built on top of
cups-rs/libcups, with CI + integration coverage.What’s included
lpworkflow (destination/default, files + stdin, basic options).lpstatworkflow (common query flags).CIGitHub Actions workflow that runs unit tests + CUPS integration checks.Integration testend-to-end submit job via examplelpand verify vialpstat.Supported options (subset)
lp:--help -- -d -E -h -U -t -n -q -o -H -P -s+ stdin (-)lpstat:--help -H -d -e -r -s -t -a -c -p -v -o -u -W -R -l -D -E -h -UHow to test it
Test Output (lpstat -t + lp via stdin)
example implementation | current system implementation
lpstat (CodeFlow)
Added a Mermaid flowchart documenting the high-level
lpstatexecution path (arg parsing → context setup → action dispatch → job/device/printer queries), since the implementation is large and hard to scan quickly.flowchart TB A["main"] --> B["run"] B --> C["parse_args"] C --> E{"for Step in commands"} E -- SetLongStatus --> SLS["ctx.long_status = max"] E -- SetRanking --> SRK["ctx.ranking = v"] E -- SetEncryption --> SEN["set_encryption"] E -- SetWhich --> SW["ctx.which = v"] E -- SetServer --> SSV["set_server + ctx.refresh_dests"] SSV --> SSV1["get_all_destinations"] E -- SetUser --> SUS["set_user"] E -- Action --> ACT["Action::run"] ACT --> AR{"match Action"} AR -- ShowServerAndPort --> AS1["get_server + ippPort"] AR -- ShowDefault --> AS2["Destinations::get_default"] AR -- ListDestinations --> AS3["iterate ctx.dests"] AR -- ShowSchedular --> AS4["scheduler_is_running"] AR -- ShowSummary --> AS5["show_default + show_classes + show_devices"] AR -- ShowAll --> AS6["scheduler_is_running + show_default + show_classes + show_devices + show_accepting + show_printers + show_jobs"] AR -- ShowAccepting --> AA["show_accepting"] AR -- ShowClasses --> AC["show_classes"] AR -- ShowPrinters --> AP["show_printers"] AR -- ShowDevices --> AV["show_devices"] AR -- ShowJobsByDest --> AO["show_jobs user=None dest=filter"] AR -- ShowJobsByUser --> AU["show_jobs user=filter dest=None"] AR -- ShowJobsBareArg --> AB["show_jobs user=arg dest=None"] AO --> SJ["show_jobs"] AU --> SJ AB --> SJ SJ --> SJ1{"ctx.which"} & SJ5["jobs.retain match_list"] & SJ6{"needs_extras?"} & SJ9["print rows"] SJ1 -- NotCompleted --> SJ2["get_active_jobs"] SJ1 -- Completed --> SJ3["get_completed_jobs"] SJ1 -- All --> SJ4["get_jobs"] SJ6 -- yes --> SJ7["get_job_extras"] SJ6 -- no --> SJ8["extras = empty"] SW --> W2["controls show_jobs source"] SJ9 --> H2["format_time"] SJ5 --> H3["match_list"]