-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (35 loc) 路 809 Bytes
/
Copy pathmain.go
File metadata and controls
44 lines (35 loc) 路 809 Bytes
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
// Copyright 2018 Josh Komoroske. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE.txt file.
package main
import (
"fmt"
"os"
"flag"
"github.com/joshdk/chromatic/chromatic"
)
var (
version = "development"
)
func main() {
versionFlag := flag.Bool("version", false, "Displays the version and exits.")
flag.Parse()
if *versionFlag == true {
fmt.Println(version)
os.Exit(2)
} else if err := mainFunc(flag.Arg(0)); err != nil {
fmt.Fprintf(os.Stderr, "chromatic: %s\n", err.Error())
switch err {
case chromatic.ErrorTimeoutExceeded:
os.Exit(2)
default:
os.Exit(1)
}
}
}
func mainFunc(configFile string) error {
if configFile == "" {
configFile = "chromatic.yml"
}
return chromatic.Run(configFile)
}