15 lines
299 B
Go
15 lines
299 B
Go
|
|
package cmd
|
||
|
|
|
||
|
|
import (
|
||
|
|
"axolotl/models"
|
||
|
|
"fmt"
|
||
|
|
"strings"
|
||
|
|
)
|
||
|
|
|
||
|
|
func parseRelFlag(s string) (models.RelType, string, error) {
|
||
|
|
if p := strings.SplitN(s, ":", 2); len(p) == 2 {
|
||
|
|
return models.RelType(p[0]), p[1], nil
|
||
|
|
}
|
||
|
|
return "", "", fmt.Errorf("invalid relation format: %s (expected type:id)", s)
|
||
|
|
}
|