You can define "hints" for your questions!
Install
pub global activate stagedive
Update
# activate stagedive again
pub global activate stagedive
Uninstall
pub global deactivate stagedive
Usage: stagedive -n <new project folder> -p <template project> -t <template name>
-e, --extension Template extension, stripped during copy
-s, --settings Prints settings
-h, --help Shows this message
-l, --list List available templates
-n, --newprojectdir New project folder
-p, --templateproject Template project (e.g. stagedive)
-t, --template Template name (e.g. console)
-v, --loglevel Sets the appropriate loglevel
[info, debug, warning]
Sample:
Generate project in example/console:
'stagedive -n example/console -p stagedive -t console'
stagedive -l
- List the available templates
It looks for a template in lib_templates. If it finds a _template folder it scans for subfolders with manifest.yaml.
At the moment the only packages that has a _template folder is StageDive but you
can define your own _templates-folder in your package.
Try stagedive -n example/console -p stagedive -t console
This command will prompt you for your name and your email address.
StageDive creates the appropriate sample in example/console.
StageDive takes all variables defined in the manifest.yaml and replaces the according template fields.
There is one extra variable: basename
basename
is the name you specify with the -t option.
File-Content-Format: <%= varname %>
File-Name-Format: {varname}
The -e
option allows you to specify a template extension that will
be stripped when copying files from the template to their new
locations. This lets you distinguish between Dart files and Dart file
templates, for example, in situations where you have tools that
blindly operate on all .dart
files in your project.
#templatename is not optional!
templatename: Simple Console
prompts:
name:
type: input
question: "Add your name:"
hint: "Used for the pubspec 'name:' field"
email:
type: input
question: "Your email address:"
At the moment the there are two input types: input
and lowercase
.
input
: Asks you the 'question' and stores the answer in the defined variable.lowercase
: Same as input but changes the answer to lowercase.uppercase
: Same as input but changes the answer to uppercase.
StageDive scans your installed packages (pub-cache).
This means StageDive recognizes only installed packages by default.
If you want to change this behaviour or if you want to test your templates before installing them
do the following:
In your project folder, create .stagedive/config.yaml
templatefolder: lib/_templates
or for multiple templates:
templatefolder:
- lib/_templates
- temp/_templates
With this - StageDive knows how to find your local templates!
Copyright 2015 Michael Mitterer (office@mikemitterer.at),
IT-Consulting and Development Limited, Austrian Branch
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language
governing permissions and limitations under the License.
If this plugin is helpful for you - please (Circle) me or star this repo here on GitHub.