added help

This commit is contained in:
Arwid Thornström
2025-10-16 11:05:41 +02:00
parent 79e6d02c6c
commit 1ed0f300dc
2 changed files with 200 additions and 1 deletions
+28 -1
View File
@@ -1,4 +1,6 @@
const { build } = require('gluegun');
const fs = require('fs');
const path = require('path');
/**
* Create the cli and kick it off
@@ -19,7 +21,32 @@ async function run(argv) {
hidden: false,
dashed: true,
run: (toolbox) => {
toolbox.print.info('This is the help');
// Try to read and display the help markdown file
try {
// When compiled, __dirname is build/commands
// Help file is in docs/ at repo root
const helpPath = path.join(__dirname, '../docs/help.md');
if (fs.existsSync(helpPath)) {
const helpContent = fs.readFileSync(helpPath, 'utf8');
toolbox.print.info(helpContent);
} else {
// Fallback if help file not found
toolbox.print.info('pwcli - Photowall CLI');
toolbox.print.info('');
toolbox.print.info('Run "pwcli" to start the interactive menu.');
toolbox.print.info('');
toolbox.print.info(
'For detailed help, see docs/help.md in the repository.',
);
}
} catch (error) {
toolbox.print.error(
'Error loading help documentation: ' + error.message,
);
toolbox.print.info('');
toolbox.print.info('Run "pwcli" to start the interactive menu.');
}
},
}) // provides default for help, h, --help, -h
// .version() // provides default for version, v, --version, -v