mirror of
https://github.com/chenasraf/file_scaffold_dart.git
synced 2026-05-17 17:58:02 +00:00
docs & readme
This commit is contained in:
20
README.md
20
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=<path/to/templates/**.json> List of templates to get files from. You may supply a
|
||||
glob string to include only files using that pattern.
|
||||
|
||||
-l, --locals=<key="value" [, ...]> List of key-value mappings of locals to pass to the
|
||||
scaffold.
|
||||
|
||||
-h, --help Display this help message.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ void main(List<String> 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<String> args) {
|
||||
} on ArgumentError {
|
||||
print('Problem parsing the input arguments.');
|
||||
print(FileScaffoldConfig.argParser.usage);
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
library file_scaffold;
|
||||
import 'dart:io';
|
||||
import 'package:glob/glob.dart';
|
||||
import 'package:file_scaffold/config.dart';
|
||||
|
||||
Reference in New Issue
Block a user