Add recipe ls command #8
No reviewers
Labels
No Label
bug
build
ci/cd
contributing
design
documentation
duplicate
enhancement
help wanted
invalid
meta
question
security
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: coop-cloud/abra#8
Loading…
Reference in New Issue
No description provided.
Delete Branch "recipe-ls"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This works and outputs a sorted list of apps 😀
Not sure how I should organise the helpers tho, any thoughts?
Also, what can be tested here? Can I mock the JSON to do offline tests?
Not much to review since most of it is good! Just one note, and a situation where you don't return an error where you should. So gunna label it as requesting a change for that reason but its a one line change 💙
@ -0,0 +61,4 @@
url := "https://apps.coopcloud.tech"
apps := make(AppsJson)
if err := getJson(url, &apps); err != nil {
logrus.Fatal(err.Error())
Your function never returns this error. It is just logging it and exiting the program. You should change this to
return nil, err
. This can then be dealt with by the command itself.@ -0,0 +83,4 @@
Action: func(c *cli.Context) error {
apps, err := GetAppsJSON()
if err != nil {
logrus.Fatal(err.Error())
This will never be run because you never return an error, see comment on
GetAppsJSON
@ -0,0 +87,4 @@
}
tableCol := []string{"Name", "Category", "Status"}
table := createTable(tableCol)
for _, name := range sortByAppName(apps) {
I am not totally against this approach. I worry about the speed of it but honestly might just say fuck it and use this as our baseline for sorting maps.
I've seen rumblings on mocking an actual http call in a unit test for a mock one that returns what ever you want. No rush on that right now since this is early days.
5f4d2b88f5
to302ebcb394
WIP: add recipe ls commandto Add recipe ls commandFixed that one-liner, rebased and will merge when CI is green 🚀