Commit Graph
12 Commits
Author SHA1 Message Date
Ximon Eighteen d68c919f60 Fix lifetime error. 2024-11-27 00:12:03 +01:00
Ximon Eighteen 221bba1aa7 Cargo fmt. 2024-11-26 23:55:03 +01:00
Ximon Eighteen 6297442e68 Factor out ANSI colourisation support. 2024-11-26 23:54:36 +01:00
Ximon Eighteen 844ca3cfdb Merge branch 'main' into add-ldns-like-sign-zone-support 2024-11-25 15:08:51 +01:00
arya dradjicaandGitHub 18dd6e7ebc [error] Add 'bail' and 'ensure' macros (#29)
* [error] Add 'bail' and 'ensure' macros

* [error] Export 'bail' and 'ensure' from the right module

* [error] Document macro exporting trick

* [error] Adjust semicolons in bail macros
2024-11-22 13:27:06 +01:00
Jannik Peters 32ca8f7ca0 Fix writing to stdout or file 2024-11-21 16:40:41 +01:00
Jannik Peters 9cdba55750 Merge branch 'main' into add-ldns-like-sign-zone-support 2024-11-20 12:39:23 +01:00
Terts DiepraamandGitHub a014f13c09 Make the output of Env::std{out, err} a concrete type (#27)
* make the output of Env::std{out, err} a concrete type

* document why the unwrap in write_fmt is okay
2024-11-15 16:13:35 +01:00
18d56a6431 Introduce an Env trait to mock the outside world (#23)
* introduce and Env trait to mock the outside world

* make argument parsing unit-testable

* add get_stderr to FakeEnv

* fakecmd and print errors into the env

* change ExitCode::from to into

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>

* update some comments

* cargo fmt

* document some more of the testing utilities

* use exit_code method on clap errors

* bump minimal clap version

* reexport RealEnv

* remove .lock() calls for stdout and stderr

* remove args field from FakeCmd

* improve docs for Env

* cargo fmt

* use mutex in FakeStream

* improve FmtWriter implementation for a tiny bit more performance

* car go ffffffmmmmmmtttttt

---------

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2024-11-15 13:47:18 +01:00
8dc82c7ff6 Add context tracking for errors (#18)
* [error] Introduce context tracking

* [error] Add an extension trait to 'Result'

* [error] Move pretty-printing to explicit function

* Pretty-print errors on exit

* [erro] Fix primary field documentation

---------

Co-authored-by: arya dradjica <arya@nlnetlabs.nl>
2024-11-11 19:55:46 +01:00
bae3b00041 Separate ldns parsing from clap parsing (#19)
* Separate ldns parsing from clap parsing

Co-authored-by: Jannik Peters <jannik@nlnetlabs.nl>

* nsec3-hash: sort ldns argument parsing alphabetically

* abort ldns parsing early on malfored argv[0]

* add 'Error' prefix to ldns parsing errors

* use clap default exit code of 2 for dnst versions of commands

* remove args_overide_self from nsec3hash

* move parse_os and parse_os_with out of LdnsCommand

---------

Co-authored-by: Jannik Peters <jannik@nlnetlabs.nl>
2024-11-11 15:52:26 +01:00
Jannik Peters bd0c9d7118 Add basic clap scaffolding a la dnsi 2024-08-29 10:51:44 +02:00