Allow links to be specified with only the name if this matches the alias
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
parent
eef8989683
commit
3a89ef7153
2 changed files with 46 additions and 0 deletions
|
@ -135,3 +135,17 @@ func ParsePortRange(ports string) (uint64, uint64, error) {
|
|||
}
|
||||
return start, end, nil
|
||||
}
|
||||
|
||||
func ParseLink(val string) (string, string, error) {
|
||||
if val == "" {
|
||||
return "", "", fmt.Errorf("empty string specified for links")
|
||||
}
|
||||
arr := strings.Split(val, ":")
|
||||
if len(arr) > 2 {
|
||||
return "", "", fmt.Errorf("bad format for links: %s", val)
|
||||
}
|
||||
if len(arr) == 1 {
|
||||
return val, val, nil
|
||||
}
|
||||
return arr[0], arr[1], nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue