1 /*
2 * Copyright (c) 2025 Alex Fabre
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include "app_version.h"
8 #include <zephyr/shell/shell.h>
9
cmd_app_version_string(const struct shell * sh)10 static int cmd_app_version_string(const struct shell *sh)
11 {
12 shell_print(sh, APP_VERSION_STRING);
13 return 0;
14 }
15
cmd_app_version_extended_string(const struct shell * sh)16 static int cmd_app_version_extended_string(const struct shell *sh)
17 {
18 shell_print(sh, APP_VERSION_EXTENDED_STRING);
19 return 0;
20 }
21
cmd_app_build_version(const struct shell * sh)22 static int cmd_app_build_version(const struct shell *sh)
23 {
24 shell_print(sh, STRINGIFY(APP_BUILD_VERSION));
25 return 0;
26 }
27
28 SHELL_STATIC_SUBCMD_SET_CREATE(
29 sub_app,
30 SHELL_CMD(version, NULL, "Application version. (ex. \"1.2.3-unstable.5\")",
31 cmd_app_version_string),
32 SHELL_CMD(version - extended, NULL,
33 "Application version extended. (ex. \"1.2.3-unstable.5+4\")",
34 cmd_app_version_extended_string),
35 SHELL_CMD(build - version, NULL,
36 "Application build version. (ex. \"v3.3.0-18-g2c85d9224fca\")",
37 cmd_app_build_version),
38 SHELL_SUBCMD_SET_END /* Array terminated. */
39 );
40
41 SHELL_CMD_REGISTER(app, &sub_app, "Application version information commands", NULL);
42