From de47a5f73e94dc73ebcb5acef4ba22121c180c25 Mon Sep 17 00:00:00 2001 From: McModknower Date: Mon, 7 Mar 2022 23:00:51 +0100 Subject: [PATCH 1/2] Fix history not storing args (#332) --- src/app/desktop/windows/terminal/terminal-states.ts | 6 +++++- src/app/desktop/windows/terminal/terminal.component.spec.ts | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/desktop/windows/terminal/terminal-states.ts b/src/app/desktop/windows/terminal/terminal-states.ts index 4cd17087..2daf230a 100644 --- a/src/app/desktop/windows/terminal/terminal-states.ts +++ b/src/app/desktop/windows/terminal/terminal-states.ts @@ -46,7 +46,11 @@ export abstract class CommandTerminalState implements TerminalState { // Only successful and not-flagged commands will be shown in the protocol. if (!this.commands[command].hideFromProtocol) { - this.protocol.unshift(command); + if (args.length>0) { + this.protocol.unshift(command + " " + args.join(" ")); + } else { + this.protocol.unshift(command); + } } } else if (command !== '') { this.commandNotFound(command); diff --git a/src/app/desktop/windows/terminal/terminal.component.spec.ts b/src/app/desktop/windows/terminal/terminal.component.spec.ts index d23dfb59..2a176447 100644 --- a/src/app/desktop/windows/terminal/terminal.component.spec.ts +++ b/src/app/desktop/windows/terminal/terminal.component.spec.ts @@ -35,10 +35,10 @@ describe('TerminalComponent', () => { it('should add commands to the protocol', () => { component.execute('test'); component.execute('help'); - component.execute('help'); + component.execute('help help'); expect(component.getHistory().length).toBe(2); // History is printed in reverse - expect(component.getHistory()).toEqual(['help', 'help']); + expect(component.getHistory()).toEqual(['help help', 'help']); }); it('should clear the protocol with clearHistory', () => { From 0e4865be7b898b2e3a5c5f36df9db1c4655b959f Mon Sep 17 00:00:00 2001 From: McModknower Date: Mon, 7 Mar 2022 23:06:12 +0100 Subject: [PATCH 2/2] Use single quotes --- src/app/desktop/windows/terminal/terminal-states.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/desktop/windows/terminal/terminal-states.ts b/src/app/desktop/windows/terminal/terminal-states.ts index 2daf230a..7ec9dacb 100644 --- a/src/app/desktop/windows/terminal/terminal-states.ts +++ b/src/app/desktop/windows/terminal/terminal-states.ts @@ -47,7 +47,7 @@ export abstract class CommandTerminalState implements TerminalState { // Only successful and not-flagged commands will be shown in the protocol. if (!this.commands[command].hideFromProtocol) { if (args.length>0) { - this.protocol.unshift(command + " " + args.join(" ")); + this.protocol.unshift(command + ' ' + args.join(' ')); } else { this.protocol.unshift(command); }