Files
zakscode/src/modules/konsole/commands/cd.js
ztimson b71b2092c3
All checks were successful
Build Website / Build NPM Project (push) Successful in 21s
Build Website / Tag Version (push) Successful in 7s
Build Website / Build & Push Dockerfile (push) Successful in 1m4s
Updated konsole
2024-01-07 16:36:14 -05:00

17 lines
476 B
JavaScript

window.cli.exec['cd'] = {
autocomplete: () => {
return [];
},
help: () => {
return 'Change present working directory';
},
run: args => {
const path = window.cli.fs(args[0]);
if(!path) throw new Error(`cd: \'${args[0]}\': No such file or directory`);
if(typeof path != 'object') throw new Error(`cd: \'${args[0]}\': Not a directory`);
window.cli.pwd = window.cli.path(args[0]);
window.cli._prompt.innerText = window.cli._buildPrompt();
}
}