Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better documentation about the templating system and the attribute parameters #329

Open
refnil opened this issue Aug 15, 2021 · 2 comments

Comments

@refnil
Copy link
Collaborator

refnil commented Aug 15, 2021

@nmattia yes, it does (thank you by the way!), though I think the role of attributes should be clarified, at least on the readme, what do you think? The relationship between attributes and templates is never explained explicitly...

Originally posted by @sir4ur0n in #232 (comment)

@nmattia
Copy link
Owner

nmattia commented Aug 19, 2021

The --help says this:

 -t,--template URL        Used during 'update' when building URL. Occurrences
                           of <foo> are replaced with attribute 'foo'.

I guess something like this could be added to the README?

@vst
Copy link

vst commented Aug 6, 2024

And also what attributes are available by default, maybe?

I understand that name is not available in the template context, and must be provided additionally as --attributes name=....

Examples

For example, this does not work:

$ niv add \
  autodocodec --version 0.4.1.0 \
  --template "https://hackage.haskell.org/package/<name>-<version>/<name>-<version>.tar.gz"

Adding package autodocodec
  FATAL: One or more packages failed to update:
  autodocodec: Update failed: Could not render template https://hackage.haskell.org/package/<name>-<version>/<name>-<version>.tar.gz
  with keys: url_template, version

  CallStack (from HasCallStack):
    error, called at src/Niv/Update.hs:80:25 in niv-0.2.22-IlyoaYrYPiZATCJYABWS2Z:Niv.Update
ERROR: ExitFailure 1

This does not work either:

$ niv add \
  autodocodec --name autodocodec --version 0.4.1.0 \
  --template "https://hackage.haskell.org/package/<name>-<version>/<name>-<version>.tar.gz"

Adding package autodocodec
  FATAL: One or more packages failed to update:
  autodocodec: Update failed: Could not render template https://hackage.haskell.org/package/<name>-<version>/<name>-<version>.tar.gz
  with keys: url_template, version

  CallStack (from HasCallStack):
    error, called at src/Niv/Update.hs:80:25 in niv-0.2.22-IlyoaYrYPiZATCJYABWS2Z:Niv.Update
ERROR: ExitFailure 1

This does:

$ niv add \
  autodocodec --attribute name=autodocodec --version 0.4.1.0 \
  --template "https://hackage.haskell.org/package/<name>-<version>/<name>-<version>.tar.gz"

Adding package autodocodec
  Writing new sources file
Done: Adding package autodocodec

Let me know if you want me to issue a PR along this line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants