@@ -20,7 +20,7 @@ func main() {
2020 rootPath := "/etc/s6-overlay/s6-rc.d"
2121 app := & cli.App {
2222 Name : "s6-cli" ,
23- Version : "0.0.2 " ,
23+ Version : "v0.2.0 " ,
2424 Compiled : time .Now (),
2525 Authors : []* cli.Author {
2626 {
@@ -58,7 +58,8 @@ func main() {
5858 }
5959 if execute != "" {
6060 fmt .Println ("s6-cli: lint found issues with services in " + rootPath )
61- return errors .New (execute )
61+ fmt .Println (execute )
62+ return nil
6263 }
6364 fmt .Println ("s6-cli: lint found no issues" )
6465 return nil
@@ -89,7 +90,7 @@ func main() {
8990 Name : "create" ,
9091 Aliases : []string {"c" },
9192 Usage : "create a service" ,
92- ArgsUsage : "[ type: (o|l|b)] [id] " ,
93+ ArgsUsage : "< type: oneshot|longrun|bundle> <id> " ,
9394 Flags : []cli.Flag {
9495 & cli.BoolFlag {Value : false , Name : "overwrite" , Aliases : []string {"o" }, Usage : "Ignore existing files and directories" },
9596 },
@@ -98,24 +99,17 @@ func main() {
9899 rootPath = cCtx .String ("root-path" )
99100 }
100101
101- var serviceType service.Type
102- switch t := cCtx .Args ().Get (0 ); t {
103- case "o" :
104- serviceType = service .TypeOneshot
105- case "l" :
106- serviceType = service .TypeLongrun
107- case "b" :
108- serviceType = service .TypeBundle
109- default :
110- fmt .Print ("Arg type must not be empty and one of 'o', 'l' or 'b'\n " )
102+ var serviceType = service .Type (cCtx .Args ().Get (0 ))
103+ if service .ValidType (serviceType ) == false {
104+ fmt .Println ("Argument type be one of 'oneshot', 'longrun' or 'bundle'" )
111105 os .Exit (1 )
112106 }
113107
114108 var id service.Id
115109 if idArg := cCtx .Args ().Get (1 ); idArg != "" {
116110 id = service .Id (idArg )
117111 } else {
118- fmt .Println ("Arg idArg must not be empty" )
112+ fmt .Println ("Argument id must not be empty" )
119113 os .Exit (1 )
120114 }
121115
0 commit comments