summaryrefslogtreecommitdiff
path: root/names.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-02-26 00:00:50 +0100
committerDimitri Sokolyuk <demon@dim13.org>2017-02-26 00:00:50 +0100
commit6571642c66bfcef49a1cc18b950b09f13131dd5a (patch)
tree426a0f3a3c00a9ba987dd1324bae867018b4642e /names.go
parent3ef9e0c337ed2eec1be47766aa4253e973a0d839 (diff)
Split files
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
+}