added help
This commit is contained in:
+28
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user