mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 22:52:45 +01:00
25 lines
589 B
Rust
25 lines
589 B
Rust
#![no_std]
|
|
|
|
use core::fmt::Write;
|
|
use riot_wrappers::println;
|
|
|
|
riot_wrappers::static_command!(
|
|
static_hello_world,
|
|
"hello_world",
|
|
"Print a greeting",
|
|
hello_world
|
|
);
|
|
|
|
pub fn hello_world<'a>(_w: &mut impl Write, args: impl IntoIterator<Item = &'a str>) {
|
|
let mut args = args.into_iter();
|
|
let commandname = args
|
|
.next()
|
|
.expect("How was this started without an argv[0]?");
|
|
|
|
match args.next() {
|
|
Some("--help") => println!("Usage: {commandname}"),
|
|
None => println!("Hello RIOT!"),
|
|
_ => println!("Invalid argument."),
|
|
};
|
|
}
|