diff --git a/README.md b/README.md index 04fde89..d06c968 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,24 @@ This allows you to easily create components for your projects, be it similar ske You can install this package either globally or locally in your package and use the command line tools for configs. + pub global activate file_scaffold + +You can access the command-line usage args using `pub global run file_scaffold -h`: + + -n, --name Name of this scaffold, to be used in folder name (if + --create-subfolder is used) and file templates. + + -o, --output-dir Directory to output the template files to. They will + maintain their original directory structure. + + -C, --[no-]create-subfolder Create subfolder at the output directory, using the + scaffold's name. + + -t, --templates= List of templates to get files from. You may supply a + glob string to include only files using that pattern. + + -l, --locals= List of key-value mappings of locals to pass to the + scaffold. + + -h, --help Display this help message. diff --git a/bin/file_scaffold.dart b/bin/file_scaffold.dart index 7c488ea..4a228b7 100644 --- a/bin/file_scaffold.dart +++ b/bin/file_scaffold.dart @@ -5,7 +5,7 @@ void main(List args) { var res = FileScaffoldConfig.argParser.parse(args); if (res['help']) { - print(FileScaffoldConfig.argParser.usage); + FileScaffoldConfig.printHelp(); exit(0); } try { @@ -14,6 +14,6 @@ void main(List args) { } on ArgumentError { print('Problem parsing the input arguments.'); print(FileScaffoldConfig.argParser.usage); - exit(0); + exit(1); } } diff --git a/lib/config.dart b/lib/config.dart index 2c9e5ad..058d7c2 100644 --- a/lib/config.dart +++ b/lib/config.dart @@ -122,13 +122,29 @@ class FileScaffoldConfig { } static void printHelp() { - + print('File Scaffolding from a directory structure of any templates with replaceable-tokens'); + print('for generating files from simple parameters.\n'); + print('Usage:'); + print(' When installed globally:\n'); + print(' pub global run file_scaffold -n name [...flags]'); + print('\nOptions:\n'); + print(argParser.usage); } static ArgParser _createArgsParser() { - var argParser = ArgParser(); - argParser.addOption('name', abbr: 'n'); - argParser.addOption('output-dir', abbr: 'o'); + var argParser = ArgParser(usageLineLength: 100); + argParser.addOption( + 'name', + abbr: 'n', + help: + 'Name of this scaffold, to be used in folder name (if --create-subfolder is used) and file templates.', + ); + argParser.addOption( + 'output-dir', + abbr: 'o', + help: + 'Directory to output the template files to. They will maintain their original directory structure.', + ); argParser.addFlag( 'create-subfolder', abbr: 'C', @@ -151,7 +167,7 @@ class FileScaffoldConfig { argParser.addFlag( 'help', abbr: 'h', - help: 'This usage text.', + help: 'Display this help message.', negatable: false, ); return argParser; diff --git a/lib/file_scaffold.dart b/lib/file_scaffold.dart index ac06661..9dce064 100644 --- a/lib/file_scaffold.dart +++ b/lib/file_scaffold.dart @@ -1,3 +1,4 @@ +library file_scaffold; import 'dart:io'; import 'package:glob/glob.dart'; import 'package:file_scaffold/config.dart';