portainer-devtool/go/tasks/subtasks/list_repository.go

35 lines
688 B
Go
Raw Permalink Normal View History

2022-12-26 18:55:06 +11:00
package subtasks
import (
"ocl/portainer-devtool/configs"
"ocl/portainer-devtool/utils"
"strings"
)
type ListRepositorySubTask struct {
Config *configs.Config
}
func NewListRepositorySubTask(cfg *configs.Config) *ListRepositorySubTask {
return &ListRepositorySubTask{
Config: cfg,
}
}
func (task *ListRepositorySubTask) Execute() error {
utils.InputPrint("Which repository?")
repositoryList := []string{" "}
for _, repo := range task.Config.RepositoryConfig {
repositoryList = append(repositoryList, repo.Name)
}
utils.SuccessPrint(strings.Join(repositoryList, "\n"))
return nil
}
func (task *ListRepositorySubTask) String() string {
return "List Repositories"
}