matklad / xshell

Apache License 2.0
695 stars 28 forks source link

`set_*` on `Cmd` should return `Self` and not take it by reference #59

Closed repnop closed 1 year ago

repnop commented 1 year ago

The rest of the builder-style options do this, but not the set_*, which is a really awkward divide when you want to have those be configurable from elsewhere.

matklad commented 1 year ago

That's intentional: set_ work even if you have only &mut Cmd. The other methods take self to make the following work:

let mut cmd = xshell::cmd!().quiet();
cmd.run()

Perhaps we should add with_ family though?

matklad commented 1 year ago

Let's leave as is, unless someone shows a really compelling use-case where with_ would make the code significatnly nicer.