morph icon indicating copy to clipboard operation
morph copied to clipboard

RFC: Deployment parameter should have default value

Open fooker opened this issue 6 years ago • 5 comments

I would like to propose deployment.nix as default value wherever the deployment option is needed by the morph command.

fooker avatar Nov 07 '19 21:11 fooker

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 ?

johanot avatar Nov 07 '19 21:11 johanot

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.

fooker avatar Nov 07 '19 21:11 fooker

But if there are reasons for not making the parameter completely optional, morph build . will save some typing, too.

fooker avatar Nov 07 '19 21:11 fooker

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. :-)

johanot avatar Nov 07 '19 21:11 johanot

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.

fooker avatar Nov 08 '19 10:11 fooker