aboutsummaryrefslogtreecommitdiff
path: root/utilities.go
diff options
context:
space:
mode:
Diffstat (limited to 'utilities.go')
-rw-r--r--utilities.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/utilities.go b/utilities.go
index b5c540f..7548da4 100644
--- a/utilities.go
+++ b/utilities.go
@@ -1,6 +1,7 @@
package main
import (
+ "fmt"
"os"
"os/exec"
"strings"
@@ -40,3 +41,15 @@ func command(name string, show bool, args ...string) (string, error) {
return string(out), err
}
+
+func lister(items []string) string {
+ if len(items) == 0 {
+ return ""
+ } else if len(items) == 1 {
+ return items[0]
+ } else if len(items) == 2 {
+ return fmt.Sprintf("%s & %s", items[0], items[1])
+ }
+
+ return fmt.Sprintf("%s, & %s", strings.Join(items[:len(items)-1], ", "), items[len(items)-1])
+}