mirror of
https://github.com/fiatjaf/nak.git
synced 2025-09-01 06:20:46 -04:00
global verbose flag.
This commit is contained in:
10
helpers.go
10
helpers.go
@@ -32,11 +32,11 @@ const (
|
|||||||
LINE_PROCESSING_ERROR = iota
|
LINE_PROCESSING_ERROR = iota
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = func(msg string, args ...any) {
|
var (
|
||||||
fmt.Fprintf(color.Error, msg, args...)
|
log = func(msg string, args ...any) { fmt.Fprintf(color.Error, msg, args...) }
|
||||||
}
|
logverbose = func(msg string, args ...any) {} // by default do nothing
|
||||||
|
stdout = fmt.Println
|
||||||
var stdout = fmt.Println
|
)
|
||||||
|
|
||||||
func isPiped() bool {
|
func isPiped() bool {
|
||||||
stat, _ := os.Stdin.Stat()
|
stat, _ := os.Stdin.Stat()
|
||||||
|
13
main.go
13
main.go
@@ -63,6 +63,19 @@ var app = &cli.Command{
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "verbose",
|
||||||
|
Usage: "print more stuff than normally",
|
||||||
|
Aliases: []string{"v"},
|
||||||
|
Persistent: true,
|
||||||
|
Action: func(ctx context.Context, c *cli.Command, b bool) error {
|
||||||
|
v := c.Count("verbose")
|
||||||
|
if v >= 1 {
|
||||||
|
logverbose = log
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Before: func(ctx context.Context, c *cli.Command) error {
|
Before: func(ctx context.Context, c *cli.Command) error {
|
||||||
configPath := c.String("config-path")
|
configPath := c.String("config-path")
|
||||||
|
Reference in New Issue
Block a user