Skip to content

Commit

Permalink
Fix recognising commands incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
pindab0ter committed Apr 14, 2024
1 parent 67a9206 commit c78ec3f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions assets/ts/terminal/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ export function getCommandFromInput(input: string): {
} {
if (input === "") return { command: undefined, args: [] };

const command: Command | undefined = Terminal.commands.find((command: Command) =>
input.startsWith(command.name),
const splitInput = input.split(" ");

const command: Command | undefined = Terminal.commands.find(
(command: Command) => splitInput[0].toLowerCase() === command.name.toLowerCase(),
);
const args = input.split(" ").slice(1) || [];
const args = splitInput.slice(1) || [];

return { command, args };
}

0 comments on commit c78ec3f

Please sign in to comment.