Git Product home page Git Product logo

Comments (5)

iilyak avatar iilyak commented on May 23, 2024

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.

davidB avatar davidB commented on May 23, 2024

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 ;-))
  • provide some how-to in the template authoring doc for common use case

I'll try to work on this suggest asap.

from ffizer.

iilyak avatar iilyak commented on May 23, 2024

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.

davidB avatar davidB commented on May 23, 2024

👍 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.

davidB avatar davidB commented on May 23, 2024

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 becomes true(a boolean)
    • "true" the value becomes "true" (a string)

from ffizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.