Commit 7883bb10 authored by iv's avatar iv

OfficeJS drive: Fix unecessary line and add message errors for cd/ls 'commands'.

parent 409c5988
......@@ -167,15 +167,15 @@
\n
// if command given: proceed\n
if (command) {\n
try {\n
switch (command) {\n
case \'cd\':\n
case \'ls\':\n
if (args.length === 1) {\n
return gadget.redirect({\n
position: absolutePosition(gadget.props.currentPosition, args[0])\n
});\n
}\n
throw (\'Usage of \' + command + \' requires a single argument.\');\n
throw new Error(\'Usage of \' + command + \' requires a single argument.\');\n
\n
case \'vim\':\n
case \'vi\':\n
......@@ -189,10 +189,15 @@
resource: resource\n
});\n
}\n
throw (\'Usage of \' + command + \' requires a single argument.\');\n
throw new Error(\'Usage of \' + command + \' requires a single argument.\');\n
default:\n
throw (\'Unknown command: \' + command);\n
throw new Error(\'Unknown command: \' + command);\n
}\n
} catch (e) {\n
gadget.props.element.querySelector(\'.error\').textContent = e.name +\n
": " +\n
e.message;\n
}
}\n
})\n
\n
......@@ -208,7 +213,6 @@
}\n
gadget.props.currentPosition = options.position;\n
gadget.props.element.querySelector(\'input\').value = \'\';\n
gadget.props.element.querySelector(\'.position\').value = options.position;\n
\n
// clean previous ul children\n
while (ul.hasChildNodes()) {\n
......
......@@ -134,8 +134,9 @@
<body>\n
<h1>Super OfficeJS Drive</h1>\n
<form>\n
position: <input type="text" name="position">\n
<input type="text">\n
</form>\n
<div><a class="error"></a></div>\n
<ul>\n
</ul>\n
</body>\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment