summaryrefslogtreecommitdiff
path: root/names.go
diff options
context:
space:
mode:
Diffstat (limited to 'names.go')
-rw-r--r--names.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/names.go b/names.go
new file mode 100644
index 0000000..56a0a68
--- /dev/null
+++ b/names.go
@@ -0,0 +1,21 @@
+package main
+
+import (
+ "errors"
+ "fmt"
+ "strings"
+)
+
+type Names []string
+
+func (n Names) String() string {
+ return fmt.Sprint(strings.Join(n, ","))
+}
+
+func (n *Names) Set(s string) error {
+ *n = Names(strings.Split(s, ","))
+ if len(*n) < 2 {
+ return errors.New("at least 2 names are required")
+ }
+ return nil
+}