---
to: "{{ project_name }}/Cargo.toml"
sparql:
  dependencies: |
    PREFIX cli: <http://ggen.dev/schema/cli#>
    PREFIX cnv: <http://ggen.dev/schema/clap-noun-verb#>
    SELECT ?depName ?depVersion ?depFeatures
    WHERE {
      ?project a cli:CliProject ;
               cli:hasDependency ?dep .
      ?dep cnv:depName ?depName ;
           cnv:depVersion ?depVersion .
      OPTIONAL { ?dep cnv:depFeatures ?depFeatures }
    }
    ORDER BY ?depName
---
[package]
name = "{{ project_name }}"
version = "{{ version }}"
edition = "2021"
authors = {{ authors }}
description = "{{ description }}"

[dependencies]
{% for dep in sparql_results.dependencies %}
{% if dep.depFeatures %}
{{ dep.depName }} = { version = "{{ dep.depVersion }}"{% if dep.depFeatures %}, features = [{% for feature in dep.depFeatures | split(pat=",") %}"{{ feature | trim }}"{% if not loop.last %}, {% endif %}{% endfor %}]{% endif %} }
{% else %}
{{ dep.depName }} = "{{ dep.depVersion }}"
{% endif %}
{% endfor %}

[dev-dependencies]
assert_cmd = "2"
assert_fs = "1"
predicates = "3"
tempfile = "3"

[[bin]]
name = "{{ project_name }}"
path = "src/main.rs"
