Updated konsole
This commit is contained in:
@@ -7,7 +7,14 @@ window.cli.exec['ls'] = {
|
||||
},
|
||||
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`, '');
|
||||
if(!target || typeof target != 'object') throw new Error(`ls: cannot access \'${args[0]}\': No such file or directory`)
|
||||
return Object.keys(target)
|
||||
.sort((a, b) => {
|
||||
if(a > b) return 1;
|
||||
if(b > a) return -1;
|
||||
return 0;
|
||||
})
|
||||
.map(p => `-rwxrw---- 1 root root ${typeof target[p] =='object' ? '-' : target[p].length} ${p}`)
|
||||
.join('\n');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user