From bf7c125fb214b52d67527bdd292a4b5bb81b1d32 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Fri, 20 Jul 2018 23:36:03 +0900 Subject: My First Clean Architecture --- src/background/controllers/completions.js | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/background/controllers/completions.js (limited to 'src/background/controllers') diff --git a/src/background/controllers/completions.js b/src/background/controllers/completions.js new file mode 100644 index 0000000..613940f --- /dev/null +++ b/src/background/controllers/completions.js @@ -0,0 +1,42 @@ +import CompletionsInteractor from '../usecases/completions'; +import Completions from '../domains/completions'; + +export default class ContentMessageController { + constructor() { + this.completionsInteractor = new CompletionsInteractor(); + } + + getCompletions(line) { + let trimmed = line.trimStart(); + let words = trimmed.split(/ +/); + let name = words[0]; + if (words.length === 1) { + return this.completionsInteractor.queryConsoleCommand(name); + } + switch (words[0]) { + case 'o': + case 'open': + case 't': + case 'tabopen': + case 'w': + case 'winopen': + break; + case 'b': + case 'buffer': + break; + case 'bd!': + case 'bdel!': + case 'bdelete!': + case 'bdeletes!': + break; + case 'bd': + case 'bdel': + case 'bdelete': + case 'bdeletes': + break; + case 'set': + break; + } + return Promise.resolve(Completions.empty()); + } +} -- cgit v1.2.3