Skip to content

Commit

Permalink
fix typo and missed cases
Browse files Browse the repository at this point in the history
  • Loading branch information
emiliocramer committed Jun 1, 2023
1 parent 0e6b74b commit 54c69b3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/substreams/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func runGui(cmd *cobra.Command, args []string) error {
if err != nil {
return fmt.Errorf("read manifest %q: %w", manifestPath, err)
}
if err := manifest.ApplyParams(mustGetStringSlice(cmd, "params"), pkg); err != nil {
if err := manifest.ApplyParams(mustGetStringArray(cmd, "params"), pkg); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/substreams/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func runRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("read manifest %q: %w", manifestPath, err)
}

if err := manifest.ApplyParams(mustGetStringSlice(cmd, "params"), pkg); err != nil {
if err := manifest.ApplyParams(mustGetStringArray(cmd, "params"), pkg); err != nil {
return err
}

Expand Down
8 changes: 8 additions & 0 deletions tools/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ func mustGetStringSlice(cmd *cobra.Command, flagName string) []string {
return val
}

func mustGetStringArray(cmd *cobra.Command, flagName string) []string {
val, err := cmd.Flags().GetStringArray(flagName)
if err != nil {
panic(fmt.Sprintf("flags: couldn't find flag %q", flagName))
}
return val
}

func ReadAPIToken(cmd *cobra.Command, envFlagName string) string {
envVar := mustGetString(cmd, envFlagName)
value := os.Getenv(envVar)
Expand Down
2 changes: 1 addition & 1 deletion tools/tier2call.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func tier2CallE(cmd *cobra.Command, args []string) error {
return fmt.Errorf("read manifest %q: %w", manifestPath, err)
}

if err := manifest.ApplyParams(mustGetStringSlice(cmd, "params"), pkg); err != nil {
if err := manifest.ApplyParams(mustGetStringArray(cmd, "params"), pkg); err != nil {
return fmt.Errorf("apply params: %w", err)
}

Expand Down

0 comments on commit 54c69b3

Please sign in to comment.