mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +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:
parent
f3e70e5228
commit
b3de8d2155
11
inc/shell.h
11
inc/shell.h
@ -4,12 +4,23 @@
|
|||||||
#define __SHELL_H__
|
#define __SHELL_H__
|
||||||
|
|
||||||
#include "type.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"
|
#define SHELL_WELCOMEMSG "\neLua %s Copyright (C) 2007-2013 www.eluaproject.net\n"
|
||||||
|
#endif
|
||||||
|
#if !defined(SHELL_PROMPT)
|
||||||
#define SHELL_PROMPT "eLua# "
|
#define SHELL_PROMPT "eLua# "
|
||||||
|
#endif
|
||||||
|
#if !defined(SHELL_ERRMSG)
|
||||||
#define SHELL_ERRMSG "Invalid command, type 'help' for help\n"
|
#define SHELL_ERRMSG "Invalid command, type 'help' for help\n"
|
||||||
|
#endif
|
||||||
|
#if !defined(SHELL_MAXSIZE)
|
||||||
#define SHELL_MAXSIZE 50
|
#define SHELL_MAXSIZE 50
|
||||||
|
#endif
|
||||||
|
#if !defined(SHELL_MAX_LUA_ARGS)
|
||||||
#define SHELL_MAX_LUA_ARGS 8
|
#define SHELL_MAX_LUA_ARGS 8
|
||||||
|
#endif
|
||||||
|
|
||||||
// Shell command handler function
|
// Shell command handler function
|
||||||
typedef void( *p_shell_handler )( int argc, char **argv );
|
typedef void( *p_shell_handler )( int argc, char **argv );
|
||||||
|
@ -17,9 +17,24 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char shell_help_ver[] = "\n"
|
#ifndef SHELL_HELP_VER_STRING
|
||||||
"This displays the git revision of the tree used to build eLua or an official version number if applicable.\n";
|
#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"
|
||||||
const char shell_help_summary_ver[] = "show version information";
|
#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 )
|
void shell_ver( int argc, char **argv )
|
||||||
{
|
{
|
||||||
@ -28,7 +43,7 @@ void shell_ver( int argc, char **argv )
|
|||||||
SHELL_SHOW_HELP( ver );
|
SHELL_SHOW_HELP( ver );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf( "eLua version %s\n", ELUA_STR_VERSION );
|
printf( SHELL_HELP_LINE1_STRING, ELUA_STR_VERSION );
|
||||||
printf( "For more information visit www.eluaproject.net and wiki.eluaproject.net\n" );
|
printf( SHELL_HELP_LINE2_STRING );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user