1 /*
2 * Copyright (c) 2019,2020 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <stdlib.h>
8 #include <ctype.h>
9 #include <shell/shell.h>
10
11 #if CONFIG_PSA_SHELL
12
13 static int
psa_shell_invalid_arg(const struct shell * shell,char * arg_name)14 psa_shell_invalid_arg(const struct shell *shell, char *arg_name)
15 {
16 shell_print(shell, "Error: invalid argument \"%s\"\n", arg_name);
17
18 return -EINVAL;
19 }
20
21 static int
psa_shell_cmd_version(const struct shell * shell,size_t argc,char ** argv)22 psa_shell_cmd_version(const struct shell *shell, size_t argc, char **argv)
23 {
24 shell_print(shell, "%s", "0.0.0");
25
26 return 0;
27 }
28
29 /* Subcommand array for "psa" (level 1). */
30 SHELL_STATIC_SUBCMD_SET_CREATE(sub_psa,
31 /* 'version' command handler. */
32 SHELL_CMD(version, NULL, "app version", psa_shell_cmd_version),
33 /* Array terminator. */
34 SHELL_SUBCMD_SET_END
35 );
36
37 /* Root command "psa" (level 0). */
38 SHELL_CMD_REGISTER(psa, &sub_psa, "PSA commands", NULL);
39
40 #endif
41