initial commit
This commit is contained in:
53
startpage/root/bin/man.js
Normal file
53
startpage/root/bin/man.js
Normal file
@@ -0,0 +1,53 @@
|
||||
var getmanval;
|
||||
async function getman(path) {
|
||||
try {
|
||||
const module = await import("/startpage/" + path);
|
||||
return module.man;
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: update to use the path in the env this can be done once we first
|
||||
* make the env available to the programs running in the shell
|
||||
*/
|
||||
export async function cmd(inp) {
|
||||
var search = ""
|
||||
if (inp.indexOf(" ") > 0) {
|
||||
search = inp.substring(inp.indexOf(" ") + 1)
|
||||
}
|
||||
switch (search) {
|
||||
case "fetch": return getman('/root/bin/fetch.js');
|
||||
case "gpt": return getman('/root/bin/gpt.js');
|
||||
case "clear": return getman('/root/bin/clear.js');
|
||||
case "shell": return manshell;
|
||||
case "man": default: return man;
|
||||
}
|
||||
}
|
||||
|
||||
export let man = `
|
||||
<pre>
|
||||
MAN(1)
|
||||
|
||||
NAME
|
||||
\tman – display manual pages
|
||||
|
||||
SEE ALSO
|
||||
\tfetch(1), gpt(1), shell(1), clear(1)
|
||||
</pre>
|
||||
`;
|
||||
|
||||
export let manshell = `
|
||||
<pre>
|
||||
SHELL(1)
|
||||
|
||||
NAME
|
||||
\tshell – command interpreter
|
||||
|
||||
DESCRIPTION
|
||||
\tshell is a shell for my startpage. It's not POSIX nor will it ever be. It's
|
||||
\tsole job it to interpret text and run a command if a valid one is found.
|
||||
\tWhile this is quite unintuitive in a standard UNIX shell in my opinion this
|
||||
\tmakes sense here because of such a limited number of commands.
|
||||
</pre>
|
||||
`;
|
Reference in New Issue
Block a user