morph
morph copied to clipboard
RFC: Deployment parameter should have default value
I would like to propose deployment.nix as default value wherever the deployment option is needed by the morph command.
Clarifying: Similar to how default.nix works for the nix cli?
To allow for something like morph build /some/directory, where /some/directory contains a deployment.nix ?
I was just thinking about morph build where the CWD contains a deployment.nix. But both options seem to be useful and do not interfere with each other.
But if there are reasons for not making the parameter completely optional, morph build . will save some typing, too.
Right. The only reason I can think of right now is shell-completion ergonomics. If we can implement this while still keeping auto-completion sane for combinations like: morph deploy <maybe?-pathlike-arg> switch, then it's all fine by me. :-)
It looks like kingpin can't do required options after optional ones (morph deploy switch vs morph deploy my.nix switch). So we can't make the parameter completely optional.
When it comes to auto-completion, IMO it still makes sens to complete only for *.nix files.
A proof-of-concept implementation is here: https://github.com/fooker/morph/commit/15837a1ec4f85c29151269ff9a94d649e9492f92. I will create a PR after some more fiddling and testing.