UNPKG

@zzck.dev/tui

Version:

TS Text-based user inteface & commandline parser

24 lines (23 loc) 790 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ActionCall = exports.ActionCallCreationError = void 0; class ActionCallCreationError extends Error { constructor(msg) { super(msg); this.name = "ActionCallCreationError"; } } exports.ActionCallCreationError = ActionCallCreationError; class ActionCall { constructor(input) { const words = input.split(" ").filter((element) => { if (element != "" || element != null) return element; }); if (!words.length) throw new ActionCallCreationError(`Seems like input string was empty, input string : "${input}"`); this.command = words[0]; this.args = words.slice(1); } } exports.ActionCall = ActionCall;