Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions packages/atxp/src/help.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import chalk from 'chalk';

export function showHelp(): void {
console.log(chalk.bold(chalk.blue('ATXP CLI')));
console.log(chalk.gray('Command line tool for creating ATXP projects and running demos'));
console.log();

console.log(chalk.bold('Usage:'));
console.log(' npx atxp <command> [options]');
console.log();

console.log(chalk.bold('Commands:'));
console.log(' ' + chalk.cyan('demo') + ' ' + 'Run the ATXP demo application');
console.log(' ' + chalk.cyan('create') + ' ' + 'Create a new ATXP project');
console.log(' ' + chalk.cyan('help') + ' ' + 'Show this help message');
console.log();

console.log(chalk.bold('Demo Options:'));
console.log(' ' + chalk.yellow('--verbose, -v') + ' ' + 'Show detailed logs');
console.log(' ' + chalk.yellow('--refresh') + ' ' + 'Force refresh the demo from GitHub');
console.log();

console.log(chalk.bold('Examples:'));
console.log(' npx atxp demo # Run the demo');
console.log(' npx atxp demo --verbose # Run demo with detailed logs');
console.log(' npx atxp create # Create a new project');
console.log();

console.log(chalk.bold('Learn more:'));
console.log(' Website: ' + chalk.underline('https://atxp.dev'));
console.log(' GitHub: ' + chalk.underline('https://github.com/atxp-dev/cli'));
}
19 changes: 17 additions & 2 deletions packages/atxp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,31 @@

import { createProject } from './create-project.js';
import { runDemo } from './run-demo.js';
import { showHelp } from './help.js';

// Get the command from arguments
const command = process.argv[2];

// Detect if we're in create mode (npm create atxp or npx atxp create)
const isCreateMode = process.env.npm_config_argv?.includes('create') ||
process.argv.includes('--create') ||
process.argv[2] === 'create';
command === 'create';

// Handle different commands
if (isCreateMode) {
console.log('Creating new ATXP project...');
createProject();
} else {
} else if (command === 'demo') {
console.log('Starting ATXP demo...');
runDemo();
} else if (command === 'help' || command === '--help' || command === '-h') {
showHelp();
} else if (!command) {
// No command provided - show help instead of running demo
showHelp();
} else {
// Unknown command
console.log(`Unknown command: ${command}`);
console.log('Run "npx atxp help" for usage information.');
process.exit(1);
}