Skip to content

allows tasks access to extra (unnamed) task arguments #70

Closed
wants to merge 1 commit into from

3 participants

@btaitelb

Pros:

  • This lets rake tasks use varargs-style parameters.
  • This is useful for passing in lists, as well as handling string params containing commas.

Possible Issues:

  • If a task is currently iterating through the args, and the task is called with additional arguments, then this could break an existing task. Calling the rake task with unnamed arguments was previously incorrect usage, however.
  • If someone names their params like arg_001 then unnamed params will overwrite the value. Naming args like that, however, is pretty bad practice.
@btaitelb btaitelb Allows accessing unnamed task arguments
Pros:
 - This lets rake tasks use varargs-style parameters.
 - This is useful for passing in lists, as well as handling string params containing commas.

Possible Issues:
 - If a task is currently iterating through the args, and the task is called with additional arguments,
   then this could break an existing task. Calling the rake task with unnamed arguments was previously
   incorrect usage, however.
 - If someone names their params like _arg_001_ then unnamed params will overwrite the value.
   Naming args like that, however, is pretty bad practice.
dc6b513
@mdesantis

Does anyone have informations about this? It's very ugly rake cannot take commas in the arguments

@jimweirich
Owner

The idea of var args to tasks is intriguing, but not with that ugly argument naming scheme. I would suggest enhancing TaskArguments with a 'values' method and use that to access a list of values (named or otherwise). Maybe some way of indicating that variable args are acceptable to the task.

@jimweirich
Owner

There is a similar pull request open with an improved implementation (#150). I'm closing this request in favor of #150.

@jimweirich jimweirich closed this Nov 23, 2012
@heemin32 heemin32 referenced this pull request in ruby/rake May 2, 2015
Closed

Commas in string arguments? #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.