ProzillaOS/src/features/applications/terminal/commands/whatis.js
2023-12-19 11:42:51 +01:00

20 lines
No EOL
578 B
JavaScript

import Command from "../command.js";
import CommandsManager from "../commands.js";
export const whatis = new Command("whatis")
.setRequireArgs(true)
.setManual({
purpose: "Show information about a command"
})
.setExecute(function(args) {
const commandName = args[0].toLowerCase();
const command = CommandsManager.find(commandName);
if (!command)
return `${this.name}: ${commandName}: Command not found`;
if (!command.manual?.purpose)
return `${this.name}: ${commandName}: No information found`;
return `${commandName} - ${command.manual.purpose}`;
});