github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/prompts/internal/memory.go (about) 1 package main 2 3 import ( 4 "github.com/pterm/pterm" 5 "github.com/taubyte/go-project-schema/common" 6 "github.com/taubyte/tau-cli/flags" 7 "github.com/taubyte/tau-cli/prompts" 8 "github.com/urfave/cli/v2" 9 ) 10 11 var MemoryCommand = &cli.Command{ 12 Name: "memory", 13 Flags: []cli.Flag{ 14 flags.Memory, 15 flags.MemoryUnit, 16 }, 17 Action: func(ctx *cli.Context) error { 18 19 // New 20 size, err := prompts.GetOrRequireMemoryAndType(ctx, true) 21 if err != nil { 22 return err 23 } 24 25 // Edit, sending empty cli context so that the flags are not set 26 size, err = prompts.GetOrRequireMemoryAndType(&cli.Context{}, false, size) 27 if err != nil { 28 return err 29 } 30 31 pterm.Success.Printfln("Got memory size: `%s`", common.UnitsToString(size)) 32 return nil 33 }, 34 }