added clear screen command

This commit is contained in:
hathach 2013-09-26 15:04:02 +07:00
parent 9d60db0f9f
commit 0268e0b787
3 changed files with 18 additions and 2 deletions

View File

@ -67,6 +67,7 @@
#define ANSI_CURSOR_BACKWARD(n) CSI_CODE(#n "D")
#define ANSI_CURSOR_LINE_DOWN(n) CSI_CODE(#n "E")
#define ANSI_CURSOR_LINE_UP(n) CSI_CODE(#n "F")
#define ANSI_CURSOR_POSITION(n, m) CSI_CODE(#n ";" #m "H")
#define ANSI_ERASE_SCREEN(n) CSI_CODE(#n "J")
#define ANSI_ERASE_LINE(n) CSI_CODE(#n "K")

View File

@ -81,7 +81,7 @@ static char const * const cli_error_message[] =
ENTRY(cls , cli_cmd_clear , "Clear the screen." ) \
ENTRY(ls , cli_cmd_list , "List information about the FILEs (the current directory by default).") \
ENTRY(cd , cli_cmd_changedir, "change the current directory." ) \
ENTRY(cat , cli_cmd_cat , "display contents of a text file." ) \
ENTRY(cat , cli_cmd_cat , "display contents of a file." ) \
ENTRY(cp , cli_cmd_copy , "Copies one or more files to another location." ) \
ENTRY(mkdir , cli_cmd_mkdir , "Create a DIRECTORY, if it does not already exist." ) \
@ -241,7 +241,8 @@ cli_error_t cli_cmd_help(char * para)
//--------------------------------------------------------------------+
cli_error_t cli_cmd_clear(char* p_para)
{
printf(ANSI_ERASE_SCREEN(2));
printf(ANSI_ERASE_SCREEN(2) ANSI_CURSOR_POSITION(1,1) );
return CLI_ERROR_NONE;
}
//--------------------------------------------------------------------+
@ -345,6 +346,13 @@ cli_error_t cli_cmd_cat(char *p_para)
//--------------------------------------------------------------------+
// Make Directory command
//--------------------------------------------------------------------+
cli_error_t cli_cmd_mkdir(char *p_para)
{
puts("executing mkdir");
return CLI_ERROR_NONE;
}
//--------------------------------------------------------------------+
// COPY command
//--------------------------------------------------------------------+

View File

@ -95,6 +95,13 @@ void tusbh_msc_mounted_cb(uint8_t dev_addr)
return;
}
puts("---------------------------------------------------------------------");
puts("- MASSSTORAGE CLASS CLI IS A NON-MATURE CODE. DISK-WRITING COMMANDS -");
puts("- SUCH AS cp(COPY), mkdir(MAKE DIRECTORY) ARE POTENTIAL TO DAMAGE -");
puts("- YOUR USB THUMBDRIVE. USING THOSE COMMANDS ARE AT YOUR OWN RISK. -");
puts("- THE AUTHOR HAS NO RESPONSIBILITY WITH YOUR DEVICE NOR ITS DATA -");
puts("---------------------------------------------------------------------");
f_chdrive(dev_addr-1); // change to newly mounted drive
f_chdir("/"); // root as current dir