[feat] add shell filesystem

This commit is contained in:
jzlv 2021-04-27 12:26:44 +08:00
parent a2fca7a36d
commit 8aed596527
6 changed files with 54 additions and 4 deletions

View file

@ -326,7 +326,15 @@ static void shellWriteCommandLine(Shell *shell)
{
shellWriteString(shell, "\r\n");
shellWriteString(shell, shell->info.user->data.user.name);
shellWriteString(shell, "/> ");
#if SHELL_FS == 1
char path[SHELL_PRINT_BUFFER];
shell->getcwd(path, SHELL_PRINT_BUFFER);
shellWriteString(shell, ":/");
shellWriteString(shell, path);
shellWriteString(shell, "$ ");
#else
shellWriteString(shell, "/$ ");
#endif
}
else
{
@ -1962,7 +1970,7 @@ static unsigned int shellExtParseNumber(char *string)
if (type == NUM_TYPE_FLOAT && devide != 0)
{
valueFloat = (float)valueInt / devide * sign;
return (uint32_t)valueFloat;
return (unsigned int)valueFloat;
}
else
{
@ -2083,3 +2091,5 @@ int shellExtRun(Shell *shell, ShellCommand *command, int argc, char *argv[])
}
}

View file

@ -316,6 +316,7 @@ typedef struct
} status;
signed char (*read)(char *); /**< shell读函数 */
void (*write)(const char); /**< shell写函数 */
int (*getcwd)(char *path, unsigned int len);
} Shell;

View file

@ -81,7 +81,7 @@
/**
* @brief
*/
#define SHELL_HISTORY_MAX_NUMBER 30
#define SHELL_HISTORY_MAX_NUMBER 5
/**
* @brief (ms)
@ -136,4 +136,10 @@
*/
#define SHELL_LOCK_TIMEOUT 0 * 60 * 1000
/**
* @brief shell是否在命令提示符输出路径,
*/
#define SHELL_FS 1
#endif