From 9eb47f3248af2864b407bb6895666864d21f7cab Mon Sep 17 00:00:00 2001 From: Paulo Truta Date: Wed, 9 Feb 2022 23:27:33 +0000 Subject: [PATCH] Implemented list command + task. colorjson output disabled for this command (bug detected) --- cmd/edgeboxctl/main.go | 10 ++++++++++ internal/tasks/tasks.go | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/cmd/edgeboxctl/main.go b/cmd/edgeboxctl/main.go index aed4ad3..4b9c9fc 100644 --- a/cmd/edgeboxctl/main.go +++ b/cmd/edgeboxctl/main.go @@ -95,6 +95,16 @@ func main() { Aliases: []string{"a"}, Usage: "options for edgeapp management", Subcommands: []*cli.Command{ + { + Name: "list", + Aliases: []string{"i"}, + Usage: "list currently installed apps and their status", + Action: func(c *cli.Context) error { + task := getCommandTask("list_edgeapps", "", true) + // return cli.Exit(utils.ColorJsonString(task.Result.String), 0) + return cli.Exit(task.Result.String, 0) + }, + }, { Name: "install", Aliases: []string{"i"}, diff --git a/internal/tasks/tasks.go b/internal/tasks/tasks.go index 37adc21..43c8aab 100644 --- a/internal/tasks/tasks.go +++ b/internal/tasks/tasks.go @@ -161,6 +161,12 @@ func ExecuteTask(task Task) Task { task.Result = sql.NullString{String: taskResult, Valid: true} } + case "list_edgeapps": + + log.Println("Fetching current status on Edgeapps...") + taskResult := taskGetEdgeApps() + task.Result = sql.NullString{String: taskResult, Valid: true} + case "install_edgeapp": log.Println("Installing EdgeApp...")