Facio can be configured using a file called ~/.facio.cfg and how Facio runs can also be defined by the command line interface, we will take a look at the command line first.
Facio is a command line application. Here is how you use it:
Note
Throughout this document $ represents a terminal prompt.
The first argument you pass to the facio command must always be a project name. For example:
$ facio hello_world
If no additional optional arguments are supplied then Facio will use its default template to create the project.
For Facio to use a different template than its default you must pass either of the following arguments:
The --template or its short hand equivalent -t takes a string which can be either of the following:
For example:
$ facio foo -t /my/local/template
$ facio bar -t git+git@github.com:krak3n/Facio-Django-Template.git
$ facio baz -t django
The --select or it’s -s short hand is used for selecting a template which is defined in the '.facio.cfg configuration file, see the Configuration File section for more information on how to define multiple templates.
For example:
$ facio foo --select
You will be given a prompt asking you to choose a template, once chosen facio will process the selected template.
You may also need to define more variables to be used when rendering your template. You can do this using the –vars argument.
You can add extra variables to the context using --vars optional argument. This argument takes a string which should contain a comma delimited list of key value pairs separated by an = operator.
For example:
$ facio foo -t bar --vars x=1,y=2,z=3
This above example would define 3 new context variables when rendering the template with the fllowing values:
And could be used in templates as follows:
<html>
</head>
<title>{{ PROJECT_NAME }}</title>
</head>
<body>
<h1>{{ PROJECT_NAME }}</h1>
<ul>
<li>X = {{ x ]}</li>
<li>Y = {{ y ]}</li>
<li>Z = {{ z ]}</li>
</ul>
</body>
</html>
You can also define a configuration file called .facio.cfg. This configuration file should live in your home directory with your other . (dot) files. This configuration file should be in an ini style format.
For example:
[section1]
option = value
[section2]
option = value
The [template] section allows you to define in the .facio.cfg file multiple templates you use on a regular basis so you can access them quickly from facio.
For example:
[template]
django = git+git@github.com:me/django-template.git
rails = git+git@github.com:me/rails-template.git
The [files] section allows you to specify files from your template to skip when copying or skip rendering by jinja2.
The files section takes 2 options:
For example:
[files]
copy_ignore = .env,*.pyc
render_ignore = .coverage,*.ico
In addition to the defaults facio would not copy over any file named .env or any file name ending in .pyc. It would also not render with the template engine, in addition to the defaults, any file named .coverage or any file name ending in .ico.