Changed flags to an more friendly syntax
This commit is contained in:
parent
cc568010ee
commit
901ea5a454
14
README.md
14
README.md
@ -49,9 +49,9 @@ A Golang build system with file watchers, output streams and live reload. Run, b
|
|||||||
--name="Project Name" -> Name, if not specified takes the working directory name
|
--name="Project Name" -> Name, if not specified takes the working directory name
|
||||||
--path="server" -> Base Path, if not specified takes the working directory name
|
--path="server" -> Base Path, if not specified takes the working directory name
|
||||||
--build -> Enables the build
|
--build -> Enables the build
|
||||||
--nobin -> Disables the installation
|
--no-bin -> Disables the installation
|
||||||
--norun -> Disables the run
|
--no-run -> Disables the run
|
||||||
--nofmt -> Disables the fmt (go fmt)
|
--no-fmt -> Disables the fmt (go fmt)
|
||||||
```
|
```
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ A Golang build system with file watchers, output streams and live reload. Run, b
|
|||||||
$ realize add --name="My Project" --path="/projects/package" --build
|
$ realize add --name="My Project" --path="/projects/package" --build
|
||||||
```
|
```
|
||||||
```
|
```
|
||||||
$ realize add --name="My Project" --path="projects/package" --build --norun
|
$ realize add --name="My Project" --path="projects/package" --build --no-run
|
||||||
```
|
```
|
||||||
- Remove a project by its name
|
- Remove a project by its name
|
||||||
|
|
||||||
@ -96,9 +96,9 @@ A Golang build system with file watchers, output streams and live reload. Run, b
|
|||||||
|
|
||||||
```
|
```
|
||||||
--build -> Enables the build
|
--build -> Enables the build
|
||||||
--nobin -> Disables the installation
|
--no-bin -> Disables the installation
|
||||||
--norun -> Disables the run
|
--no-run -> Disables the run
|
||||||
--nofmt -> Disables the fmt (go fmt)
|
--no-fmt -> Disables the fmt (go fmt)
|
||||||
--config -> Take the defined settings if exist a config file
|
--config -> Take the defined settings if exist a config file
|
||||||
```
|
```
|
||||||
|
|
||||||
|
12
main.go
12
main.go
@ -62,9 +62,9 @@ func main() {
|
|||||||
Usage: "Build and watch file changes for a single project without any config file",
|
Usage: "Build and watch file changes for a single project without any config file",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{Name: "build", Value: false, Usage: "Enables the build"},
|
&cli.BoolFlag{Name: "build", Value: false, Usage: "Enables the build"},
|
||||||
&cli.BoolFlag{Name: "norun", Usage: "Disables the run"},
|
&cli.BoolFlag{Name: "no-run", Usage: "Disables the run"},
|
||||||
&cli.BoolFlag{Name: "nobin", Usage: "Disables the installation"},
|
&cli.BoolFlag{Name: "no-bin", Usage: "Disables the installation"},
|
||||||
&cli.BoolFlag{Name: "nofmt", Usage: "Disables the fmt (go fmt)"},
|
&cli.BoolFlag{Name: "no-fmt", Usage: "Disables the fmt (go fmt)"},
|
||||||
&cli.BoolFlag{Name: "config", Value: false, Usage: "Take the defined settings if exist a config file."},
|
&cli.BoolFlag{Name: "config", Value: false, Usage: "Take the defined settings if exist a config file."},
|
||||||
},
|
},
|
||||||
Action: func(p *cli.Context) error {
|
Action: func(p *cli.Context) error {
|
||||||
@ -85,9 +85,9 @@ func main() {
|
|||||||
&cli.StringFlag{Name: "name", Aliases: []string{"n"}, Value: r.WorkingDir(), Usage: "Project name"},
|
&cli.StringFlag{Name: "name", Aliases: []string{"n"}, Value: r.WorkingDir(), Usage: "Project name"},
|
||||||
&cli.StringFlag{Name: "path", Aliases: []string{"b"}, Value: "/", Usage: "Project base path"},
|
&cli.StringFlag{Name: "path", Aliases: []string{"b"}, Value: "/", Usage: "Project base path"},
|
||||||
&cli.BoolFlag{Name: "build", Value: false, Usage: "Enable go build"},
|
&cli.BoolFlag{Name: "build", Value: false, Usage: "Enable go build"},
|
||||||
&cli.BoolFlag{Name: "norun", Usage: "Disables the run"},
|
&cli.BoolFlag{Name: "no-run", Usage: "Disables the run"},
|
||||||
&cli.BoolFlag{Name: "nobin", Usage: "Disables the installation"},
|
&cli.BoolFlag{Name: "no-bin", Usage: "Disables the installation"},
|
||||||
&cli.BoolFlag{Name: "nofmt", Usage: "Disables the fmt (go fmt)"},
|
&cli.BoolFlag{Name: "no-fmt", Usage: "Disables the fmt (go fmt)"},
|
||||||
},
|
},
|
||||||
Action: func(p *cli.Context) error {
|
Action: func(p *cli.Context) error {
|
||||||
y := r.New(p)
|
y := r.New(p)
|
||||||
|
@ -59,9 +59,9 @@ func New(params *cli.Context) *Config {
|
|||||||
Name: nameParam(params),
|
Name: nameParam(params),
|
||||||
Path: filepath.Clean(params.String("path")),
|
Path: filepath.Clean(params.String("path")),
|
||||||
Build: params.Bool("build"),
|
Build: params.Bool("build"),
|
||||||
Bin: boolParam(params.Bool("nobin")),
|
Bin: boolParam(params.Bool("no-bin")),
|
||||||
Run: boolParam(params.Bool("norun")),
|
Run: boolParam(params.Bool("no-run")),
|
||||||
Fmt: boolParam(params.Bool("nofmt")),
|
Fmt: boolParam(params.Bool("no-fmt")),
|
||||||
Watcher: Watcher{
|
Watcher: Watcher{
|
||||||
Paths: watcherPaths,
|
Paths: watcherPaths,
|
||||||
Ignore: watcherIgnores,
|
Ignore: watcherIgnores,
|
||||||
@ -130,9 +130,9 @@ func (h *Config) Add(params *cli.Context) error {
|
|||||||
Name: nameParam(params),
|
Name: nameParam(params),
|
||||||
Path: filepath.Clean(params.String("path")),
|
Path: filepath.Clean(params.String("path")),
|
||||||
Build: params.Bool("build"),
|
Build: params.Bool("build"),
|
||||||
Bin: boolParam(params.Bool("nobin")),
|
Bin: boolParam(params.Bool("no-bin")),
|
||||||
Run: boolParam(params.Bool("norun")),
|
Run: boolParam(params.Bool("no-run")),
|
||||||
Fmt: boolParam(params.Bool("nofmt")),
|
Fmt: boolParam(params.Bool("no-fmt")),
|
||||||
Watcher: Watcher{
|
Watcher: Watcher{
|
||||||
Paths: watcherPaths,
|
Paths: watcherPaths,
|
||||||
Exts: watcherExts,
|
Exts: watcherExts,
|
||||||
|
Loading…
Reference in New Issue
Block a user