shell_commands: provide command to print version

This commit is contained in:
Martine S. Lenders 2020-01-17 10:28:51 +01:00
parent c7f29c2ea4
commit 5fd88ab44a
No known key found for this signature in database
GPG Key ID: CCD317364F63286F
2 changed files with 14 additions and 0 deletions

View File

@ -18,6 +18,8 @@
* @} * @}
*/ */
#include <stdio.h>
#include "periph/pm.h" #include "periph/pm.h"
int _reboot_handler(int argc, char **argv) int _reboot_handler(int argc, char **argv)
@ -29,3 +31,13 @@ int _reboot_handler(int argc, char **argv)
return 0; return 0;
} }
int _version_handler(int argc, char **argv)
{
(void) argc;
(void) argv;
puts(RIOT_VERSION);
return 0;
}

View File

@ -24,6 +24,7 @@
#include "shell_commands.h" #include "shell_commands.h"
extern int _reboot_handler(int argc, char **argv); extern int _reboot_handler(int argc, char **argv);
extern int _version_handler(int argc, char **argv);
#ifdef MODULE_CONFIG #ifdef MODULE_CONFIG
extern int _id_handler(int argc, char **argv); extern int _id_handler(int argc, char **argv);
@ -172,6 +173,7 @@ extern int _suit_handler(int argc, char **argv);
const shell_command_t _shell_command_list[] = { const shell_command_t _shell_command_list[] = {
{"reboot", "Reboot the node", _reboot_handler}, {"reboot", "Reboot the node", _reboot_handler},
{"version", "Prints current RIOT_VERSION", _version_handler},
#ifdef MODULE_CONFIG #ifdef MODULE_CONFIG
{"id", "Gets or sets the node's id.", _id_handler}, {"id", "Gets or sets the node's id.", _id_handler},
#endif #endif