github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/prompts/smartops/edit.go (about)

     1  package smartopsPrompts
     2  
     3  import (
     4  	structureSpec "github.com/taubyte/go-specs/structure"
     5  	"github.com/taubyte/tau-cli/prompts"
     6  	"github.com/urfave/cli/v2"
     7  )
     8  
     9  func Edit(ctx *cli.Context, smartops *structureSpec.SmartOp) (err error) {
    10  	smartops.Description = prompts.GetOrAskForADescription(ctx, smartops.Description)
    11  	smartops.Tags = prompts.GetOrAskForTags(ctx, smartops.Tags)
    12  
    13  	smartops.Timeout, err = prompts.GetOrRequireATimeout(ctx, smartops.Timeout)
    14  	if err != nil {
    15  		return
    16  	}
    17  
    18  	smartops.Memory, err = prompts.GetOrRequireMemoryAndType(ctx, false, smartops.Memory)
    19  	if err != nil {
    20  		return
    21  	}
    22  
    23  	source, err := prompts.GetOrSelectSource(ctx, smartops.Source)
    24  	if err != nil {
    25  		return
    26  	}
    27  	smartops.Source = source.String()
    28  
    29  	smartops.Call = prompts.GetOrRequireACall(ctx, source, smartops.Call)
    30  
    31  	return
    32  }