Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys/shell: ncput: add option to read from stdin #18639

Merged
merged 2 commits into from
Oct 6, 2022

Conversation

benpicco
Copy link
Contributor

Contribution description

ncput is a useful command line tool to interact with a CoAP server.
In addition to uploading files, also add an option to put data directly from the command line in the same fashion was we can tell ncget to output to the command line instead of to a file.

Testing procedure

  • in one terminal, start examples/nanocoap_server
  • in another terminal, start tests/nanocoap_cli:
> ncget coap://[fe80::581a:98ff:fe23:2d6c]/.well-known/core -
</.well-known/core>,</echo/>,</riot/board>,</riot/value>,</riot/ver>,</sha256>

> ncget coap://[fe80::581a:98ff:fe23:2d6c]/riot/value -
0

> ncput - coap://[fe80::581a:98ff:fe23:2d6c]/riot/value 23
Saved to coap://[fe80::581a:98ff:fe23:2d6c]/riot/value

> ncget coap://[fe80::581a:98ff:fe23:2d6c]/riot/value -
23

Issues/PRs references

@github-actions github-actions bot added Area: CoAP Area: Constrained Application Protocol implementations Area: network Area: Networking Area: sys Area: System labels Sep 23, 2022
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Sep 24, 2022
@benpicco benpicco requested a review from kfessel September 30, 2022 14:46
@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Oct 5, 2022
Copy link
Member

@chrysn chrysn 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, tested with aiocoap-fileserver.

The CLI of using - to refer to a last argument is a bit weird (I'd have expected it to point to stdin), but it's still straightforward enough, and the error message is helpful.

@benpicco benpicco enabled auto-merge October 5, 2022 21:42
@benpicco benpicco merged commit 4493afb into RIOT-OS:master Oct 6, 2022
@benpicco benpicco deleted the nanocoap_sock_put_url branch October 6, 2022 10:47
@maribu maribu added this to the Release 2022.10 milestone Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CoAP Area: Constrained Application Protocol implementations Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants