-
-
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
Allow users to use any of the Cake runner arguments as build script arguments #3279
Comments
Hi @augustoproiete, as this seems still open, I'd like to give it a go. |
@alexandru-valeanu Sure. Heads-up that we use Spectre.Console for parsing arguments, so there's a little bit of investigation needed to see if the fix can (and should) be done directly in Cake, of if it should be fixed upstream. If you discover that the fix doesn't belong in Cake, you'd need to send a PR to Spectre.Console and the fix in Cake would be just upgrading to a newer version of Spectre.Console. |
Thanks for the heads-up. |
I'm not sure if this is specified anywhere - but writing constructor like this:
Allows to pick up any additional arguments inside Frosting application. Wondering if this is documented in Cake or known to users of Cake. |
https://github.com/tapika/swupd/blob/develop/cakebuild/CommandLineArgs.cs I've initially sketched command line support for your own cake frosten build application. There are several hacks I have applied - hopefully they could be sorted out in both - in Cake and in Spectre.Console.Cli. Overall problem list:
(P.S. '--version' does not work ?)
And if you want to register your own custom type - that is well protected. I've extracted like this,
IsMatch is not public.
Also non-public.
maybe should be provided by Cake as it's own API? But this also maps to what can be done between assemblies. |
Hey @tapika are you still interested in taking this one? |
Leaving a comment as required @augustoproiete - I'll now wait to see if @tapika responds. |
Can / could do it, but as this is kinda hobby, cannot use 24/7 time. I guess need to integrate changes directly into cake ? Should we aim to improve / patch |
5th item - raised as it's own ticket to |
I have opened a PR on spectreconsole which allows command line options to be specified ahead of arguments without incurring the This PR, if accepted and merged, would make the following command legal syntax: A consequence of the PR being accepted and merged is that fully implementing this cake issue can then be easily done by a further, small code change to spectreconsole. This would introduce a setting (named something like We'd set I'm going to now prepare this follow-on change to spectreconsole. |
Good progress. I do not have so much time to focus on this - working primarily on my own choco fork. Command line argument support is needed only for builder of choco, so it's kinda nice-to-have command line API addition - not primary focus for me. What I have checked by myself - I have misused Spectre console - there was simpler interface for declaring command line arguments. In choco there is used slightly different API would be nice to harmonize them at some point of time to be the same. |
I have raised the following issue on the spectre.console project, which (if done), would fully close off this issue: spectreconsole/spectre.console#1059 |
I have implemented the change to allow flags to be converted to remaining arguments if they cannot be assigned, and submitted the PR for this: spectreconsole/spectre.console#1102 Once merged and a new version of spectre.console is available, turning this behaviour on should be a 1 line code change in the cake codebase 🙂 |
FYI: Potentially unrelated, but might be related in future: |
Update @augustoproiete - I have asked the maintainers of spectre to prioritise the above PR, so once merged, hopefully I can address this cake issue. |
Thanks for chasing @FrankRay78 ! |
PR #4142, which fully addresses this issue, is now green and ready for review/merging. |
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 allow existing "flag" arguments to be used in build scripts, so that if the user runs cake with
--version=1.2.3
do not assume the flag--version
and instead execute the Cake script with the argument["version"] = "1.2.3"
.dotnet cake --version
dotnet cake --version=1.2.3
version
argument to1.2.3
This should work for all Cake runner arguments, except for
Verbosity
which is not a "flag" argument.Related:
The text was updated successfully, but these errors were encountered: