Skip to content

Commit

Permalink
fix aliases (#6)
Browse files Browse the repository at this point in the history
fix aliases
  • Loading branch information
sigmonsays authored Feb 24, 2024
1 parent 9e02bb2 commit 2a2c077
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 38 deletions.
5 changes: 3 additions & 2 deletions cmd/runitcmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ func initApply(app *Application) *cli.Command {

flags := []cli.Flag{
&cli.BoolFlag{
Name: "restart, r",
Usage: "restart service after changes",
Name: "restart",
Aliases: []string{"r"},
Usage: "restart service after changes",
},
}

Expand Down
25 changes: 15 additions & 10 deletions cmd/runitcmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,29 @@ func initCreate(app *Application) *cli.Command {

flags := []cli.Flag{
&cli.StringFlag{
Name: "exec, e",
Usage: "execute command",
Name: "exec",
Aliases: []string{"e"},
Usage: "execute command",
},
&cli.StringFlag{
Name: "log-dir, l",
Usage: "log to directory",
Name: "log-dir",
Aliases: []string{"l"},
Usage: "log to directory",
},
&cli.BoolFlag{
Name: "disabled, d",
Usage: "create service but do not enable it",
Name: "disabled",
Aliases: []string{"d"},
Usage: "create service but do not enable it",
},
&cli.BoolFlag{
Name: "force, f",
Usage: "force update the service if it already exists",
Name: "force",
Aliases: []string{"f"},
Usage: "force update the service if it already exists",
},
&cli.BoolFlag{
Name: "restart, r",
Usage: "restart the service after creation if it already exists",
Name: "restart",
Aliases: []string{"r"},
Usage: "restart the service after creation if it already exists",
},
}

Expand Down
5 changes: 3 additions & 2 deletions cmd/runitcmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ func initExport(app *Application) *cli.Command {

flags := []cli.Flag{
&cli.BoolFlag{
Name: "forgiving, f",
Usage: "be forgiving and try to parse the runit files",
Name: "forgiving",
Aliases: []string{"f"},
Usage: "be forgiving and try to parse the runit files",
},
}

Expand Down
5 changes: 3 additions & 2 deletions cmd/runitcmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ func initList(app *Application) *cli.Command {

flags := []cli.Flag{
&cli.BoolFlag{
Name: "all, a",
Usage: "list all services",
Name: "all",
Usage: "list all services",
Aliases: []string{"a"},
},
}

Expand Down
12 changes: 7 additions & 5 deletions cmd/runitcmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ func main() {

app.Flags = []cli.Flag{
&cli.StringFlag{
Name: "config, c",
Usage: "override configuration file",
Name: "config",
Aliases: []string{"c"},
Usage: "override configuration file",
},
&cli.StringFlag{
Name: "level, l",
Value: "WARN",
Usage: "change log level",
Name: "level",
Aliases: []string{"l"},
Value: "WARN",
Usage: "change log level",
},
&cli.StringFlag{
Name: "log-dir",
Expand Down
37 changes: 22 additions & 15 deletions cmd/runitcmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ func initSetup(app *Application) *cli.Command {
Usage: "service name",
},
&cli.BoolFlag{
Name: "verbose, v",
Usage: "be verbose",
Name: "verbose",
Aliases: []string{"v"},
Usage: "be verbose",
},
&cli.BoolFlag{
Name: "enable, e",
Usage: "setup service and enable it",
Name: "enable",
Aliases: []string{"e"},
Usage: "setup service and enable it",
},
&cli.BoolFlag{
Name: "disable, d",
Usage: "setup service but do not enable it",
Name: "disable",
Aliases: []string{"d"},
Usage: "setup service but do not enable it",
},
&cli.StringFlag{
Name: "run",
Expand All @@ -43,24 +46,28 @@ func initSetup(app *Application) *cli.Command {
Usage: "service log command",
},
&cli.StringSliceFlag{
Name: "script",
Usage: "additional lines to execute before run",
Name: "script",
Aliases: []string{"s"},
Usage: "additional lines to execute before run",
},
&cli.BoolFlag{
Name: "restart, r",
Name: "restart",
Usage: "restart service",
},
&cli.IntFlag{
Name: "uid, u",
Usage: "user id",
Name: "uid",
Aliases: []string{"u"},
Usage: "user id",
},
&cli.IntFlag{
Name: "gid, g",
Usage: "group id",
Name: "gid",
Aliases: []string{"g"},
Usage: "group id",
},
&cli.StringFlag{
Name: "template, t",
Usage: "service template to use (does nothing, legacy only)",
Name: "template",
Aliases: []string{"t"},
Usage: "service template to use (does nothing, legacy only)",
},
}

Expand Down
3 changes: 1 addition & 2 deletions runit/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ func DefaultCreateOptions() *CreateOptions {
type CreateOptions struct {
Force bool
Restart bool

Script []string
Script []string
}

func (opts *CreateOptions) WithScript(lines []string) *CreateOptions {
Expand Down

0 comments on commit 2a2c077

Please sign in to comment.