-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* preliminary flix support * fixing error message * set default context * structure if correctly * addeed to readme * remove flix folder name * remove uneeded is transaction code * update deps
- Loading branch information
Showing
6 changed files
with
156 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package overflow | ||
|
||
// run a script with the given code/filanem an options | ||
func (o *OverflowState) FlixScript(filename string, opts ...OverflowInteractionOption) *OverflowScriptResult { | ||
interaction := o.BuildInteraction(filename, "flix", opts...) | ||
|
||
result := interaction.runScript() | ||
|
||
if interaction.PrintOptions != nil && !interaction.NoLog { | ||
result.Print() | ||
} | ||
if o.StopOnError && result.Err != nil { | ||
result.PrintArguments(nil) | ||
panic(result.Err) | ||
} | ||
return result | ||
} | ||
|
||
// compose interactionOptions into a new Script function | ||
func (o *OverflowState) FlixScriptFN(outerOpts ...OverflowInteractionOption) OverflowScriptFunction { | ||
return func(filename string, opts ...OverflowInteractionOption) *OverflowScriptResult { | ||
outerOpts = append(outerOpts, opts...) | ||
return o.FlixScript(filename, outerOpts...) | ||
} | ||
} | ||
|
||
// compose fileName and interactionOptions into a new Script function | ||
func (o *OverflowState) FlixScriptFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowScriptOptsFunction { | ||
return func(opts ...OverflowInteractionOption) *OverflowScriptResult { | ||
outerOpts = append(outerOpts, opts...) | ||
return o.FlixScript(filename, outerOpts...) | ||
} | ||
} | ||
|
||
// If you store this in a struct and add arguments to it it will not reset between calls | ||
func (o *OverflowState) FlixTxFN(outerOpts ...OverflowInteractionOption) OverflowTransactionFunction { | ||
return func(filename string, opts ...OverflowInteractionOption) *OverflowResult { | ||
// outer has to be first since we need to be able to overwrite | ||
opts = append(outerOpts, opts...) | ||
return o.FlixTx(filename, opts...) | ||
} | ||
} | ||
|
||
func (o *OverflowState) FlixTxFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowTransactionOptsFunction { | ||
return func(opts ...OverflowInteractionOption) *OverflowResult { | ||
// outer has to be first since we need to be able to overwrite | ||
opts = append(outerOpts, opts...) | ||
return o.FlixTx(filename, opts...) | ||
} | ||
} | ||
|
||
// run a flix transaction with the given code/filanem an options | ||
func (o *OverflowState) FlixTx(filename string, opts ...OverflowInteractionOption) *OverflowResult { | ||
interaction := o.BuildInteraction(filename, "flix", opts...) | ||
|
||
return o.sendTx(interaction) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.