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

Allow user to customise gci sections #132

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

markvl-sbp
Copy link
Contributor

@markvl-sbp markvl-sbp commented Nov 19, 2024

To allow the user of these tasks to specify their own sections, I've introduced the GCI_SECTIONS variable (which is not defined on purpose).

This also fixes the mismatch between the gci and gci-write tasks where the latter did specify sections and the former did not.

To allow the user of these tasks to specify their own sections, I've
introduced the GCI_SECTIONS variable (which is not defined on purpose).

This also fixes the mismatch between the `gci` and `gci-write` tasks
where the latter did specify sections and the former did not.
@markvl-sbp markvl-sbp requested a review from sbp-bvanb November 19, 2024 13:00
@sbp-bvanb
Copy link
Collaborator

To allow the user of these tasks to specify their own sections, I've introduced the GCI_SECTIONS variable (which is not defined on purpose).

This also fixes the mismatch between the gci and gci-write tasks where the latter did specify sections and the former did not.

I know you mentioned: I've introduced the GCI_SECTIONS variable (which is not defined on purpose). Would it be possible to define a default anyway or does it depend on the repository name and should always be defined? Would it be an idea to update the example in the README.md as well?

@markvl-sbp
Copy link
Contributor Author

I know you mentioned: I've introduced the GCI_SECTIONS variable (which is not defined on purpose). Would it be possible to define a default anyway

Yes, that would be a problem since, as far as I could tell from a quick experiment, I could not override the "default" via the Taskfile.yaml in my project. If there is a way, please let me know since I agree that having a default value would be nice.

or does it depend on the repository name and should always be defined?

Not sure what you mean with "depend on the repository name". But the task still works if the variable is not defined. (And that is also why I did not add a requires section.)

Would it be an idea to update the example in the README.md as well?

Sure, I can add something to the README.md. I'm thinking about a "Configuration" section within the "Taskfile" section, where I list the task, the variable and why you'd use it (and/or an example). How does that sound?

@sbp-bvanb
Copy link
Collaborator

I know you mentioned: I've introduced the GCI_SECTIONS variable (which is not defined on purpose). Would it be possible to define a default anyway

Yes, that would be a problem since, as far as I could tell from a quick experiment, I could not override the "default" via the Taskfile.yaml in my project. If there is a way, please let me know since I agree that having a default value would be nice.

or does it depend on the repository name and should always be defined?

Not sure what you mean with "depend on the repository name". But the task still works if the variable is not defined. (And that is also why I did not add a requires section.)

Would it be an idea to update the example in the README.md as well?

Sure, I can add something to the README.md. I'm thinking about a "Configuration" section within the "Taskfile" section, where I list the task, the variable and why you'd use it (and/or an example). How does that sound?

@markvl-sbp Could you try:

vars:
  SOMETHING: '{{.SOMETHING| default "DefaultSomething"}}'
tasks:
  hello:
    cmds:
      - |
        echo {{.SOMETHING}}

@markvl-sbp
Copy link
Contributor Author

markvl-sbp commented Nov 20, 2024

Could you try:

vars:
  SOMETHING: '{{.SOMETHING| default "DefaultSomething"}}'
tasks:
  hello:
    cmds:
      - |
        echo {{.SOMETHING}}

This indeed works, if you use this to override the variable:

includes:
  remote:
    taskfile: <url to this Taskfile.yml>
    vars:
      SOMETHING: 'SomethingElse'

If you simply add the SOMETHING var to the vars section in your local Taskfile.yml it will not work.

I'll update the PR (including the README) to reflect this new insight.

@markvl-sbp markvl-sbp force-pushed the markvl/add_option_to_configure_gci branch from a0360a8 to 9867a73 Compare November 20, 2024 10:17
@markvl-sbp markvl-sbp merged commit b10b9d6 into main Nov 20, 2024
2 checks passed
@markvl-sbp markvl-sbp deleted the markvl/add_option_to_configure_gci branch November 20, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants