File tree Expand file tree Collapse file tree 3 files changed +48
-8
lines changed Expand file tree Collapse file tree 3 files changed +48
-8
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,20 @@ import (
44
44
)
45
45
46
46
func main () {
47
+ root := GetCLIRoot ()
48
+
49
+ root .PersistentFlags ().Bool (flags .VerboseOpt , false , "Enable verbose logging" )
50
+ if err := viper .BindPFlags (root .PersistentFlags ()); err != nil {
51
+ log .Fatalf ("Failed to bind root flags: %v" , err )
52
+ }
53
+
54
+ if err := root .Execute (); err != nil {
55
+ os .Exit (1 )
56
+ }
57
+ }
58
+
59
+ // GetCLIRoot is intended to creeate the base command structure for the OSDK for use in CLI and documentation
60
+ func GetCLIRoot () * cobra.Command {
47
61
root := & cobra.Command {
48
62
Use : "operator-sdk" ,
49
63
Short : "An SDK for building operators with ease" ,
@@ -76,14 +90,7 @@ func main() {
76
90
root .AddCommand (up .NewCmd ())
77
91
root .AddCommand (version .NewCmd ())
78
92
79
- root .PersistentFlags ().Bool (flags .VerboseOpt , false , "Enable verbose logging" )
80
- if err := viper .BindPFlags (root .PersistentFlags ()); err != nil {
81
- log .Fatalf ("Failed to bind root flags: %v" , err )
82
- }
83
-
84
- if err := root .Execute (); err != nil {
85
- os .Exit (1 )
86
- }
93
+ return root
87
94
}
88
95
89
96
func checkGoModulesForCmd (cmd * cobra.Command ) (err error ) {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ require (
24
24
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
25
25
github.com/fatih/camelcase v1.0.0 // indirect
26
26
github.com/ghodss/yaml v1.0.0
27
+ github.com/go-logfmt/logfmt v0.4.0 // indirect
27
28
github.com/go-logr/logr v0.1.0
28
29
github.com/go-logr/zapr v0.1.1
29
30
github.com/go-openapi/swag v0.19.0 // indirect
Original file line number Diff line number Diff line change
1
+ // Copyright 2019 The Operator-SDK Authors
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
+ cmd "github.com/operator-framework/operator-sdk/cmd/operator-sdk"
19
+
20
+ "github.com/spf13/cobra/doc"
21
+
22
+ log "github.com/sirupsen/logrus"
23
+ )
24
+
25
+ func main () {
26
+ root := cmd .GetCLIRoot ()
27
+
28
+ err := doc .GenMarkdownTree (root , "../../doc" )
29
+ if err != nil {
30
+ log .Fatalf ("Failed to generate documenation, (%v)" , err )
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments