-
Notifications
You must be signed in to change notification settings - Fork 0
/
sayhello.go
31 lines (26 loc) · 844 Bytes
/
sayhello.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"fmt"
"github.com/ariary/quicli/pkg/quicli"
)
//SayHello: contains the logic of the CLi application
func SayHello(cfg quicli.Config) {
for i := 0; i < cfg.GetIntFlag("count"); i++ {
if cfg.GetBoolFlag("world") {
fmt.Print("Message for the world: ")
}
fmt.Println(cfg.GetStringFlag("say"))
}
}
func main() {
quicli.Run(quicli.Cli{
Usage: "SayToTheWorld [flags]",
Description: "Say Hello... or not. If you want to make the world aware of it you also could",
Flags: quicli.Flags{
{Name: "count", Default: 1, Description: "how many times I want to say it. Sometimes repetition is the key"},
{Name: "say", Default: "hello", Description: "say something. If you are polite start with a greeting"},
{Name: "world", Description: "announce it to the world"},
},
Function: SayHello,
})
}