subtask: add list repository task
This commit is contained in:
parent
d3056fc0c9
commit
7f2afd1bdb
1
go/.gitignore
vendored
Normal file
1
go/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/test
|
@ -18,6 +18,7 @@ func NewListDevToolCommandTask(cfg *configs.Config) *ListDevToolCommandTask {
|
||||
func (task *ListDevToolCommandTask) Execute() error {
|
||||
subTaskItems := []Tasker{
|
||||
subtasks.NewListVolumeSubTask(task.Config),
|
||||
subtasks.NewListRepositorySubTask(task.Config),
|
||||
}
|
||||
|
||||
ListCommandMenu(subTaskItems, "Which management commands do you want to choose:")
|
||||
|
34
go/tasks/subtasks/list_repository.go
Normal file
34
go/tasks/subtasks/list_repository.go
Normal file
@ -0,0 +1,34 @@
|
||||
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"
|
||||
}
|
@ -50,7 +50,7 @@ func (task *ListVolumeSubTask) Execute() error {
|
||||
}
|
||||
|
||||
func (task *ListVolumeSubTask) String() string {
|
||||
return "List Volume"
|
||||
return "List Volumes"
|
||||
}
|
||||
|
||||
func lenPath(path string) int {
|
||||
|
Loading…
Reference in New Issue
Block a user