Comments (5)
This also worked
{{ #if (str_to_json(repo_init)) }}
git init
git worktree add --track -b gh-pages site origin/gh-pages
{{ /if }}
from ffizer.
Hi,
Thanks for trying ffizer and for reporting this issue.
This is how I did in my template:
{{#if (eq repo_init "true") }}
....
{{/if}}
But I agree it could be better :
- try to support boolean and other types, without breaking existing templates, for the variables (into the
.ffizer.yaml
and template)- for
default_value
- for
select_in_values
- for input value (maybe template creator will need to request type,
true != "true"
but I don't want to force the user to enclose input in " for string, the most common input (and the only one today ;-))
- for
- provide some how-to in the template authoring doc for common use case
I'll try to work on this suggest asap.
from ffizer.
for input value (maybe template creator will need to request type, true != "true" but I don't want to force the user to enclose input in " for string, the most common input (and the only one today ;-))
Another option is to use something as follows:
- introduce
value
field - use types as defined in a yaml file (i.e. use boolean true if it is written without quotes)
- add special key with suffix
__input
into context - add implicit
value: "{{{<name>__input}}}"
This approach would allow to assign value as a function of user input. It would be possible to express something like this:
- name: license_text
ask: Enter URL of a license
value: {{http_get license_text__input}}
from ffizer.
👍 Yes it could become a useful features.
As side-note for license you can do:
variables:
- name: licenses_json
default_value: '{{ http_get "https://spdx.org/licenses/licenses.json" }}'
hidden: true
- name: license_id
default_value: "Apache-2.0"
ask: select a license
select_in_values: '{{ json_str_query "licenses[? !isDeprecatedLicenseId].licenseId" licenses_json }}'
Or simpler, import the template oss_license (like in this extract from https://github.com/davidB/amethyst-starter-2d/blob/variant/ffizer/ )
imports:
- uri: "[email protected]:ffizer/templates_default.git"
rev: "master"
subfolder: "oss_license"
from ffizer.
introduction of type for value is made as part of 2.x
it's breaking change because
- in 1.x when a user respond to prompt with
true
the value becomes"true"
(a string)"true"
the value becomes"\"true\""
(a string with quote)
- in 1.x when a user respond to prompt with
true
the value becomestrue
(a boolean)"true"
the value becomes"true"
(a string)
from ffizer.
Related Issues (20)
- list of templates
- error with composed repositories HOT 5
- VSCode extension HOT 3
- keep variables value between 2 `apply` HOT 1
- find a way to isolate "example" part from a template to avoid re-apply it
- use git cli when available and fallback to libgit2 HOT 1
- create a plugin to use ffizer with backstage as scaffolder
- memorise what version of template was applied HOT 1
- add shell completion
- failed when convert into json empty (non existing) `{{ input_content }}` HOT 1
- provide parameter or function to format yaml following some rules
- allow to define the default value for applying script
- show command & output when apply script HOT 2
- run test on sample like a snapshot-test tool
- Use ffizer as a linter
- Issue with JSON schema for variable hidden
- support shortcut for command and url
- try to port a cookiecutter template
- add to how-to
- Improve no interaction mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ffizer.