https://git.schokokeks.org/derivepassphrase.git/tree/bba4bd075ab5e1d6a6a76d90b129ad0d58425b96 Recent commits to derivepassphrase.git (bba4bd075ab5e1d6a6a76d90b129ad0d58425b96) 2025-01-07T12:10:27+01:00 tag:gitlist.org,2012:commit/bba4bd075ab5e1d6a6a76d90b129ad0d58425b96 Consolidate shell completion, add tests and fix Zsh output 2025-01-07T12:10:27+01:00 Marco Ricci software@the13thletter.info <pre>We move the shell completion code in `derivepassphrase/cli.py` to a new section and retire the specific handling of `VAULT_PATH` for the two path completion functions. Having actually tried this out interactively in Bash, it does not work that well if we complete filenames, partial filenames, and fixed strings in the same completion function: you would have to set conflicting completion options for this function. It *also* does not work at all with `click`'s stock Bash completion script, which would then discard either the fixed strings and partial filenames or the complete filenames, depending on the order they are emitted in by our shell completion code. So abandon the completion handling of `VAULT_PATH` in favor of standard filename completion, for paths. Every supported shell has further limitations on which inputs it can properly deserialize: Bash strips NUL characters from command substitutions, and Fish (v3) breaks in most situations involving newlines. Furthermore, the stock shell completion scripts add their own additional limitations: all shells use newline-terminated messages, so embedded newlines in the completion item (type, value, help text) cause (generally silent) parsing failures; and the Zsh completion functions in particular parse completions as "name:description" pairs, and thus need colons in the name to be escaped. We fix the colon handling of the Zsh completion script by providing a fixed serialization handler for Zsh. We avoid all of the other aforementioned issues by not returning any service names containing ASCII control characters as completion items. We also warn the user upon importing or configuring such a service that its service name will not be available for shell completion. Finally, we document this new warning in the manpage and the completion behavior in the changelog, and add tests for (the Python side of) the completion machinery, dependent on the current serialization format. References: [fish-shell#10874](https://github.com/fish-shell/fish-shell/issues/10874), [fish-shell#9693](https://github.com/fish-shell/fish-shell/issues/9693), [fish-shell#751](https://github.com/fish-shell/fish-shell/issues/751), [fish-shell#10651](https://github.com/fish-shell/fish-shell/issues/10651), [fish-shell#9847](https://github.com/fish-shell/fish-shell/issues/9847), [click#2703](https://github.com/pallets/click/issues/2703). &lt;/pre&gt; tag:gitlist.org,2012:commit/7949b4328e1fe1c210ba7a3c16105113187920b7 Consolidate and slightly simplify some warning message emittances 2025-01-07T11:09:38+01:00 Marco Ricci software@the13thletter.info <pre>&lt;/pre&gt; tag:gitlist.org,2012:commit/ca43b9971f58117d4c5b3126eb159a39cb36bf59 Add tests for help and version options, and color forcing 2025-01-01T14:08:48+01:00 Marco Ricci software@the13thletter.info <pre>These sections no longer need be excluded from coverage. &lt;/pre&gt; tag:gitlist.org,2012:commit/3d4d9589cea07c62c5c22029e7bd76d49baac3a3 Fix check of empty service name for `derivepassphrase vault` 2025-01-01T02:02:43+01:00 Marco Ricci software@the13thletter.info <pre>We asserted in c1bf00eadd1bf733ac25a25eafbe110d61936c54 that an empty service name is both diagnosed, then treated as if it were missing later on. This wasn't actually strictly true: the checks for a missing or superfluous service name tested for truthy service names instead of non-missing service names, and the key selection and passphrase entry dialogs happen before the check for a non-empty service name. Fix these two issues by checking for non-missing service names in the former case, and moving the non-empty service name check further to the front in the latter case. &lt;/pre&gt; tag:gitlist.org,2012:commit/ceaebdbcd7b01b25cfc76948ced6445079fa109c Add a changelog entry for the color suppressing/forcing support 2025-01-01T00:56:43+01:00 Marco Ricci software@the13thletter.info <pre>&lt;/pre&gt; tag:gitlist.org,2012:commit/43a9458b3a76dbf9a8785d59d297d8366b532fd7 Support suppressing or forcing color output 2025-01-01T00:47:57+01:00 Marco Ricci software@the13thletter.info <pre>We implement this with an eager, hidden "pseudo" option that checks for the `NO_COLOR` and `FORCE_COLOR` options and sets the context's color setting appropriately. To actually make use of this color setting, all output must query the context's color setting, as must all log output. For the log output specifically, we arrange to pass the `click` context in the extra dict of each logging call, so that the handler has access to the color setting too. &lt;/pre&gt; tag:gitlist.org,2012:commit/3918c376b11e8e13bd6ee97684aac86c962ccc06 Add changelog entry for the new explicit shell completion support 2025-01-01T00:28:20+01:00 Marco Ricci software@the13thletter.info <pre>&lt;/pre&gt; tag:gitlist.org,2012:commit/8f9fa0e9819f814b7638a3dd8f705ac6b84d2611 Add shell completion support to derivepassphrase 2025-01-01T00:21:55+01:00 Marco Ricci software@the13thletter.info <pre>`click` already includes shell completion out of the box, so what remained to be done was to tell `click` what kind of values the arguments expect: * The `path` argument for `derivepassphrase export vault` will be completed with a filename or the string `VAULT_PATH`. Because this is not (as a whole) a supported standard category of completion items, we must generate the completion items ourselves in this case, including the partial filtering of results. * The `path` argument to the `--import` and `--export` options of `derivepassphrase vault` will be completed with a filename. `click` handles this for us. * The `service` argument to `devirepassphrase vault` will be completed with a service name, which we must manually extract and filter. The shell completion has so far only been tested interactively; in particular, it is currently excluded from coverage testing. &lt;/pre&gt; tag:gitlist.org,2012:commit/a254e71ee699f479fa70264f7d1a8110cb4777f5 Add a changelog entry for the new i18n/l10n infrastructure 2025-01-01T00:17:17+01:00 Marco Ricci software@the13thletter.info <pre>&lt;/pre&gt; tag:gitlist.org,2012:commit/220d71df817f2662308efab15e98f138fd6dde18 Fix coverage 2024-12-31T23:58:59+01:00 Marco Ricci software@the13thletter.info <pre>Exclude further machinery from coverage that isn't meant to be tested. &lt;/pre&gt;