Add "dest" as an alias for "destination" in `--mount`

Given I wrote this and I still mess it up on a regular basis, I
cannot be alone in forgetting whether "dst" or "dest" is the
correct short option for "destination". Let's just make both
valid, I don't see a reason not to.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon 2025-05-30 09:27:13 -04:00
parent 23ded8bcee
commit 775a85004f
2 changed files with 5 additions and 5 deletions

View File

@ -13,7 +13,7 @@ Options common to all mount types:
- *src*, *source*: mount source spec for **bind**, **glob**, and **volume**. - *src*, *source*: mount source spec for **bind**, **glob**, and **volume**.
Mandatory for **artifact**, **bind**, **glob**, **image** and **volume**. Mandatory for **artifact**, **bind**, **glob**, **image** and **volume**.
- *dst*, *destination*, *target*: mount destination spec. - *dst*, *dest*, *destination*, *target*: mount destination spec.
When source globs are specified without the destination directory, When source globs are specified without the destination directory,
the files and directories are mounted with their complete path the files and directories are mounted with their complete path

View File

@ -446,7 +446,7 @@ func parseMountOptions(mountType string, args []string) (*universalMount, error)
return nil, fmt.Errorf("%v: %w", name, errOptionArg) return nil, fmt.Errorf("%v: %w", name, errOptionArg)
} }
mnt.subPath = value mnt.subPath = value
case "target", "dst", "destination": case "target", "dst", "dest", "destination":
if mnt.mount.Destination != "" { if mnt.mount.Destination != "" {
return nil, fmt.Errorf("cannot pass %q option more than once: %w", name, errOptionArg) return nil, fmt.Errorf("cannot pass %q option more than once: %w", name, errOptionArg)
} }
@ -617,7 +617,7 @@ func getDevptsMount(args []string) (spec.Mount, error) {
switch name { switch name {
case "uid", "gid", "mode", "ptmxmode", "newinstance", "max": case "uid", "gid", "mode", "ptmxmode", "newinstance", "max":
newMount.Options = append(newMount.Options, arg) newMount.Options = append(newMount.Options, arg)
case "target", "dst", "destination": case "target", "dst", "dest", "destination":
if !hasValue { if !hasValue {
return newMount, fmt.Errorf("%v: %w", name, errOptionArg) return newMount, fmt.Errorf("%v: %w", name, errOptionArg)
} }
@ -674,7 +674,7 @@ func getImageVolume(args []string) (*specgen.ImageVolume, error) {
return nil, fmt.Errorf("%v: %w", name, errOptionArg) return nil, fmt.Errorf("%v: %w", name, errOptionArg)
} }
newVolume.Source = value newVolume.Source = value
case "target", "dst", "destination": case "target", "dst", "dest", "destination":
if !hasValue { if !hasValue {
return nil, fmt.Errorf("%v: %w", name, errOptionArg) return nil, fmt.Errorf("%v: %w", name, errOptionArg)
} }
@ -728,7 +728,7 @@ func getArtifactVolume(args []string) (*specgen.ArtifactVolume, error) {
return nil, fmt.Errorf("%v: %w", name, errOptionArg) return nil, fmt.Errorf("%v: %w", name, errOptionArg)
} }
newVolume.Source = value newVolume.Source = value
case "target", "dst", "destination": case "target", "dst", "dest", "destination":
if !hasValue { if !hasValue {
return nil, fmt.Errorf("%v: %w", name, errOptionArg) return nil, fmt.Errorf("%v: %w", name, errOptionArg)
} }