github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/cli/commands/resources/repository/push.go (about) 1 package repositoryCommands 2 3 import ( 4 "github.com/taubyte/tau-cli/cli/common" 5 "github.com/taubyte/tau-cli/flags" 6 "github.com/taubyte/tau-cli/prompts" 7 "github.com/urfave/cli/v2" 8 ) 9 10 func (lib *repositoryCommands) PushCmd() common.Command { 11 return common.Create( 12 &cli.Command{ 13 Flags: []cli.Flag{ 14 flags.CommitMessage, 15 }, 16 Action: lib.Push, 17 }, 18 ) 19 } 20 21 func (lib *repositoryCommands) Push(ctx *cli.Context) error { 22 project, resource, info, err := lib.selectResource(ctx) 23 if err != nil { 24 return err 25 } 26 27 message := prompts.GetOrRequireACommitMessage(ctx) 28 29 _, err = info.Push(project, message, resource.Get().RepositoryURL()) 30 if err != nil { 31 return err 32 } 33 lib.I18nPushed(resource.Get().RepositoryURL(), message) 34 35 return nil 36 }