Skip to content

Commit

Permalink
Added the option to push only a single project.
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanHabic committed Feb 26, 2021
1 parent 5ed1802 commit d8242ec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions commands/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit d8242ec

Please sign in to comment.