Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Fix the history not remembering the arguments for commands #334

Merged
merged 2 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app/desktop/windows/terminal/terminal-states.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/app/desktop/windows/terminal/terminal.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down