aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-09-22 22:40:34 +0200
committerDavid Robillard <d@drobilla.net>2018-09-22 22:40:45 +0200
commitb49b6f8c22d6c66e630fbbc5bde4838df5f6af41 (patch)
treef546ddb87d738eefaf9477c9865d1387d9833d93 /src
parent05b70efaa888e708930fb968531a674534ef5251 (diff)
downloadjalv-b49b6f8c22d6c66e630fbbc5bde4838df5f6af41.tar.gz
jalv-b49b6f8c22d6c66e630fbbc5bde4838df5f6af41.tar.bz2
jalv-b49b6f8c22d6c66e630fbbc5bde4838df5f6af41.zip
Add rudimentary help to console interface
Diffstat (limited to 'src')
-rw-r--r--src/jalv_console.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/jalv_console.c b/src/jalv_console.c
index 9bdf2f6..91e9f62 100644
--- a/src/jalv_console.c
+++ b/src/jalv_console.c
@@ -141,7 +141,14 @@ jalv_process_command(Jalv* jalv, const char* cmd)
{
char sym[64];
float value;
- if (sscanf(cmd, "%[a-zA-Z0-9_] = %f", sym, &value) == 2) {
+ if (!strncmp(cmd, "help", 4)) {
+ fprintf(stderr,
+ "Commands:\n"
+ " help Display this help message\n"
+ " set SYMBOL VALUE Set control value\n"
+ " SYMBOL = VALUE Set control value\n");
+ } else if (sscanf(cmd, "set %[a-zA-Z0-9_] %f", sym, &value) == 2 ||
+ sscanf(cmd, "%[a-zA-Z0-9_] = %f", sym, &value) == 2) {
struct Port* port = NULL;
for (uint32_t i = 0; i < jalv->num_ports; ++i) {
struct Port* p = &jalv->ports[i];
@@ -155,10 +162,10 @@ jalv_process_command(Jalv* jalv, const char* cmd)
port->control = value;
printf("%s = %f\n", sym, value);
} else {
- fprintf(stderr, "error: no port `%s'\n", sym);
+ fprintf(stderr, "error: no control named `%s'\n", sym);
}
} else {
- fprintf(stderr, "error: invalid command\n");
+ fprintf(stderr, "error: invalid command (try `help')\n");
}
}