Skip to content

Commit

Permalink
refactor: Clean up log flag setup
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Toh <[email protected]>
  • Loading branch information
tohjustin committed Oct 3, 2021
1 parent 9ee4162 commit 9df6f14
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
19 changes: 0 additions & 19 deletions cmd/kube-lineage/flags.go

This file was deleted.

6 changes: 4 additions & 2 deletions cmd/kube-lineage/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"os"
"path/filepath"
"strings"
Expand All @@ -9,6 +10,7 @@ import (
"github.com/spf13/pflag"
"k8s.io/cli-runtime/pkg/genericclioptions"

"github.com/tohjustin/kube-lineage/internal/version"
"github.com/tohjustin/kube-lineage/pkg/cmd/helm"
"github.com/tohjustin/kube-lineage/pkg/cmd/lineage"
)
Expand All @@ -26,8 +28,8 @@ func init() {
func NewCmd(streams genericclioptions.IOStreams) *cobra.Command {
cmd := lineage.NewCmd(streams, rootCmdName, "")
cmd.AddCommand(helm.NewCmd(streams, "", rootCmdName))
addLogFlags(cmd)
addVersionFlags(cmd)
cmd.SetVersionTemplate("{{printf \"%s\" .Version}}\n")
cmd.Version = fmt.Sprintf("%#v", version.Get())
return cmd
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/lineage/lineage.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"k8s.io/kubectl/pkg/util/templates"

"github.com/tohjustin/kube-lineage/internal/graph"
"github.com/tohjustin/kube-lineage/internal/log"
lineageprinters "github.com/tohjustin/kube-lineage/internal/printers"
)

Expand Down Expand Up @@ -149,6 +150,7 @@ func NewCmd(streams genericclioptions.IOStreams, name, parentCmdPath string) *co

o.ConfigFlags.AddFlags(cmd.Flags())
o.PrintFlags.AddFlags(cmd.Flags())
log.AddFlags(cmd.Flags())

return cmd
}
Expand Down

0 comments on commit 9df6f14

Please sign in to comment.