feat: complete command completion in shell
This commit is contained in:
@@ -12,4 +12,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MONTAUK_BUILD_NUMBER 108
|
||||
#define MONTAUK_BUILD_NUMBER 110
|
||||
|
||||
@@ -441,15 +441,25 @@ extern "C" void _start() {
|
||||
char* table[128] = { };
|
||||
int n = get_completions(line, table, 128, cwd, current_drive);
|
||||
|
||||
montauk::print("\n");
|
||||
for (int i = 0; i < n; i++) {
|
||||
montauk::print(" ");
|
||||
montauk::print(table[i]);
|
||||
montauk::print("\n");
|
||||
}
|
||||
// Command completion if there is only 1 match
|
||||
if (n == 1) {
|
||||
size_t chars_already_typed = pos;
|
||||
pos = 0;
|
||||
|
||||
pos = 0;
|
||||
prompt();
|
||||
montauk::strncpy(line, table[0], 256);
|
||||
pos = montauk::slen(table[0]);
|
||||
montauk::print(table[0] + chars_already_typed);
|
||||
} else { // If more than one result, print multiple results
|
||||
montauk::print("\n");
|
||||
for (int i = 0; i < n; i++) {
|
||||
montauk::print(" ");
|
||||
montauk::print(table[i]);
|
||||
montauk::print("\n");
|
||||
}
|
||||
|
||||
pos = 0;
|
||||
prompt();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user