/
main.go
58 lines (49 loc) · 1.13 KB
/
main.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* @Author: 0xe8998e@gmail.com
* @Date: 2021-09-15 14:52:26
* @LastEditTime: 2022-02-08 11:14:35
* @LastEditors: 0xe8998e@gmail.com
* @FilePath: /gosible/cmd/main.go
* @Description: gosible Contol Servers of DevOps's Tool
*/
package main
import (
"fmt"
"os"
"github.com/0xe8998e/gosible"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "playbooks",
Aliases: []string{"p"},
Value: "./examples/playbook/test.yaml",
Usage: "Enter the characters",
Required: true,
},
&cli.StringFlag{
Name: "inventory",
Aliases: []string{"i"},
Value: "./examples/playbook/hosts.yaml",
Usage: "language for the greeting",
Required: true,
},
},
Action: func(c *cli.Context) error {
playbooks := c.String("playbooks")
fmt.Printf("playbooks = %v\n", playbooks)
inventory := c.String("inventory")
fmt.Printf("inventory = %v\n", inventory)
gosible.InitLogger()
Gosible := gosible.Gosible{
Inventory: inventory,
PlayBooks: playbooks,
}
Gosible.Parse()
return nil
},
}
_ = app.Run(os.Args)
}