Skip to content

Commit

Permalink
Add to commands
Browse files Browse the repository at this point in the history
  • Loading branch information
tothszabi committed Sep 9, 2024
1 parent 16991c5 commit bdf8a15
Show file tree
Hide file tree
Showing 23 changed files with 50 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func Run() {
app.Action = func(c *cli.Context) error {
pluginName, pluginArgs, isPlugin := plugins.ParseArgs(c.Args())
if isPlugin {
logPluginCommandParameters(pluginName, pluginArgs)

plugin, found, err := plugins.LoadPlugin(pluginName)
if err != nil {
return fmt.Errorf("Failed to get plugin (%s), error: %s", pluginName, err)
Expand Down
2 changes: 2 additions & 0 deletions cli/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var initCmd = cli.Command{
Aliases: []string{"i"},
Usage: "Init bitrise config.",
Action: func(c *cli.Context) error {
logCommandParameters(c)

logger := log.NewLogger(log.GetGlobalLoggerOpts())
if err := initConfig(c); err != nil {

Expand Down
2 changes: 2 additions & 0 deletions cli/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ var mergeConfigCommand = cli.Command{
}

func mergeConfig(c *cli.Context) error {
logCommandParameters(c)

var configPth string
if c.Args().Present() {
configPth = c.Args().First()
Expand Down
2 changes: 2 additions & 0 deletions cli/plugin_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var pluginDeleteCommand = cli.Command{
Name: "delete",
Usage: "Delete bitrise plugin.",
Action: func(c *cli.Context) error {
logSubcommandParameters(c)

if err := pluginDelete(c); err != nil {
log.Errorf("Plugin delete failed, error: %s", err)
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions cli/plugin_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var pluginInfoCommand = cli.Command{
Name: "info",
Usage: "Installed bitrise plugin's info",
Action: func(c *cli.Context) error {
logSubcommandParameters(c)

if err := pluginInfo(c); err != nil {
log.Errorf("Plugin info failed, error: %s", err)
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions cli/plugin_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ var pluginInstallCommand = cli.Command{
Name: "install",
Usage: "Install bitrise plugin.",
Action: func(c *cli.Context) error {
logSubcommandParameters(c)

if err := pluginInstall(c); err != nil {
log.Errorf("Plugin install failed, error: %s", err)
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions cli/plugin_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var pluginListCommand = cli.Command{
Name: "list",
Usage: "List installed bitrise plugins.",
Action: func(c *cli.Context) error {
logSubcommandParameters(c)

if err := pluginList(c); err != nil {
log.Errorf("Plugin list failed, error: %s", err)
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions cli/plugin_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var pluginUpdateCommand = cli.Command{
Name: "update",
Usage: "Update bitrise plugin. If <plugin_name> not specified, every plugin will be updated.",
Action: func(c *cli.Context) error {
logSubcommandParameters(c)

if err := pluginUpdate(c); err != nil {
log.Errorf("Plugin update failed, error: %s", err)
os.Exit(1)
Expand Down
4 changes: 4 additions & 0 deletions cli/preload_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var stepsCommand = cli.Command{
Name: "list-cached",
Usage: "List all the cached steps",
Action: func(c *cli.Context) error {
logSubcommandParameters(c)

return listCachedSteps(c)
},
Flags: []cli.Flag{
Expand All @@ -44,6 +46,8 @@ var stepsCommand = cli.Command{
Usage: "Makes sure that Bitrise CLI can be used in offline mode by preloading Bitrise maintaned Steps.",
UsageText: fmt.Sprintf("Use the %s env var to test after preloading steps.", configs.IsSteplibOfflineModeEnvKey),
Action: func(c *cli.Context) error {
logSubcommandParameters(c)

if err := preloadSteps(c); err != nil {
log.Errorf("Preload failed: %s", err)
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ var runCommand = cli.Command{
}

func run(c *cli.Context) error {
logCommandParameters(c)

signalInterruptChan := make(chan os.Signal, 1)
signal.Notify(signalInterruptChan, syscall.SIGINT, syscall.SIGTERM)

Expand Down
2 changes: 2 additions & 0 deletions cli/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var setupCommand = cli.Command{
Name: "setup",
Usage: "Setup the current host. Install every required tool to run Workflows.",
Action: func(c *cli.Context) error {
logSubcommandParameters(c)

if err := setup(c); err != nil {
log.Errorf("Setup failed, error: %s", err)
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions cli/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
)

func share(c *cli.Context) error {
logCommandParameters(c)

if err := tools.StepmanShare(); err != nil {
failf("Bitrise share failed, error: %s", err)
}
Expand Down
4 changes: 3 additions & 1 deletion cli/share_audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"github.com/urfave/cli"
)

func shareAudit(_ *cli.Context) error {
func shareAudit(c *cli.Context) error {
logSubcommandParameters(c)

if err := tools.StepmanShareAudit(); err != nil {
failf("Bitrise share audit failed, error: %s", err)
}
Expand Down
2 changes: 2 additions & 0 deletions cli/share_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
)

func create(c *cli.Context) error {
logSubcommandParameters(c)

// Input validation
tag := c.String(TagKey)
if tag == "" {
Expand Down
4 changes: 3 additions & 1 deletion cli/share_finish.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"github.com/urfave/cli"
)

func finish(_ *cli.Context) error {
func finish(c *cli.Context) error {
logSubcommandParameters(c)

if err := tools.StepmanShareFinish(); err != nil {
failf("Bitrise share finish failed, error: %s", err)
}
Expand Down
2 changes: 2 additions & 0 deletions cli/share_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
)

func start(c *cli.Context) error {
logSubcommandParameters(c)

// Input validation
collectionURI := c.String(CollectionKey)
if collectionURI == "" {
Expand Down
2 changes: 2 additions & 0 deletions cli/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var envmanCommand = cli.Command{
Usage: "Runs an envman command.",
SkipFlagParsing: true,
Action: func(c *cli.Context) error {
logCommandParameters(c)

if err := runCommandWith("envman", c); err != nil {
failf("Command failed, error: %s", err)
}
Expand Down
2 changes: 2 additions & 0 deletions cli/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ func printAvailableTriggerFilters(triggerMap []models.TriggerMapItemModel) {
}

func trigger(c *cli.Context) error {
logCommandParameters(c)

// Expand cli.Context
var prGlobalFlagPtr *bool
if c.GlobalIsSet(PRKey) {
Expand Down
2 changes: 2 additions & 0 deletions cli/trigger_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func getPipelineAndWorkflowIDByParamsInCompatibleMode(triggerMap models.TriggerM
// --------------------

func triggerCheck(c *cli.Context) error {
logCommandParameters(c)

warnings := []string{}

//
Expand Down
2 changes: 2 additions & 0 deletions cli/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ var updateCommand = cli.Command{
Name: "update",
Usage: "Updates the Bitrise CLI.",
Action: func(c *cli.Context) error {
logCommandParameters(c)

if err := update(c); err != nil {
log.Errorf("Update Bitrise CLI failed, error: %s", err)
os.Exit(1)
Expand Down
2 changes: 2 additions & 0 deletions cli/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ func runValidate(bitriseConfigPath string, bitriseConfigBase64Data string, inven
}

func validate(c *cli.Context) error {
logCommandParameters(c)

// Expand cli.Context
bitriseConfigBase64Data := c.String(ConfigBase64Key)
bitriseConfigPath := c.String(ConfigKey)
Expand Down
2 changes: 2 additions & 0 deletions cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type VersionOutputModel struct {
}

func printVersionCmd(c *cli.Context) error {
logCommandParameters(c)

fullVersion := c.Bool("full")

if err := output.ConfigureOutputFormat(c); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions cli/workflow_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ var workflowListCommand = cli.Command{
Name: "workflows",
Usage: "List of available workflows in config.",
Action: func(c *cli.Context) error {
logCommandParameters(c)

if err := workflowList(c); err != nil {
log.Errorf("List of available workflows in config failed, error: %s", err)
os.Exit(1)
Expand Down

0 comments on commit bdf8a15

Please sign in to comment.