func (a *api) Run(input common.PluginInput, output *common.PluginOutput) error {
	modeArg := input.Args.String("mode")
	ctx := context.TODO()

	var err error
	if modeArg == "" || modeArg == "add" {
		client := util.NewClient(input.ServerConnection)
		err = exampleCommon.AddTag(ctx, client)
	} else if modeArg == "remove" {
		client := util.NewClient(input.ServerConnection)
		err = exampleCommon.RemoveTag(ctx, client)
	} else if modeArg == "long" {
		err = a.doLongTask()
	} else if modeArg == "indef" {
		err = a.doIndefiniteTask()
	}

	if err != nil {
		errStr := err.Error()
		*output = common.PluginOutput{
			Error: &errStr,
		}
		return nil
	}

	outputStr := "ok"
	*output = common.PluginOutput{
		Output: &outputStr,
	}

	return nil
}
// Run is the main work function of the plugin. It interprets the input and
// acts accordingly.
Run is the main work function of the plugin. It interprets the input and
acts accordingly.
// Run is the main work function of the plugin . It interprets the input and // acts accordingly .
func (a *api) Run(input common.PluginInput, output *common.PluginOutput) error {
	modeArg := input.Args.String("mode")
	ctx := context.TODO()
	var err error
	if modeArg == "" || modeArg == "add" {
		client := util.NewClient(input.ServerConnection)
		err = exampleCommon.AddTag(ctx, client)
	} else if modeArg == "remove" {
		client := util.NewClient(input.ServerConnection)
		err = exampleCommon.RemoveTag(ctx, client)
	} else if modeArg == "long" {
		err = a.doLongTask()
	} else if modeArg == "indef" {
		err = a.doIndefiniteTask()
	}
	if err != nil {
		errStr := err.Error()
		*output = common.PluginOutput{
			Error: &errStr,
		}
		return nil
	}
	outputStr := "ok"
	*output = common.PluginOutput{
		Output: &outputStr,
	}
	return nil
}
func ( a * api ) Run ( input common . PluginInput , output * common . PluginOutput ) error { modeArg := input . Args . String ( " " ) ctx := context . TODO ( ) var err error if modeArg == " " || modeArg == " " { client := util . NewClient ( input . ServerConnection ) err = exampleCommon . AddTag ( ctx , client ) } else if modeArg == " " { client := util . NewClient ( input . ServerConnection ) err = exampleCommon . RemoveTag ( ctx , client ) } else if modeArg == " " { err = a . doLongTask ( ) } else if modeArg == " " { err = a . doIndefiniteTask ( ) } if err != nil { errStr := err . Error ( ) * output = common . PluginOutput { Error : & errStr , } return nil } outputStr := " " * output = common . PluginOutput { Output : & outputStr , } return nil }
Run is the main work function of the plugin.
Run is the main work function of the plugin .