Skip to content

Commit

Permalink
add ls command to ksh
Browse files Browse the repository at this point in the history
  • Loading branch information
GandelXIV committed May 24, 2021
1 parent b4bf1f4 commit e008694
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions kernel/advanced_cmds/list_files.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include "../../fs/fscore.h"

void list_files()
{
for (int i = 0; i < file_count(); ++i)
{
kprints(file_get(i));
kprintc('\n');
}
}
8 changes: 7 additions & 1 deletion kernel/ksh.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
char* theme;

#include "advanced_cmds/neofetch.h"
#include "advanced_cmds/list_files.h"

#define KSH_OK 0x0
#define KSH_EXIT 0x1
Expand All @@ -32,7 +33,8 @@ byte ksh_interpret(char* command)
"exit\n",
"memtest\n",
"theme-default\n",
"neofetch\n"
"neofetch\n",
"ls\n"
};

for (int i = 0; i < sizeof(ListOfOwnCmds) / sizeof(char*); i++) {
Expand Down Expand Up @@ -60,6 +62,7 @@ byte ksh_interpret(char* command)
kprints("theme-default changes the theme back to default\n");
kprints("neofetch show info about your system\n");
kprints("exit exit kernel shell\n");
kprints("ls list all files\n");
break;
case 2:
kprints("Hello World!\n");
Expand Down Expand Up @@ -111,6 +114,9 @@ byte ksh_interpret(char* command)
case 13:
neofetch();
break;
case 14:
list_files();
break;
default:
kprints(KERNEL_INFO_SHELL_UNKNOWN_COMMAND);
break;
Expand Down

0 comments on commit e008694

Please sign in to comment.