Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "scripts", Short: "Utilities to execute scripts", TraverseChildren: true, }
View Source
var ExecuteCommand = &command.Command{ Cmd: &cobra.Command{ Use: "execute <filename>", Short: "Execute a script", Example: `flow scripts execute script.cdc --arg String:"Meow" --arg String:"Woof"`, Args: cobra.MaximumNArgs(1), }, Flags: &scriptFlags, Run: func( cmd *cobra.Command, args []string, globalFlags command.GlobalFlags, services *services.Services, ) (command.Result, error) { filename := "" if len(args) == 1 { filename = args[0] } else if scriptFlags.Code != "" { fmt.Println("⚠️ DEPRECATION WARNING: use filename as a command argument <filename>") filename = scriptFlags.Code } else { return nil, fmt.Errorf("provide a valide filename command argument") } if scriptFlags.Args != "" { fmt.Println("⚠️ DEPRECATION WARNING: use arg flag in Type:Value format or args-json for JSON format") if len(scriptFlags.Arg) == 0 && scriptFlags.ArgsJSON == "" { scriptFlags.ArgsJSON = scriptFlags.Args } } value, err := services.Scripts.Execute( filename, scriptFlags.Arg, scriptFlags.ArgsJSON, globalFlags.Network, ) if err != nil { return nil, err } return &ScriptResult{value}, nil }, }
Functions ¶
This section is empty.
Types ¶
type ScriptResult ¶
func (*ScriptResult) Oneliner ¶
func (r *ScriptResult) Oneliner() string
Oneliner show result as one liner grep friendly
func (*ScriptResult) String ¶
func (r *ScriptResult) String() string
String convert result to string
Click to show internal directories.
Click to hide internal directories.