Skip to content

✨ commands: Add Write#39

Draft
chrysn wants to merge 1 commit into
Teufelchen1:mainfrom
chrysn-pull-requests:write
Draft

✨ commands: Add Write#39
chrysn wants to merge 1 commit into
Teufelchen1:mainfrom
chrysn-pull-requests:write

Conversation

@chrysn

@chrysn chrysn commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

This is a first sketch of a PUTting write command.

Quoting the module docs:

Open issues:

  • We should really GET first to
    • know the typical content format (OK that could come from metadata too)
    • know the last ETag the user saw (unless they force-push, aeh, force-put)
    • For that, we need to be told of every request.
  • This should be available unconditionally (but, later when we auto-complete in commands, maybe
    prefer resources that are annotated to be writable … oh, core-interfaces is still stalled)
  • Am I doing error handling right?
  • Maybe this should be more of an interactive edit command?


use super::Command;
use super::CommandHandler;
// use super::CommandRegistry; // Look moo no handler!

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Yes, I took that thought and run with it. Removed in 0bdde23

MultiEndpointSample::cmd(),
MemRead::cmd(),
Ps::cmd(),
write::cmd(),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Initially, I did not like it this way but now after some time has passed, I believe this is the better way to do it. Less confusing, less mixing of things that don't really belong together.

struct WriteCommand {
path: String,
value: Vec<u8>,
// We only get &self in display but the error comes up in handle where we can't print; shoving

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Would you prefer fn handle(&mut self, ..) -> Result<Option<CoapRequest<String>>, (error-)String>?

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