1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

Configurable shell messages

This commit adds the possibility to configure various shell messages (and some
internal variables) by defining the respective macros at compile time.
This commit is contained in:
Jeff Palmer 2018-06-01 01:36:01 +03:00 committed by Bogdan Marinescu
parent f3e70e5228
commit b3de8d2155
2 changed files with 31 additions and 5 deletions

View File

@ -4,12 +4,23 @@
#define __SHELL_H__
#include "type.h"
#include "platform_conf.h"
#if !defined(SHELL_WELCOMEMSG)
#define SHELL_WELCOMEMSG "\neLua %s Copyright (C) 2007-2013 www.eluaproject.net\n"
#endif
#if !defined(SHELL_PROMPT)
#define SHELL_PROMPT "eLua# "
#endif
#if !defined(SHELL_ERRMSG)
#define SHELL_ERRMSG "Invalid command, type 'help' for help\n"
#endif
#if !defined(SHELL_MAXSIZE)
#define SHELL_MAXSIZE 50
#endif
#if !defined(SHELL_MAX_LUA_ARGS)
#define SHELL_MAX_LUA_ARGS 8
#endif
// Shell command handler function
typedef void( *p_shell_handler )( int argc, char **argv );

View File

@ -17,9 +17,24 @@
#include "version.h"
#endif
const char shell_help_ver[] = "\n"
"This displays the git revision of the tree used to build eLua or an official version number if applicable.\n";
const char shell_help_summary_ver[] = "show version information";
#ifndef SHELL_HELP_VER_STRING
#define SHELL_HELP_VER_STRING "\nThis displays the git revision of the tree used to build eLua or an official version number if applicable.\n"
#endif
#ifndef SHELL_HELP_SUMMARY_STRING
#define SHELL_HELP_SUMMARY_STRING "show version information"
#endif
#ifndef SHELL_HELP_LINE1_STRING
#define SHELL_HELP_LINE1_STRING "eLua version %s\n"
#endif
#ifndef SHELL_HELP_LINE2_STRING
#define SHELL_HELP_LINE2_STRING "For more information visit www.eluaproject.net and wiki.eluaproject.net\n"
#endif
const char shell_help_ver[] = SHELL_HELP_VER_STRING;
const char shell_help_summary_ver[] = SHELL_HELP_SUMMARY_STRING;
void shell_ver( int argc, char **argv )
{
@ -28,7 +43,7 @@ void shell_ver( int argc, char **argv )
SHELL_SHOW_HELP( ver );
return;
}
printf( "eLua version %s\n", ELUA_STR_VERSION );
printf( "For more information visit www.eluaproject.net and wiki.eluaproject.net\n" );
printf( SHELL_HELP_LINE1_STRING, ELUA_STR_VERSION );
printf( SHELL_HELP_LINE2_STRING );
}