This repository has been archived by the owner on Dec 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to print command line args (fixes #144)
- Loading branch information
1 parent
df0849f
commit c0bf3a8
Showing
12 changed files
with
183 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/aerokube/cm/selenoid" | ||
"github.com/spf13/cobra" | ||
"os" | ||
) | ||
|
||
var selenoidArgsCmd = &cobra.Command{ | ||
Use: "args", | ||
Short: "Shows Selenoid available args", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
argsImpl(uiConfigDir, uiPort, func(lc *selenoid.Lifecycle) error { | ||
return lc.PrintArgs() | ||
}, force) | ||
}, | ||
} | ||
|
||
func argsImpl(configDir string, port uint16, argsAction func(*selenoid.Lifecycle) error, force bool) { | ||
lifecycle, err := createLifecycle(configDir, port) | ||
if err != nil { | ||
stderr("Failed to initialize: %v\n", err) | ||
os.Exit(1) | ||
} | ||
lifecycle.Force = force | ||
err = argsAction(lifecycle) | ||
if err != nil { | ||
lifecycle.Errorf("Failed to print args: %v", err) | ||
os.Exit(1) | ||
} | ||
os.Exit(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/aerokube/cm/selenoid" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var selenoidUIArgsCmd = &cobra.Command{ | ||
Use: "args", | ||
Short: "Shows Selenoid UI available args", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
argsImpl(uiConfigDir, uiPort, func(lc *selenoid.Lifecycle) error { | ||
return lc.PrintUIArgs() | ||
}, force) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.