diff options
| -rw-r--r-- | src/console/commandline/CommandParser.ts | 8 | ||||
| -rw-r--r-- | src/shared/Command.ts | 2 | ||||
| -rw-r--r-- | test/console/commandline/CommandParser.test.ts | 2 | 
3 files changed, 9 insertions, 3 deletions
diff --git a/src/console/commandline/CommandParser.ts b/src/console/commandline/CommandParser.ts index 79ae8c8..5228c77 100644 --- a/src/console/commandline/CommandParser.ts +++ b/src/console/commandline/CommandParser.ts @@ -8,8 +8,6 @@ export class UnknownCommandError extends Error {  export default class CommandParser {    parse(value: string): Command { -    value = value.replace(/!$/, ""); -      switch (value) {      case 'o':      case 'open': @@ -27,8 +25,14 @@ export default class CommandParser {      case 'bdel':      case 'bdelete':        return Command.BufferDelete; +    case 'bd!': +    case 'bdel!': +    case 'bdelete!': +      return Command.BufferDeleteForce;      case 'bdeletes':        return Command.BuffersDelete; +    case 'bdeletes!': +      return Command.BuffersDeleteForce;      case 'addbookmark':        return Command.AddBookmark;      case 'q': diff --git a/src/shared/Command.ts b/src/shared/Command.ts index cd2ed0a..e492f4a 100644 --- a/src/shared/Command.ts +++ b/src/shared/Command.ts @@ -4,7 +4,9 @@ export enum Command {      WindowOpen = "winopen",      Buffer = "buffer",      BufferDelete = "bdelete", +    BufferDeleteForce = "bdelete!",      BuffersDelete = "bdeletes", +    BuffersDeleteForce = "bdeletes!",      AddBookmark = "addbookmark",      Quit = "quit",      QuitAll = "quitall", diff --git a/test/console/commandline/CommandParser.test.ts b/test/console/commandline/CommandParser.test.ts index 129821a..4ad78fd 100644 --- a/test/console/commandline/CommandParser.test.ts +++ b/test/console/commandline/CommandParser.test.ts @@ -8,7 +8,7 @@ describe("CommandParser", () => {        const sut = new CommandParser();        expect(sut.parse("open")).to.equal(Command.Open);        expect(sut.parse("w")).to.equal(Command.WindowOpen); -      expect(sut.parse("bdelete!")).to.equal(Command.BufferDelete); +      expect(sut.parse("bdelete!")).to.equal(Command.BufferDeleteForce);        expect(() => sut.parse("harakiri")).to.throw(UnknownCommandError);      })    })  | 
