From 5bd76226febdf7b41155c4132255c8a12ac1c056 Mon Sep 17 00:00:00 2001 From: Szabolcs Toth Date: Fri, 22 Mar 2024 10:48:58 +0000 Subject: [PATCH] Remove export subcommand --- cli/commands.go | 12 --------- cli/export.go | 72 ------------------------------------------------- 2 files changed, 84 deletions(-) delete mode 100644 cli/export.go diff --git a/cli/commands.go b/cli/commands.go index a5c95bdbd..d27ab31e4 100644 --- a/cli/commands.go +++ b/cli/commands.go @@ -75,18 +75,6 @@ var ( }, }, triggerCommand, - { - Name: "export", - Usage: "Export the bitrise configuration.", - Action: export, - Flags: []cli.Flag{ - flConfig, - flConfigBase64, - flFormat, - flOutputPath, - flPretty, - }, - }, { Name: "step-list", Usage: "List of available steps.", diff --git a/cli/export.go b/cli/export.go deleted file mode 100644 index 157e2c901..000000000 --- a/cli/export.go +++ /dev/null @@ -1,72 +0,0 @@ -package cli - -import ( - "encoding/json" - - "github.com/bitrise-io/bitrise/log" - "github.com/bitrise-io/bitrise/output" - "github.com/bitrise-io/go-utils/fileutil" - "github.com/urfave/cli" - "gopkg.in/yaml.v2" -) - -func export(c *cli.Context) error { - // Expand cli.Context - bitriseConfigBase64Data := c.String(ConfigBase64Key) - - bitriseConfigPath := c.String(ConfigKey) - - outfilePth := c.String(OuputPathKey) - outFormat := c.String(OuputFormatKey) - prettyFormat := c.Bool(PrettyFormatKey) - // - - if outfilePth == "" { - showSubcommandHelp(c) - failf("No output file path specified!") - } - - if outFormat == "" { - showSubcommandHelp(c) - failf("No output format format specified!") - } - - // Config validation - bitriseConfig, warnings, err := CreateBitriseConfigFromCLIParams(bitriseConfigBase64Data, bitriseConfigPath) - for _, warning := range warnings { - log.Warnf("warning: %s", warning) - } - if err != nil { - showSubcommandHelp(c) - failf("Failed to create bitrise config, error: %s", err) - } - - // serialize - configBytes := []byte{} - if outFormat == output.FormatJSON { - if prettyFormat { - configBytes, err = json.MarshalIndent(bitriseConfig, "", "\t") - } else { - configBytes, err = json.Marshal(bitriseConfig) - } - if err != nil { - failf("Failed to generate config JSON, error: %s", err) - } - } else if outFormat == output.FormatYML { - configBytes, err = yaml.Marshal(bitriseConfig) - if err != nil { - failf("Failed to generate config YML, error: %s", err) - } - } else { - failf("Invalid output format: %s", outFormat) - } - - // write to file - if err := fileutil.WriteBytesToFile(outfilePth, configBytes); err != nil { - failf("Failed to write file (%s), error: %s", outfilePth, err) - } - - log.Infof("Done, saved to path: %s", outfilePth) - - return nil -}