Fixed konsole rm
This commit is contained in:
parent
d7c257cb39
commit
8038e79ad2
@ -89,16 +89,17 @@ window.cli = {
|
|||||||
},
|
},
|
||||||
prompt: () => `${window.cli.user}@${window.cli.hostname}:${window.cli.pwd}${window.cli.user == 'root' ? '#' : '$'}`,
|
prompt: () => `${window.cli.user}@${window.cli.hostname}:${window.cli.pwd}${window.cli.user == 'root' ? '#' : '$'}`,
|
||||||
fs: (path, set) => {
|
fs: (path, set) => {
|
||||||
let target = window.cli.filesystem;
|
return window.cli.path(path).split('/').filter(p => !!p).reduce((t, p, i, arr) => {
|
||||||
const parts = window.cli.path(path).split('/').filter(p => !!p);
|
if(!t?.hasOwnProperty(p)) {
|
||||||
parts.forEach((p, i, arr) => {
|
if(set == undefined) return undefined;
|
||||||
if(!target[p] && set !== undefined) {
|
t[p] = {};
|
||||||
if(i + 1 != arr.length) target[p] = {};
|
|
||||||
else target[p] = set == null ? undefined : set;
|
|
||||||
}
|
}
|
||||||
target = target[p];
|
if(set !== undefined && i == arr.length - 1) {
|
||||||
});
|
if(set == null) delete t[p];
|
||||||
return target;
|
else t[p] = set;
|
||||||
|
}
|
||||||
|
return t[p];
|
||||||
|
}, window.cli.filesystem);
|
||||||
},
|
},
|
||||||
stdErr: (text) => {
|
stdErr: (text) => {
|
||||||
const p = document.createElement('p');
|
const p = document.createElement('p');
|
||||||
|
Loading…
Reference in New Issue
Block a user