Skip to content

Commit

Permalink
activate feature flags in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
ascandone committed Jan 20, 2025
1 parent 3dc51d4 commit e6fcf01
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var runStdinFlag bool
var runOutFormatOpt string

var overdraftFeatureFlag bool
var oneOfFeatureFlag bool

type inputOpts struct {
Script string `json:"script"`
Expand Down Expand Up @@ -121,6 +122,9 @@ func run(path string) {
if overdraftFeatureFlag {
featureFlags[interpreter.ExperimentalOverdraftFunctionFeatureFlag] = struct{}{}
}
if oneOfFeatureFlag {
featureFlags[interpreter.ExperimentalOneofFeatureFlag] = struct{}{}
}

Check warning on line 127 in internal/cmd/run.go

View check run for this annotation

Codecov / codecov/patch

internal/cmd/run.go#L125-L127

Added lines #L125 - L127 were not covered by tests

result, err := interpreter.RunProgram(context.Background(), parseResult.Value, opt.Variables, interpreter.StaticStore{
Balances: opt.Balances,
Expand Down Expand Up @@ -201,6 +205,7 @@ func getRunCmd() *cobra.Command {

// Feature flag
cmd.Flags().BoolVar(&overdraftFeatureFlag, interpreter.ExperimentalOverdraftFunctionFeatureFlag, false, "feature flag to enable the overdraft() function")
cmd.Flags().BoolVar(&oneOfFeatureFlag, interpreter.ExperimentalOneofFeatureFlag, false, "feature flag to enable the oneof combinator")

Check warning on line 208 in internal/cmd/run.go

View check run for this annotation

Codecov / codecov/patch

internal/cmd/run.go#L208

Added line #L208 was not covered by tests

// Output options
cmd.Flags().StringVar(&runOutFormatOpt, "output-format", OutputFormatPretty, "Set the output format. Available options: pretty, json.")
Expand Down

0 comments on commit e6fcf01

Please sign in to comment.