Pulled konsole out into it's own module
This commit is contained in:
13
src/modules/konsole/commands/ls.js
Normal file
13
src/modules/konsole/commands/ls.js
Normal file
@@ -0,0 +1,13 @@
|
||||
window.cli.exec['ls'] = {
|
||||
autocomplete: () => {
|
||||
return [];
|
||||
},
|
||||
help: () => {
|
||||
return 'Display directory contents';
|
||||
},
|
||||
run: args => {
|
||||
const target = window.cli.fs(args[0]);
|
||||
if(!target) throw new Error(`ls: cannot access \'${args[0]}\': No such file or directory`)
|
||||
return Object.keys(target).reduce((acc, p) => acc + `${p}\n`, '');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user