File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,10 +19,7 @@ type Command struct {
1919}
2020
2121func Run () {
22- opts , ok := options .Run ()
23- if ! ok {
24- return
25- }
22+ opts := options .Run ()
2623
2724 if opts .Create {
2825 options .Create ()
Original file line number Diff line number Diff line change @@ -2,43 +2,17 @@ package options
22
33import (
44 "flag"
5- "fmt"
65)
76
87type Options struct {
9- Build bool
108 Create bool
119}
1210
13- func Run () (Options , bool ) {
14- opts := parse ()
15- if ! opts .check () {
16- return opts , false
17- }
18-
19- return opts , true
20- }
21-
22- func parse () Options {
11+ func Run () Options {
2312 var create = flag .Bool ("create" , false , "Create a config file" )
24- var build = flag .Bool ("build" , false , "Build the CSS" )
2513 flag .Parse ()
2614
2715 return Options {
28- Build : * build ,
2916 Create : * create ,
3017 }
3118}
32-
33- func (o Options ) check () bool {
34- if o .Build && o .Create {
35- fmt .Println ("You can't use both -build and -create" )
36- return false
37- }
38-
39- if ! o .Build && ! o .Create {
40- o .Build = true
41- }
42-
43- return true
44- }
You can’t perform that action at this time.
0 commit comments