-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
30 lines (25 loc) · 842 Bytes
/
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
package main
import (
"github.com/egibs/deepwalk/v2/cmd"
"github.com/spf13/cobra"
)
var (
defaultValue string
object string
parsedObject interface{}
returnValue string
searchKey string
)
func main() {
// Commands
cmdTraverse := cmd.CmdTraverse(object, searchKey, defaultValue, returnValue, parsedObject)
// Traverse Flags
cmdTraverse.Flags().StringVar(&object, "object", "", "Object to search")
cmdTraverse.Flags().StringVar(&searchKey, "search-key", "", "Key to search for")
cmdTraverse.Flags().StringVar(&defaultValue, "default-value", "NO_VALUE", "Default value to return if search fails")
cmdTraverse.Flags().StringVar(&returnValue, "return-value", "all", "Value to return if search succeeds")
// Root Command
rootCmd := &cobra.Command{Use: "deepwalk"}
rootCmd.AddCommand(cmdTraverse)
rootCmd.Execute()
}