Working on cmd bind

This commit is contained in:
2025-09-07 23:53:21 -05:00
parent e32d1f0900
commit 16a0403fd4
22 changed files with 86 additions and 768 deletions

35
src/console/cmd/cmdbind.h Normal file
View File

@@ -0,0 +1,35 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "console/console.h"
#include "input/input.h"
void cmdBind(const consolecmdexec_t *exec) {
if(exec->argc < 1) {
consolePrint("Expected 1 argument: <key> <command]");
return;
}
if(exec->argc == 1) {
consolePrint("TODO: Show binds");
// consolePrint("Current binds:");
// inputbinddata_t *data = INPUT.binds;
// do {
// } while(data < INPUT.binds + INPUT_BIND_COUNT);
return;
}
inputbind_t bind = inputBindGetByName(exec->argv[1]);
if(bind == INPUT_BIND_COUNT) {
consolePrint("Unknown bind \"%s\"", exec->argv[1]);
return;
}
consolePrint("test");
}

View File

@@ -14,6 +14,7 @@
#include "console/cmd/cmdset.h"
#include "console/cmd/cmdget.h"
#include "console/cmd/cmdexec.h"
#include "console/cmd/cmdbind.h"
#include "input/input.h"
console_t CONSOLE;
@@ -27,6 +28,7 @@ void consoleInit() {
consoleRegCmd("quit", cmdQuit);
consoleRegCmd("echo", cmdEcho);
consoleRegCmd("exec", cmdExec);
consoleRegCmd("bind", cmdBind);
consolePrint(" = Dawn Console = ");
@@ -284,7 +286,7 @@ void consoleExec(const char_t *line) {
}
if(exec->cmd == NULL) {
consolePrint("Command not found", exec->command);
consolePrint("Command \"%s\" not found", exec->command);
exec = NULL;
state = CONSOLE_EXEC_STATE_INITIAL;
break;