Show [name] for optional positionals, allow filtering import by name too

The custom --help renderer showed every positional as <name> regardless
of whether it was actually required, which was misleading for open and
transfer (both take an optional profile name). positional_args() now
checks Arg::is_required_set() and renders [name] for an optional one.

transfer's name positional previously only worked with --export and was
rejected outright when combined with --import. It now filters --import
the same way: 'porthole transfer <name> -i file.toml' imports just that
one profile out of the file instead of everything in it, erroring with
a new TransferProfileNotFound if the file doesn't contain it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 00:54:27 +02:00
parent 5ce0614cad
commit ab0fd69503
4 changed files with 28 additions and 12 deletions

View File

@@ -188,7 +188,7 @@ pub struct WipeArgs {
#[derive(Args)]
pub struct TransferArgs {
/// Name of the profile to export; every saved profile if omitted. Not used for import.
/// Restrict export/import to just this profile; every profile in scope if omitted.
pub name: Option<String>,
/// Export saved profiles to a file.