-
Notifications
You must be signed in to change notification settings - Fork 4
/
utils.go
44 lines (36 loc) · 994 Bytes
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Superior - Toolkit for the Go programming language
// Available at http://github.com/liamka/Printm
//
// Copyright © Kirill Kotikov <[email protected]>.
// Superior is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
// See README.md for details.
//
package Superior
import (
"fmt"
"os"
)
func stringInSlice(str string, list []string) bool {
for _, v := range list {
if v == str {
return true
}
}
return false
}
func checkType(a string, b string) {
var strList []string
var mess string
if b == "type" {
strList = []string{"normal", "bold", "under", "background"}
mess = "Possible value for type: normal, bold, under, background"
} else if b == "color" {
strList = []string{"black", "red", "green", "yellow", "blue", "purple", "cyan", "white"}
mess = "Possible value for color: black, red, green, yellow, blue, purple, cyan, white"
}
if !stringInSlice(a, strList) {
fmt.Fprintln(os.Stderr, mess)
os.Exit(1)
}
}