omochi/gysb
gysb is Generate Your Swifty Boilerplate.
other examples
See Examples and Tests.
docs
command line help
$ swift run gysb --help
Usage: .build/x86_64-apple-macosx10.10/debug/gysb [mode] [flags] paths...
# mode
--help: print help
--parse: print AST
--compile: print compiled Swift
--render: render template (default)
# flags
--write: write output on same directory (extension removed)
--source-dirs: paths means directory and search *.gysb (automatically enable `--write`)
syntax
%%: escaped%$$: escaped$%{ <swift-code> }%: code block% <swift-code> <newline>: code line${ <swift-code> }: code substitution
gysb.json
You can use more useful feature of gysb by using gysb.json. gysb command search gysb.json for each gysb template files within same or ancestor directory.
gysb.json features
- local library script inclusion. See example in
Examples/simple_include. - external library via SwiftPM package. See example in
Examples/yaml.
install
There are some install approachs.
- install from homebrew
- build yourself and set path
homebrew
$ brew install omochi/taps/gysbbuild yourself
Checkout repository.
$ git clone https://github.com/omochi/gysb.git
$ cd gysbBuild.
$ swift buildGet path.
$ echo $(pwd)/.build/debug
/Users/omochi/github/omochi/gysb/.build/debugSet path.
$ vim ~/.bash_profiledevelopment
This repository is maintained by SwiftPM.
Use xcodeproj and work with it.
$ swift package generate-xcodeproj
$ open gysb.xcodeprojPackage Metadata
Repository: omochi/gysb
Default branch: master
README: README.md