From f18deaa8d2f3801f509393e176bc0c72ed2b48b7 Mon Sep 17 00:00:00 2001 From: Jb Landry Date: Thu, 5 Oct 2017 16:41:01 -0400 Subject: [PATCH] Update omelette and use package now-implemented tree --- index.js | 31 ++----------------------------- package.json | 5 +++-- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/index.js b/index.js index 544c779..3cd25ea 100644 --- a/index.js +++ b/index.js @@ -92,35 +92,8 @@ const initAutocomplete = () => { }); - // Breks eggs - const complete = omelette(pkg.name); - - complete.on('$1', function() { - try { - this.reply(Object.keys(autocomplete)); - } catch (e) {} // eslint-disable-line no-empty - }); - - complete.on('$2', function(lvl1) { - try { - this.reply(Object.keys(autocomplete[lvl1])); - } catch (e) {} // eslint-disable-line no-empty - }); - - complete.on('$3', function(lvl2, line) { - const [, lvl1] = line.split(' '); - try { - this.reply(Object.keys(autocomplete[lvl1][lvl2])); - } catch (e) {} // eslint-disable-line no-empty - }); - - complete.on('$4', function(lvl3, line) { - const [, lvl1, lvl2] = line.split(' '); - try { - this.reply(Object.keys(autocomplete[lvl1][lvl2][lvl3])); - } catch (e) {} // eslint-disable-line no-empty - }); - + // Breaks eggs + const complete = omelette(pkg.name).tree(autocomplete); complete.init(); }; diff --git a/package.json b/package.json index b17b6e8..730fa2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@absolunet/cli", - "version": "0.4.1", + "version": "0.4.2", "description": "CLI utilities", "definition": "", "homepage": "https://github.com/absolunet/node-cli", @@ -26,11 +26,12 @@ "@absolunet/tester": "1.1.0" }, "dependencies": { + "@absolunet/terminal": "^0.4.4", "@absolunet/terminal-pad": "^0.0.2", "chalk": "^2.1.0", "glob": "^7.1.2", "indent-string": "^3.2.0", - "omelette": "^0.3.2", + "omelette": "^0.4.5", "read-pkg-up": "^2.0.0", "string-width": "^2.1.1" }