File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ type Command struct {
2222func Run () {
2323 opts := options .Run ()
2424
25+ if opts .Version {
26+ fmt .Printf ("Styler version %v\n " , options .Version )
27+ return
28+ }
29+
2530 if opts .Create {
2631 options .Create ()
2732 return
Original file line number Diff line number Diff line change @@ -5,14 +5,17 @@ import (
55)
66
77type Options struct {
8- Create bool
8+ Create bool
9+ Version bool
910}
1011
1112func Run () Options {
1213 var create = flag .Bool ("create" , false , "Create a config file" )
14+ var version = flag .Bool ("version" , false , "Version of styler" )
1315 flag .Parse ()
1416
1517 return Options {
16- Create : * create ,
18+ Create : * create ,
19+ Version : * version ,
1720 }
1821}
Original file line number Diff line number Diff line change 88
99const configPath = ".styler"
1010
11- const version = "0.0.2 "
11+ const Version = "0.0.3 "
1212
1313type Media struct {
1414 MaxWidth string `json:"maxWidth"`
@@ -318,7 +318,7 @@ var colors = map[string]map[string]string{
318318
319319func New () Config {
320320 return Config {
321- Version : version ,
321+ Version : Version ,
322322 Pattern : "*.R|*.r|*.js|*.html" ,
323323 Directory : "." ,
324324 Output : "style.min.css" ,
@@ -392,11 +392,11 @@ func (c *Config) check() {
392392 return
393393 }
394394
395- if c .Version != version {
395+ if c .Version != Version {
396396 fmt .Printf (
397397 "[WARNING] Config version (%v) is not the same as the current version (%v).\n " ,
398398 c .Version ,
399- version ,
399+ Version ,
400400 )
401401 fmt .Printf ("If you encounter errors, please update the config file with: style -create\n " )
402402 return
You can’t perform that action at this time.
0 commit comments