github.com/jfrog/jfrog-cli-go@v1.22.1-0.20200318093948-4826ef344ffd/artifactory/commands/repository/delete.go (about) 1 package repository 2 3 import ( 4 rtUtils "github.com/jfrog/jfrog-cli-go/artifactory/utils" 5 "github.com/jfrog/jfrog-cli-go/utils/cliutils" 6 "github.com/jfrog/jfrog-cli-go/utils/config" 7 ) 8 9 type RepoDeleteCommand struct { 10 rtDetails *config.ArtifactoryDetails 11 repoKey string 12 quiet bool 13 } 14 15 func NewRepoDeleteCommand() *RepoDeleteCommand { 16 return &RepoDeleteCommand{} 17 } 18 19 func (rdc *RepoDeleteCommand) SetRepoKey(repoKey string) *RepoDeleteCommand { 20 rdc.repoKey = repoKey 21 return rdc 22 } 23 24 func (rdc *RepoDeleteCommand) SetQuiet(quiet bool) *RepoDeleteCommand { 25 rdc.quiet = quiet 26 return rdc 27 } 28 29 func (rdc *RepoDeleteCommand) SetRtDetails(rtDetails *config.ArtifactoryDetails) *RepoDeleteCommand { 30 rdc.rtDetails = rtDetails 31 return rdc 32 } 33 34 func (rdc *RepoDeleteCommand) RtDetails() (*config.ArtifactoryDetails, error) { 35 return rdc.rtDetails, nil 36 } 37 38 func (rdc *RepoDeleteCommand) CommandName() string { 39 return "rt_repo_delete" 40 } 41 42 func (rdc *RepoDeleteCommand) Run() (err error) { 43 if !rdc.quiet && !cliutils.InteractiveConfirm("Are you sure you want to permanently delete the repository "+rdc.repoKey+" including all of it content?") { 44 return nil 45 } 46 servicesManager, err := rtUtils.CreateServiceManager(rdc.rtDetails, false) 47 if err != nil { 48 return err 49 } 50 return servicesManager.DeleteRepository(rdc.repoKey) 51 }