#!/usr/bin/env node import cli from 'commander'; import { createCommandHandler, listCommandHandler, showCommandHandler, interactiveCreateCommandHandler, saveRemotesCommandHandler, deleteRemotesCommandHandler } from './src/cliCommandHandlers'; cli .command('create ') .option( '-f, --folder ', 'Folder name that the template will be generated into', '' ) .option( '--path-prefix ', 'Path that will be appended the the location the script is generated into', '' ) .option( '--entry-point ', 'The entry point to generate the template into (Absolute path)' ) .option( '--load-from ', 'A path to a scaffolder folder from which to load the templates.' ) .alias('c') .description('Create template folder structure') .action(createCommandHandler); cli .command('interactive') .alias('i') .option( '--path-prefix ', 'Path that will be appended the the location the script is generated into', '' ) .option( '--entry-point ', 'The entry point to generate the template into (Absolute path)' ) .option( '--from-github [repositorySource]', 'Using this option will consume the templates from a specified Github repository.\nExample templates repository can be seen here https://github.com/galElmalah/scaffolder-templates-example', ) .option( '--template ', 'Start the interactive mode with a preselected template.' ).option( '--values ', 'Predefine values for specific parameters param1=val1,param2=val2....' ) .option( '--load-from ', 'A path to a scaffolder folder from which to load the templates.' ) .description( 'Interactive mode that ask for the user input on each step of the way.' ) .action(interactiveCreateCommandHandler); cli .command('list') .alias('ls') .option( '--entry-point ', 'The entry point from which you want to see all available templates (Absolute path)' ) .description('Show all available commands and their paths') .action(listCommandHandler); cli .command('show ') .alias('s') .description('Show specific command corresponding template files') .option('-c, --show-content') .action(showCommandHandler); cli.command('save-remote ').option('-lc, --location ').action(saveRemotesCommandHandler); cli.command('delete-remote ').action(deleteRemotesCommandHandler); cli.parse(process.argv);