Skip to content

Return the created devices as json.#1076

Merged
floitsch merged 3 commits into
mainfrom
floitsch/add-devices-json-output
Jun 10, 2024
Merged

Return the created devices as json.#1076
floitsch merged 3 commits into
mainfrom
floitsch/add-devices-json-output

Conversation

@floitsch
Copy link
Copy Markdown
Member

@floitsch floitsch commented Jun 7, 2024

No description provided.

@floitsch floitsch requested a review from kasperl June 7, 2024 14:40
Copy link
Copy Markdown
Contributor

@kasperl kasperl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Comment thread src/cli/cmds/fleet.toit
--group=group
--output-directory=output-directory
written-count++
written-ids["$id"] = path
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you get a map from id to path out. Cute.

Comment thread src/cli/cmds/fleet.toit Outdated
printer.emit-structured
--json=: written-ids
--stdout=: | printer/Printer |
if count == written-ids.size or written-ids.size > 0:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If find it hard to reason about the condition here. Maybe add a comment to explain what is going on?

If we've written the last one (count == written-ids.size) then it makes sense to report the number of files created. Why does it make sense to always repoted this if written-ids.size > 0?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improved the code and added a comment.
done.

@floitsch floitsch enabled auto-merge (squash) June 10, 2024 15:08
@floitsch floitsch merged commit 4813329 into main Jun 10, 2024
@floitsch floitsch deleted the floitsch/add-devices-json-output branch June 10, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants