-
-
Notifications
You must be signed in to change notification settings - Fork 723
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
Assume arguments provided _after_ the .cake script (when provided) to be "remaining arguments" #3280
Comments
Hi @augustoproiete, can I please take this issue (#3280) and also the closely related #3279 ? |
Hey @FrankRay78 assigned this one to you. As for #3279 I reached out to someone that seemed to be making progress on it. If we don't hear from them in a few days, it's all yours (I'll need you to add a comment on #3279 before I can assign it to you because of how GitHub works) |
nb. I've come across the following spectre issue (spectreconsole/spectre.console#203) when working on this issue, although it's not a blocker it is relevant as I would expect command line flags to depart the 'remaining args' list once successfully parsed. |
The cake runner command line arguments that are standalone (ie. do not require a cake build script) are highlighted in the following table, first column answered as No
|
Ok, I've done an amount of work on this and my findings so far are as follows.... I suspect the ultimate solution lies in checking the arguments passed into Then if a cake file has been specified, split the args in half by the cake file, ensuring the cake file name is in the first split. This could be done something similar to the following:
The code could proceed as currently implemented but only with the At some point soon after and once everything has been initialised, the |
The required behaviour being asked for in this issue becomes quite complex when combinations of various command line arguments are considered, particularly pre- and post- the specified cake build script. To bottom this out fully, I'm listing some scenarios below to clarify what the required behaviour should be. Cake.Tool version 2.2.0 along with the following cake build script (named
Hi @augustoproiete - please could yourself (or delegated project member) carefully read this comment and verify the expected behaviour in each row of the table is correct? I have included the actual cake build script used, along with the full Apologies in advance for the level of detail I have gone to, but the more I looked at what was required for this issue, the more complicated it became when factoring in multiple command line arguments. I'm also unlikely to proceed any further with this issue until I've got confirmation that the expected behaviour outlined in the above table, is actually what is being asked for. Additionally, implementing this issue as requested will break backwards compatibility!!! For example, see the table entry above for |
I'm now close to being able to implement related issue #3279, see my most recent comment: #3279 (comment) I suspect that issue 3279, once fully implemented, may be sufficient to fully satisfy this issue as cake users will be able to use the built-in cake options as remaining arguments (whilst avoiding need to use the If however, there remains a desire to strictly enforce all command line options before the cake build file as cake runner options, and all the command line options after the cake build file as remaining arguments, then to preserve status quo and avoid introducing breaking changes, I would suggest a new cake command is made available to the user. For example,
ie.
I would be happy to write this new command if asked. Documentation on the cake website project would probably need to be updated as well, here for example: https://cakebuild.net/docs/running-builds/runners/dotnet-tool |
Hello @devlead, @augustoproiete, given that #3279 is very close to being resolved through PR #4142, do you have any thoughts as to this very closely related issue, in particular to my most recent comment (quoted just above for brevity)? |
Hey @FrankRay78 I like your idea of implementing a new I also would suggest we update the e.g.
|
Sounds good @augustoproiete, I hadn't thought about using a warning to prepare for the future transition. Can you assign this issue to me again and I will implement it? |
Background
The Cake runner supports a number of arguments, such
--version
to display the version of the runner, or--debug
to launch the script in debug mode.However, this make it impossible for these names to be used as arguments in Cake build scripts. For example, if one wanted to use the argument
version
as an input to the build script:And then run Cake:
They would receive an error:
Flags cannot be assigned a value
Workaround
The current workaround is to use the "remaining arguments" feature when using one of these "reserved" argument names:
Proposal
This issue intends to make the necessary updates to - only when a
.cake
file is provided as an argument - to assume that any arguments after the.cake
file to be considered as "remaining arguments" instead of Cake runner arguments.In other words: Consider that all arguments before the
.cake
filename to be arguments targeted at the Cake runner, and all arguments after the.cake
filename to be targeted at the build script:dotnet cake --version
dotnet cake --version=1.2.3
Flags cannot be assigned a value
(unless #3279 is implemented)dotnet cake build.cake --version=1.2.3
version
argument to1.2.3
dotnet cake --version=1.2.3 build.cake
Flags cannot be assigned a value
(unless #3279 is implemented)This should work for all Cake runner arguments.
Related:
The text was updated successfully, but these errors were encountered: