cmd/enter: Don't use double negation
Double negation is hard to wrap your head around. https://github.com/containers/toolbox/pull/913
This commit is contained in:
parent
4d9849c386
commit
02a831466e
2 changed files with 8 additions and 8 deletions
|
@ -80,7 +80,7 @@ func enter(cmd *cobra.Command, args []string) error {
|
|||
|
||||
var container string
|
||||
var containerArg string
|
||||
var nonDefaultContainer bool
|
||||
var defaultContainer bool = true
|
||||
|
||||
if len(args) != 0 {
|
||||
container = args[0]
|
||||
|
@ -91,7 +91,7 @@ func enter(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
if container != "" {
|
||||
nonDefaultContainer = true
|
||||
defaultContainer = false
|
||||
|
||||
if !utils.IsContainerNameValid(container) {
|
||||
var builder strings.Builder
|
||||
|
@ -106,7 +106,7 @@ func enter(cmd *cobra.Command, args []string) error {
|
|||
|
||||
var release string
|
||||
if enterFlags.release != "" {
|
||||
nonDefaultContainer = true
|
||||
defaultContainer = false
|
||||
|
||||
var err error
|
||||
release, err = utils.ParseRelease(enterFlags.distro, enterFlags.release)
|
||||
|
@ -150,7 +150,7 @@ func enter(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
if err := runCommand(container,
|
||||
!nonDefaultContainer,
|
||||
defaultContainer,
|
||||
image,
|
||||
release,
|
||||
command,
|
||||
|
|
|
@ -86,10 +86,10 @@ func run(cmd *cobra.Command, args []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var nonDefaultContainer bool
|
||||
var defaultContainer bool = true
|
||||
|
||||
if runFlags.container != "" {
|
||||
nonDefaultContainer = true
|
||||
defaultContainer = false
|
||||
|
||||
if !utils.IsContainerNameValid(runFlags.container) {
|
||||
var builder strings.Builder
|
||||
|
@ -104,7 +104,7 @@ func run(cmd *cobra.Command, args []string) error {
|
|||
|
||||
var release string
|
||||
if runFlags.release != "" {
|
||||
nonDefaultContainer = true
|
||||
defaultContainer = false
|
||||
|
||||
var err error
|
||||
release, err = utils.ParseRelease(runFlags.distro, runFlags.release)
|
||||
|
@ -136,7 +136,7 @@ func run(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
if err := runCommand(container,
|
||||
!nonDefaultContainer,
|
||||
defaultContainer,
|
||||
image,
|
||||
release,
|
||||
command,
|
||||
|
|
Loading…
Reference in a new issue