WallShell
An easy-to-use, highly portable, CLI using C99.
|
This document contains a list of all compile time options available to WallShell.
You can either use these options by defining them in wallshell_config.h
, or passing the defines on the command line using -D<option>
.
If the option requires you to create your own function definitions or macros:
wallshell_config.h
.wallshell_config.h
.Future updates may allow the command buffer to be of any size, but keeping it a consistent size makes the program a lot simpler, and much easier to maintain.
Disables the use of logging functions.
vfprintf
.To read more about logging functions, see this page.
Important note: Threaded support requires malloc. You cannot use both
DISABLE_MALLOC
andTHREADED_SUPPORT
at the same time.
Adds support for a threaded implementation of WallShell. This allows you to use it in its own thread, separate from your main program.
mutex
for pthread
and windows threads.atomic_bool
.If you wish to implement your own thread wrapper, or are in a freestanding environment that isn't supported out of the box, see this page.
There are two parameters as a result of disabling malloc:
argv
. Normally there is limitless arguments in argv (as long as it fits within MAX_COMMAND_BUF).void ws_moveCursor(ws_cursor_t direction);
void ws_moveCursor_n(ws_cursor_t direction, size_t num);
num
times in the specified direction. It's advised that you put these definitions in
wallshell_config.h
. Remember that these are already declared inwall_shell.h
, redeclaring them will cause errors.
Unlike most things on this list, this is a macro, not just simply a define. It's normally defined as:
#define CLEAR_ROW fprintf(ws_out_stream, "\033[M");
\r
to return to the beginning of the line regardless.WallShell comes with a very minimal set of built-in commands:
These are mostly included to simplify implementation, as these require accessing internal variables and functions. Despite this, you may want to disable either all or some of them:
NO_BASIC_COMMANDS
You can disable individual commands one at a time.
NO_CLEAR_COMMAND
- disables clear commandNO_EXIT_COMMAND
- disables exit commandNO_HELP_COMMAND
- disables help commandNO_HISTORY_COMMAND
- disables history commandIt is advised you do not disable help or exit. You have no way of making your own (unless you modify the source code). Both work on
DISABLE_MALLOC
andTHREADED_SUPPORT
.
On most pre-existing systems, you really want to avoid defining this. This exists purely for either non-mainstream systems (not windows or unix based), or freestanding environments. If you really need this, see this page.
If your system uses something other than virtual sequences for console color, you have to define this and implement the color changing function yourself.
There is only two things you need to define:
RESET_CONSOLE
Normally defined as:
```c #define RESET_CONSOLE fprintf(ws_out_stream, "\033[0m") ```
SET_WS_COLORS(a, b)
a
is the ws_fg_color_t
, b
is the ws_bg_color_t
Ideally, you should define this to expand to a function:
```c void ws_internal_changeConsoleColor(ws_fg_color_t fg, ws_bg_color_t bg); #define SET_WS_COLORS(a, b) ws_internal_changeConsoleColor(a, b); ```