This commit is contained in:
2024-05-25 23:17:10 +03:00
parent ea8f6b4ce0
commit 3690b91e16
13 changed files with 197 additions and 17 deletions

14
shell.c
View File

@@ -3,6 +3,7 @@
#include "shell.h"
#include "tty.h"
#include "string.h"
#include "rtc.h"
void shell_init(void)
{
@@ -53,6 +54,7 @@ void shell_help_command(void)
terminal_printf("exit - Exit the shell.\n");
terminal_printf("echo - Print out the message. &eWITH colors!&7\n");
terminal_printf("clear - Clear the terminal.\n");
terminal_printf("time - Print out the current time. (UTC)\n");
}
void shell_exit_command(void)
@@ -63,6 +65,14 @@ void shell_exit_command(void)
;
}
void shell_time_command(void)
{
struct Rtc_time current_time = get_rtc_time();
terminal_printf("Current time: %02d:%02d:%02d %02d.%02d.%d\n",
current_time.hour, current_time.min, current_time.sec,
current_time.mday, current_time.mon, current_time.year);
}
void shell_echo_command(char *input)
{
char *message = input;
@@ -102,6 +112,10 @@ void shell_parse_input(char *input)
{
terminal_clear();
}
else if (strcmp(command, "time") == 0)
{
shell_time_command();
}
else
{
terminal_printf("Unknown command: '");