From d8242ec9b34eaacc031a7443964cb7f689e58436 Mon Sep 17 00:00:00 2001 From: Bogdan Habic Date: Fri, 26 Feb 2021 21:05:02 +0100 Subject: [PATCH] Added the option to push only a single project. --- README.md | 1 + commands/push.go | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 30ff8d7..b714a0b 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ tenderly push | --- | --- | --- | | --networks | / | A comma separated list of network ids to push | | --tag | / | Optional tag used for filtering and referencing pushed contracts | +| --project-slug | / | Optional project slug used to pick only one project to push (see advanced usage) | | --help | / | Help for push command | #### Advanced usage diff --git a/commands/push.go b/commands/push.go index b56efef..6b4b631 100644 --- a/commands/push.go +++ b/commands/push.go @@ -20,10 +20,12 @@ import ( var deploymentTag string var pushNetworks string +var pushProjectSlug string func init() { pushCmd.PersistentFlags().StringVar(&deploymentTag, "tag", "", "Optional tag used for filtering and referencing pushed contracts") pushCmd.PersistentFlags().StringVar(&pushNetworks, "networks", "", "A comma separated list of networks to push") + pushCmd.PersistentFlags().StringVar(&pushProjectSlug, "project-slug", "", "The slug of a project you wish to push") rootCmd.AddCommand(pushCmd) } @@ -76,6 +78,22 @@ func uploadContracts(rest *rest.Rest) error { ) } + if pushProjectSlug != "" { + projectConfiguration, exists := projectConfigurations[pushProjectSlug] + if !exists { + return userError.NewUserError( + errors.Wrap(err, "cannot find project configuration via slug"), + colorizer.Sprintf("Failed reading project configuration. Couldn't find project with slug: %s", + colorizer.Bold(colorizer.Red(pushProjectSlug)), + ), + ) + } + + projectConfigurations = map[string]*ProjectConfiguration{ + pushProjectSlug: projectConfiguration, + } + } + pushErrors := make(map[string]*userError.UserError) for projectSlug, projectConfiguration := range projectConfigurations {