Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #676 from Khalian/master
Browse files Browse the repository at this point in the history
Update ignite help, image and kernel to no longer require root
  • Loading branch information
darkowlzz authored Sep 3, 2020
2 parents 5da6ea4 + ae6f964 commit 950dd68
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmd/ignite/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewIgniteCommand(in io.Reader, out, err io.Writer) *cobra.Command {

// TODO Some commands do not need to check root
// Currently it seems to be only ignite version that does not require root
if cmd.Name() == "version" && cmd.Parent().Name() == "ignite" {
if isNonRootCommand(cmd.Name(), cmd.Parent().Name()) {
return
}

Expand Down Expand Up @@ -117,6 +117,19 @@ func NewIgniteCommand(in io.Reader, out, err io.Writer) *cobra.Command {
return root
}

func isNonRootCommand(cmd string, parentCmd string) bool {
if parentCmd != "ignite" {
return false
}

switch cmd {
case "version", "help", "image", "kernel", "completion", "inspect", "ps":
return true
}

return false
}

func addGlobalFlags(fs *pflag.FlagSet) {
AddQuietFlag(fs)
logflag.LogLevelFlagVar(fs, &logLevel)
Expand Down

0 comments on commit 950dd68

Please sign in to comment.