cli: allow calling core functions directly
Fixes https://github.com/dagger/dagger/issues/6947
Current implementation uses a boolean flag -c/--core (mutually exclusive with -m/--mod), to use core functions, instead of loading a module.
Can be run from anywhere as it doesn't require a module to load:
Todo
- [ ] Bikeshed on
-cflag - [ ] Add tests
Update: based on discussion in https://github.com/dagger/dagger/issues/6947, may need to make some changes:
- dagger -m- container
+ dagger -m container
Check if what's in -m matches a field under Query first, and fallback to the usual module loading behavior if not.
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Update: changed implementation from -m flag to new -c,--core flag. PR this was based on was merged so taking out of draft.
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Reimplemented as dagger core after some discussions in Discord. See:
- https://github.com/dagger/dagger/issues/6947#issuecomment-2245024282
I also like
call --core, but after discussing with @helderco,dagger corehas a few advantages.
We can keep the refactoring that allows the stepping stone to dagger container. It's a very small change to turn this back into the call --core flag. The inverse wasn't true but that work is done and not lost. It would take around 5mins to switch to the flag.
Basically add the mutually exclusive flag (code already in a previous commit in this PR), and set fc.DisableModuleLoad = true dynamically if --core is set, instead of statically here:
https://github.com/dagger/dagger/blob/1d36e77d177a6c7d4614feb490dddd7c2f859ea2/cmd/dagger/call.go#L20-L29
Perhaps at least mark dagger core as experimental which shows a message in dagger core --help (the feature is still available, even though we're not using it in any command atm). That would signal to users that it could later change to something else, whether it's dagger call -c container or dagger container.
Perhaps at least mark
dagger coreas experimental which shows a message indagger core --help(the feature is still available, even though we're not using it in any command atm)
I think this is worth doing regardless.
I'd also be happier with a --core flag - but at this point, we've been discussing for so longer, I really really would just rather ship something in the next release. As you mention, if it's experimental, we can adjust with feedback later :tada:
I've added this to the next milestone, so we'll definitely get this for the next release - at least then we've got an upper limit on how long we're allowed to keep discussing this for :laughing:
I added the "experimental" annotation. This way it's justifiable if we decide to change the DX. Just waiting for the checks to pass before merge.