-
Notifications
You must be signed in to change notification settings - Fork 13
/
get.go
33 lines (28 loc) · 843 Bytes
/
get.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
// Copyright: This file is part of korrel8r, released under https://github.com/korrel8r/korrel8r/blob/main/LICENSE
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package main
import (
"context"
"os"
"github.com/korrel8r/korrel8r/internal/pkg/must"
"github.com/korrel8r/korrel8r/pkg/korrel8r"
"github.com/spf13/cobra"
)
// getCmd represents the get command
var getCmd = &cobra.Command{
Use: "get DOMAIN:CLASS:QUERY",
Short: "Execute QUERY and print the results",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
e, _ := newEngine()
q := must.Must1(e.Query(args[0]))
result := newPrinter(os.Stdout)
var constraint *korrel8r.Constraint // FIXME implement constraints as arguments
must.Must(e.Get(context.Background(), q, constraint, result))
},
}
func init() {
rootCmd.AddCommand(getCmd)
}