Add recipe ls command #8

Merged
decentral1se merged 1 commits from recipe-ls into main 2021-07-21 11:30:15 +00:00
Owner

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?

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?
decentral1se added 1 commit 2021-07-21 09:02:05 +00:00
continuous-integration/drone/pr Build is passing Details
bb537919be
feat: add recipe ls command
roxxers requested changes 2021-07-21 09:14:56 +00:00
roxxers left a comment
First-time contributor

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 💙

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 💙
cli/recipe.go Outdated
@ -0,0 +61,4 @@
url := "https://apps.coopcloud.tech"
apps := make(AppsJson)
if err := getJson(url, &apps); err != nil {
logrus.Fatal(err.Error())
First-time contributor

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.

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.
decentral1se marked this conversation as resolved
cli/recipe.go Outdated
@ -0,0 +83,4 @@
Action: func(c *cli.Context) error {
apps, err := GetAppsJSON()
if err != nil {
logrus.Fatal(err.Error())
First-time contributor

This will never be run because you never return an error, see comment on GetAppsJSON

This will never be run because you never return an error, see comment on `GetAppsJSON`
decentral1se marked this conversation as resolved
cli/recipe.go Outdated
@ -0,0 +87,4 @@
}
tableCol := []string{"Name", "Category", "Status"}
table := createTable(tableCol)
for _, name := range sortByAppName(apps) {
First-time contributor

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 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.
roxxers marked this conversation as resolved
First-time contributor

Also, what can be tested here? Can I mock the JSON to do offline tests?

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.

> Also, what can be tested here? Can I mock the JSON to do offline tests? 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.
roxxers added the
enhancement
label 2021-07-21 09:26:42 +00:00
decentral1se force-pushed recipe-ls from 5f4d2b88f5 to 302ebcb394 2021-07-21 11:28:55 +00:00 Compare
decentral1se changed title from WIP: add recipe ls command to Add recipe ls command 2021-07-21 11:29:03 +00:00
Author
Owner

Fixed that one-liner, rebased and will merge when CI is green 🚀

Fixed that one-liner, rebased and will merge when CI is green 🚀
decentral1se merged commit 05ff163386 into main 2021-07-21 11:30:15 +00:00
decentral1se deleted branch recipe-ls 2021-07-21 11:30:31 +00:00
Sign in to join this conversation.
No description provided.