File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2022 Lekko Technologies, Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ package main
16
+
17
+ import (
18
+ "encoding/json"
19
+ "fmt"
20
+ "os"
21
+
22
+ "github.com/lekkodev/cli/pkg/dotlekko"
23
+ "github.com/spf13/cobra"
24
+ )
25
+
26
+ func confCmd () * cobra.Command {
27
+ cmd := & cobra.Command {
28
+ Use : "conf" ,
29
+ Short : "parse a .lekko-like configuration file in the working directory" ,
30
+ RunE : func (cmd * cobra.Command , args []string ) error {
31
+ // By default, read dotlekko and output as JSON
32
+ wd , err := os .Getwd ()
33
+ if err != nil {
34
+ return err
35
+ }
36
+ dot , err := dotlekko .ReadDotLekko (wd )
37
+ if err != nil {
38
+ return err
39
+ }
40
+ b , err := json .MarshalIndent (dot , "" , " " )
41
+ if err != nil {
42
+ return err
43
+ }
44
+ fmt .Println (string (b ))
45
+
46
+ return nil
47
+ },
48
+ }
49
+ return cmd
50
+ }
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ func main() {
61
61
rootCmd .AddCommand (namespaceCmd ())
62
62
rootCmd .AddCommand (apikeyCmd ())
63
63
rootCmd .AddCommand (upgradeCmd ())
64
+ rootCmd .AddCommand (confCmd ())
64
65
// auth
65
66
rootCmd .AddCommand (authCmd ())
66
67
// exp
You can’t perform that action at this time.
0 commit comments