mirror of
https://github.com/GothenburgBitFactory/taskshell.git
synced 2025-06-26 10:54:29 +02:00
Dispatch
- Allow commadn abbreviations.
This commit is contained in:
parent
add6ddcf15
commit
de39d1f275
1 changed files with 7 additions and 3 deletions
10
src/main.cpp
10
src/main.cpp
|
@ -28,6 +28,7 @@
|
|||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <i18n.h>
|
||||
#include <text.h>
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
#include <readline/readline.h>
|
||||
|
@ -43,19 +44,22 @@ static int commandLoop ()
|
|||
// Display prompt, get input.
|
||||
char *line_read = readline (prompt.c_str ());
|
||||
if (! line_read)
|
||||
{
|
||||
std::cout << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Save history.
|
||||
if (*line_read)
|
||||
add_history (line_read);
|
||||
|
||||
std::string command (line_read);
|
||||
|
||||
free (line_read);
|
||||
|
||||
// TODO Dispatch command
|
||||
// Dispatch command
|
||||
int status = 0;
|
||||
if (command == "exit") status = 1;
|
||||
if (closeEnough ("exit", command, 3)) status = 1;
|
||||
|
||||
// TODO diagnostics
|
||||
// TODO help
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue