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

Proposal for @goal @list #96

Closed
xonixx opened this issue Jan 11, 2022 · 0 comments
Closed

Proposal for @goal @list #96

xonixx opened this issue Jan 11, 2022 · 0 comments
Assignees
Labels
idea wontfix This will not be worked on

Comments

@xonixx
Copy link
Owner

xonixx commented Jan 11, 2022

Motivation: simplify logic in https://github.com/xonixx/intellij-awk/blob/f4e36b0121a82a4840794b96a476e089b194e7b1/Makesurefile#L65 and below.


@goal name @list val1 'val2' $'val3'
@depends_on other@$ITEM
echo $ITEM $INDEX $TOTAL


@list L val1 'val2' $'val3'
@goal name @list L

@glob G '*.txt'
@goal name @glob G

@goal name @list L # simple
@goal name @list @L
@goal name @list @ref L

@depends_on "other@$ITEM"
@depends_on other@ITEM
@depends_on other@
@depends_on @item other # ?

  • List multiline?
  • Should we extend \ to all directives? Cons: adds more ways to do the thing
@list L \
    val1 \
    val2 \
    Val3

@depends_on \
  Goal1 \
  Goal2 \
  goal3

@goal \

What if just

@list L val1 val2
Val3
Val4 val5 #comment
# comment
Val6

Substitutes in list values?
Exclude for now?


mix @depends_on & @depends_on @item

  • What if we need different logic in template goal?
  • Is this really relevant? Cases: different @depends_on. Different scripts can be handled with if/else
  • This also applies to @glob — but it’s been OK so far…

Idea 1. Allow override? Why additional keyword? Because dup goals naturally cause error.

@override @goal name@val
  • only delta? … Seems less clear to use.

Idea 2. Just exclude value from list and use custom goal!!!


  • newlines in strings? Why: may be needed to @list values
  • This needs to adjust global parsing

———
Another use-case could be to help with « goal parameters » scenario https://github.com/casey/just#recipe-parameters. In makesure we deliberately rejected the idea of parameterized goals https://github.com/xonixx/makesure#omitted-features. However the presence of @list can help to cover all possible parameters in a build file like so:

@goal g @list param1 param2 param3
  program —with-param "$ITEM"

# ./makesure g@param2

Cons: however it’s not clear why the above is better than explicit

@goal g@param1 # actually you can set more meaningful name!
@doc and have doc string
  program —with-param param1

@goal g_param_2
  program —with-param param2

…
# also can abstract 'program —with-param paramName' in @lib

Cons2: Looks like the semantics of ./makesure g # invoke-all is not always meaningful for this use case.

Thought: Maybe we need even more flexible idea of @goal g @array key=val key2=val2. The idea here would be to have decoupled goal names g@key from implementation over val.

To me this parameterized goals use-case plays more against this feature than in favor of it, since the feature adds more ways to do the same thing not necessarily in better way.

@xonixx xonixx added the idea label Jan 11, 2022
@xonixx xonixx self-assigned this Jan 11, 2022
@xonixx xonixx changed the title Implement @goal @list Proposal for @goal @list Jan 21, 2022
@xonixx xonixx added the wontfix This will not be worked on label Dec 8, 2022
@xonixx xonixx closed this as completed Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant