tb Command aliases, preloading scripts
This commit is contained in:
@ -29,15 +29,20 @@ struct {
|
||||
char *filepath;
|
||||
|
||||
bool logcmds;
|
||||
|
||||
char *preloadpath;
|
||||
} CONFIG;
|
||||
|
||||
static Arg ARGS[] = {
|
||||
ARG("-m", ARG_STRING, &CONFIG.modestr),
|
||||
ARG("-f", ARG_STRING, &CONFIG.filepath),
|
||||
ARG("-logcmds", ARG_BOOL, &CONFIG.logcmds),
|
||||
ARG("-preload", ARG_STRING, &CONFIG.preloadpath),
|
||||
ARG_END(),
|
||||
};
|
||||
|
||||
void do_file(char *filepath);
|
||||
|
||||
void set_config(void) {
|
||||
int32_t ret;
|
||||
if ((ret = parse_args(args(), argslen(), ARGS)) < 0) {
|
||||
@ -57,10 +62,6 @@ void set_config(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void process_cmd(char *cmdtext) {
|
||||
|
||||
}
|
||||
|
||||
void do_file(char *filepath) {
|
||||
int32_t ret;
|
||||
|
||||
@ -148,6 +149,11 @@ void main(void) {
|
||||
PID = processctl(-1, PCTL_GETPID, 0, 0, 0);
|
||||
|
||||
set_config();
|
||||
|
||||
if (CONFIG.preloadpath != NULL) {
|
||||
LOG(LOG_INF, "Preloading script: %s\n", CONFIG.preloadpath);
|
||||
do_file(CONFIG.preloadpath);
|
||||
}
|
||||
|
||||
if (CONFIG.mode == MODE_INTERACTIVE) {
|
||||
do_mode_interactive();
|
||||
|
Reference in New Issue
Block a user