// Execute runs the JavaScript file specified as the argument.
965953
func (c *Console) Execute(path string) error {
	return c.jsre.Exec(path)
}
1097142
func (c *Cmd) Execute(parentflagset *goflags.FlagSet) bool {
	var index = -1
	// check if this command has been called from app's arguments
	for idx, a := range parentflagset.Args() {
		if c.Name == a {
			index = idx + 1
		}
	}

	// this command hasn't been called from the user
	if index == -1 {
		return false
	}

	//check if it was help sub command
	wasHelp := parentflagset.Arg(1) == "-h"

	if wasHelp {
		// global -help, --help, help, -h now shows all the help for each subcommand and subflags
		Printf("Please use global '-help' or 'help' without quotes, instead.")
		return true
	}

	if !c.flagset.Parsed() {

		if err := c.flagset.Parse(parentflagset.Args()[index:]); err != nil {
			panic("Panic on command.Execute: " + err.Error())
		}
	}

	if err := c.Flags.Validate(); err == nil {
		c.action(c.Flags)

		for idx := range c.Subcommands {
			if c.Subcommands[idx].Execute(c.flagset) {
				break
			}

		}
	} else {
		Printf(err.Error())
	}
	return true

}
1307916
func (cs CommandSet) Execute(command string, args []string) error {
	cmd, ok := cs[command]
	if !ok {
		return fmt.Errorf("unknown command: %s", command)
	}

	for _, arg := range args {
		if arg == "--help" || arg == "-h" || arg == "-help" {
			return cs.Execute("help", []string{command})
		}
	}

	err := cmd.Execute(args)
	if err != nil {
		return fmt.Errorf("could not execute %q: %s", command, err)
	}

	return nil
}
680732
func (p *showPlan) Execute(ctx context.Context) (*table.Table, error) {
	t, err := table.New([]string{"?graph_id"})
	if err != nil {
		return nil, err
	}
	errs := make(chan error)
	names := make(chan string)
	go func() {
		errs <- p.store.GraphNames(ctx, names)
		close(errs)
	}()

	for name := range names {
		id := name
		t.AddRow(table.Row{
			"?graph_id": &table.Cell{
				S: &id,
			},
		})
	}
	if <-errs != nil {
		return nil, err
	}
	return t, nil
}
1031916
func (vf *VindexFunc) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
	return vf.mapVindex(vcursor, bindVars)
}
824245
func Execute() {
	if err := influxCmd.Execute(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}
686280
func (c *Connection) Execute(ex *ExecuteRequest) (*ExecuteResponse, error) {
	c.dbMu.RLock()
	defer c.dbMu.RUnlock()
	if c.db == nil {
		return nil, ErrConnectionDoesNotExist
	}
	return c.store.execute(c, ex)
}
565422
func execute(s string, vars map[string]interface{}) (string, error) {
	expr, diags := hclsyntax.ParseTemplate([]byte(s), "<template_file>", hcl.Pos{Line: 1, Column: 1})
	if diags.HasErrors() {
		return "", diags
	}

	ctx := &hcl.EvalContext{
		Variables: map[string]cty.Value{},
	}
	for k, v := range vars {
		// In practice today this is always a string due to limitations of
		// the schema system. In future we'd like to support other types here.
		s, ok := v.(string)
		if !ok {
			return "", fmt.Errorf("unexpected type for variable %q: %T", k, v)
		}
		ctx.Variables[k] = cty.StringVal(s)
	}

	// We borrow the functions from Terraform itself here. This is convenient
	// but note that this is coming from whatever version of Terraform we
	// have vendored in to this codebase, not from the version of Terraform
	// the user is running, and so the set of functions won't always match
	// between Terraform itself and this provider.
	// (Over time users will hopefully transition over to Terraform's built-in
	// templatefile function instead and we can phase this provider out.)
	scope := &tflang.Scope{
		BaseDir: ".",
	}
	ctx.Functions = scope.Functions()

	result, diags := expr.Value(ctx)
	if diags.HasErrors() {
		return "", diags
	}

	// Our result must always be a string, so we'll try to convert it.
	var err error
	result, err = ctyconvert.Convert(result, cty.String)
	if err != nil {
		return "", fmt.Errorf("invalid template result: %s", err)
	}

	return result.AsString(), nil
}
284927
func (c *DriverStatus) Execute(args []string) error {
	App.initializeLogging()
	directory := GetDefaultDriver(string(c.Args.Path))
	logger := log.WithFields(log.Fields{
		"directory": directory,
	})
	driver, err := InitDriverIfExists(directory)
	if err != nil {
		logger.Fatal(err)
	}
	logger = logger.WithFields(log.Fields{
		"type": driver.DriverType(),
	})
	status, err := driver.Status()
	if err != nil {
		logger.Fatal(err)
	}
	fmt.Println(directory)
	fmt.Println(status.String())
	return nil
}
222517
func (command *DocsCommand) Execute() error {
	log.Debug("Generating api docs in %s", command.Format)
	apiDef := new(raml.APIDefinition)
	err := raml.ParseFile(command.RamlFile, apiDef)
	if err != nil {
		return err
	}
	return codegen.GenerateDocs(apiDef, command.Format, command.OutputFile)
}
446320
func (c *DriverDisable) Execute(args []string) error {
	App.initializeLogging()
	directory := GetDefaultDriver(string(c.Args.Path))
	logger := log.WithFields(log.Fields{
		"directory": directory,
	})
	driver, err := InitDriverIfExists(directory)
	if err != nil {
		log.Fatal(err)
	}
	logger = logger.WithFields(log.Fields{
		"type": driver.DriverType(),
	})
	if err := driver.Cleanup(); err != nil {
		logger.Fatal(err)
	}
	logger.Info("Disabled driver")
	return nil
}
1299435
func (c *controlBuffer) execute(f func(it interface{}) bool, it interface{}) (bool, error) {
	c.mu.Lock()
	if c.err != nil {
		c.mu.Unlock()
		return false, c.err
	}
	if !f(it) { // f wasn't successful
		c.mu.Unlock()
		return false, nil
	}
	c.mu.Unlock()
	return true, nil
}
1088353
func (command *PythonCapnp) Execute() error {
	var apiDef raml.APIDefinition

	log.Debug("Generating python classes with capnp conversion")

	err := raml.ParseFile(command.RAMLFile, &apiDef)
	if err != nil {
		return err
	}
	return codegen.GeneratePythonCapnp(&apiDef, command.Dir)
}
1077865
func (ra *runAction) Execute(state State) (*State, error) {
	message := fmt.Sprintf("running action %s", ra.name)

	if err := ra.callbacks.SetExecutingStatus(message); err != nil {
		return nil, err
	}

	err := ra.runner.RunAction(ra.name)
	if err != nil {
		// This indicates an actual error -- an action merely failing should
		// be handled inside the Runner, and returned as nil.
		return nil, errors.Annotatef(err, "running action %q", ra.name)
	}
	return stateChange{
		Kind:     RunAction,
		Step:     Done,
		ActionId: &ra.actionId,
		Hook:     state.Hook,
	}.apply(state), nil
}
602901
func (e *ClientExecutor) Execute(b *imagebuilder.Builder, node *parser.Node) error {
	for i, child := range node.Children {
		step := b.Step()
		if err := step.Resolve(child); err != nil {
			return err
		}
		glog.V(4).Infof("step: %s", step.Original)
		if e.LogFn != nil {
			// original may have unescaped %, so perform fmt escaping
			e.LogFn(strings.Replace(step.Original, "%", "%%", -1))
		}
		noRunsRemaining := !b.RequiresStart(&parser.Node{Children: node.Children[i+1:]})

		if err := b.Run(step, e, noRunsRemaining); err != nil {
			return err
		}
	}

	return nil
}
957664
func Execute(args []string) Response {
	hugoCmd := newCommandsBuilder().addAll().build()
	cmd := hugoCmd.getCommand()
	cmd.SetArgs(args)

	c, err := cmd.ExecuteC()

	var resp Response

	if c == cmd && hugoCmd.c != nil {
		// Root command executed
		resp.Result = hugoCmd.c.hugo
	}

	if err == nil {
		errCount := int(loggers.GlobalErrorCounter.Count())
		if errCount > 0 {
			err = fmt.Errorf("logged %d errors", errCount)
		} else if resp.Result != nil {
			errCount = resp.Result.NumLogErrors()
			if errCount > 0 {
				err = fmt.Errorf("logged %d errors", errCount)
			}
		}

	}

	resp.Err = err
	resp.Cmd = c

	return resp
}
1129956
func (s *SpecFile) Execute(args []string) error {
	input, err := loadSpec(string(s.Input))
	if err != nil {
		return err
	}

	var opts scan.Opts
	opts.BasePath = s.BasePath
	opts.Input = input
	opts.ScanModels = s.ScanModels
	opts.BuildTags = s.BuildTags
	opts.Include = s.Include
	opts.Exclude = s.Exclude
	opts.IncludeTags = s.IncludeTags
	opts.ExcludeTags = s.ExcludeTags
	swspec, err := scan.Application(opts)
	if err != nil {
		return err
	}

	return writeToFile(swspec, !s.Compact, string(s.Output))
}