// Execute expands the spec
542329
func (c *ExpandSpec) Execute(args []string) error {
	if len(args) != 1 {
		return errors.New("The expand command requires the single swagger document url to be specified")
	}

	swaggerDoc := args[0]
	specDoc, err := loads.Spec(swaggerDoc)
	if err != nil {
		return err
	}

	exp, err := specDoc.Expanded()
	if err != nil {
		return err
	}

	return writeToFile(exp.Spec(), !c.Compact, c.Format, string(c.Output))
}
707816
func (i *DefaultInterpreter) Execute(
	expression string,
	ctx *Context) (interface{}, error) {
	funcs := template.FuncMap{}
	for k, v := range i.Funcs {
		funcs[k] = v
	}
	var res interface{}
	resultEvaluated := false
	funcs["set"] = func(r interface{}) interface{} {
		res = r
		resultEvaluated = true
		return r
	}
	funcs["eval"] = func(intrpr, expr string) (interface{}, error) {
		return ctx.EvalExpr(intrpr, expr, ctx)
	}
	templName := fmt.Sprintf("<<%s>>", ctx.LongName)
	left := i.LeftDelim
	right := i.RightDelim
	if left == "" {
		left = "{{"
	}
	if right == "" {
		right = "}}"
	}
	if i.AutoEnclose &&
		!(strings.HasPrefix(expression, left) &&
			strings.HasSuffix(expression, right)) {
		expression = fmt.Sprintf("%s%s%s", left, expression, right)
	}
	t, err := template.
		New(templName).
		Delims(left, right).
		Funcs(funcs).
		Parse(expression)
	if err != nil {
		return nil, err
	}
	var buf bytes.Buffer
	err = t.Execute(&buf, ctx)
	if err != nil {
		return nil, err
	}
	if resultEvaluated {
		return res, nil
	}
	return buf.String(), nil
}
501726
func (c *SchemaCheck) Execute(args []string) error {
	return c.doSchemaOp(schemaCheck, dosa.AdminClient.CanUpsertSchema, c.Args.Paths)
}
1313090
func (c *CCProviderImpl) Execute(txParams *ccprovider.TransactionParams, cccid *ccprovider.CCContext, input *pb.ChaincodeInput) (*pb.Response, *pb.ChaincodeEvent, error) {
	return c.cs.Execute(txParams, cccid, input)
}
204503
func (w *UserTypesWriter) Execute(t *design.UserTypeDefinition) error {
	fn := template.FuncMap{
		"finalizeCode":   w.Finalizer.Code,
		"validationCode": w.Validator.Code,
	}
	return w.ExecuteTemplate("types", userTypeT, fn, t)
}
14634
func (c *DriverInit) Execute(args []string) error {
	App.initializeLogging()
	driverType, err := volume.StringToDriverType(c.Args.Type)
	if err != nil {
		log.Fatal(err)
	}
	path := string(c.Args.Path)
	logger := log.WithFields(log.Fields{
		"directory": path,
		"type":      driverType,
	})
	logger.Info("Initializing storage driver")
	if err := volume.InitDriver(driverType, path, App.Options.Options); err != nil {
		log.Fatal(err)
	}
	logger.Info("Storage driver initialized successfully")
	return nil
}
428172
func (cli *SeesawCLI) Execute(cmdline string) error {
	cmd, subcmds, _, args := FindCommand(cmdline)
	if cmd != nil {
		return cmd.function(cli, args)
	}
	if subcmds != nil {
		return errors.New("Incomplete command.")
	}
	return errors.New("Unknown command.")
}
250096
func Execute(pattern string, item interface{}) string {
	r := regexp.MustCompile(`{{(.*?)}}`)
	m := r.FindAllStringSubmatch(pattern, -1)

	if len(m) == 0 {
		return pattern
	}

	fields := []FieldInfo{}
	for _, mi := range m {
		fields = append(fields, ParseFieldInfoString(mi[1])...)
	}

	return fmt.Sprintf(
		r.ReplaceAllString(pattern, "%v"),
		GetFieldsFormattedForce(item, fields)...)
}
1147314
func (tx *TX) Execute(stmt Executable, args ...interface{}) (sql.Result, error) {
	s, params, err := tx.compile(stmt)
	if err != nil {
		return nil, err
	}

	// Use any arguments given to Query() over compiled arguments
	if len(args) == 0 {
		args = params.args
	}
	return tx.Exec(s, args...)
}
933429
func (c *VolumeResize) Execute(args []string) error {
	App.initializeLogging()
	directory := GetDefaultDriver(string(c.Path))
	driver, err := InitDriverIfExists(directory)
	if err != nil {
		log.Fatal(err)
	}
	logger := log.WithFields(log.Fields{
		"directory": driver.Root(),
		"volume":    c.Args.Name,
		"type":      driver.DriverType(),
	})
	if driver.DriverType() != volume.DriverTypeDeviceMapper {
		logger.Fatal("Only devicemapper volumes can be resized")
	}
	if !driver.Exists(c.Args.Name) {
		logger.Fatal("Volume does not exist")
	}
	size, err := units.RAMInBytes(c.Args.Size)
	if err != nil {
		return err
	}
	if err := driver.Resize(c.Args.Name, uint64(size)); err != nil {
		logger.Fatal(err)
	}
	logger.Info("Volume resized")
	return nil
}
1206165
func (f InterpreterFunc) Execute(s string, ctx *Context) (interface{}, error) {
	return f(s, ctx)
}
632374
func (c *ScopeTruncate) Execute(args []string) error {
	return c.doScopeOp("truncate", dosa.AdminClient.TruncateScope, c.Args.Scopes)
}
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
}
619286
func (sq *Subquery) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
	inner, err := sq.Subquery.Execute(vcursor, bindVars, wantfields)
	if err != nil {
		return nil, err
	}
	return sq.buildResult(inner), nil
}
1002921
func (e *Env) Execute(src string) (interface{}, error) {
	return e.ExecuteContext(context.Background(), src)
}
725576
func (q *StreamHealthQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
	return &sqltypes.Result{}, nil
}
1017420
func (exec *TabletExecutor) Execute(ctx context.Context, sqls []string) *ExecuteResult {
	execResult := ExecuteResult{}
	execResult.Sqls = sqls
	if exec.isClosed {
		execResult.ExecutorErr = "executor is closed"
		return &execResult
	}
	startTime := time.Now()
	defer func() { execResult.TotalTimeSpent = time.Since(startTime) }()

	// Lock the keyspace so our schema change doesn't overlap with other
	// keyspace-wide operations like resharding migrations.
	ctx, unlock, lockErr := exec.wr.TopoServer().LockKeyspace(ctx, exec.keyspace, "ApplySchemaKeyspace")
	if lockErr != nil {
		execResult.ExecutorErr = lockErr.Error()
		return &execResult
	}
	defer func() {
		// This is complicated because execResult.ExecutorErr
		// is not of type error.
		var unlockErr error
		unlock(&unlockErr)
		if execResult.ExecutorErr == "" && unlockErr != nil {
			execResult.ExecutorErr = unlockErr.Error()
		}
	}()

	// Make sure the schema changes introduce a table definition change.
	if err := exec.preflightSchemaChanges(ctx, sqls); err != nil {
		execResult.ExecutorErr = err.Error()
		return &execResult
	}

	for index, sql := range sqls {
		execResult.CurSQLIndex = index
		exec.executeOnAllTablets(ctx, &execResult, sql)
		if len(execResult.FailedShards) > 0 {
			break
		}
	}
	return &execResult
}