Conversation
|
Thanks @jdelStrother for this thoughtful PoC! I'm currently traveling and will be a little slow (I'm actually currently writing this from an airplane In general, this seems like a sound approach. The on thing I believe it would lose is the user can no longer do the full subset of any shell invocation they might normally do that would be preserved with an eval. For example, mixing scmpuff numerics with a shell history expansion such as Another method of (possibly?) avoiding |
I think this still works ok - with something like: bash is going to expand !$ to 'foo' before calling the |
This is a replacement for the `eval $(scmpuff expand -- git ... )` approach. Instead of needing to escape the arguments and then have the shell eval them (which seems difficult/impossible in a cross-shell manner), `scmpuff exec git ...` will expand the arguments and then exec git directly.
|
I've added a few tests and refactored the shared exec/expand code to a new |
|
Thanks @jdelStrother, this is looking good. The new package does help DRY things up. Thanks for the bump.
^^^ EDIT: in retrospect, after hitting enter, I'm now wondering if |
mroth
left a comment
There was a problem hiding this comment.
Not too much in code review -- looks clean!
| @@ -0,0 +1,87 @@ | |||
| package arguments | |||
There was a problem hiding this comment.
Since this isn't a command itself, the package should not exist in the top-level commands hierarchy. I'd put it in commands/internal/arguments (the internal directory has special meaning, see: https://blog.learngoprogramming.com/special-packages-and-directories-in-go-1d6295690a6b), which allows other command packages to import it and share the code but doesn't make it globally exported.
There was a problem hiding this comment.
In addition, please add a docstring comment of the syntax // Package arguments ... in order to appease go-lint. A simple line or two describing the purpose of the package will suffice.
There was a problem hiding this comment.
Will do, thanks. I’m new to go so wasn’t sure of the best way of packaging it
There was a problem hiding this comment.
This is done, although I wasn't able to get go-lint to produce a warning if that comment was missing, so not totally sure I've fixed it correctly
I did something for this here - 9fe9e4d . I'm not totally sure about it: • I can't persuade !$ to work in cucumber, I'm not totally sure why. Something about the way it's invoking the commands..? Instead I've set an environment variable called FILE and used that (
We could do... One of my reservations is that exec & expand still have subtle differences (eg, expand's handling of empty args - scmpuff/commands/expand/expand.go Lines 66 to 69 in 2233a2c I think it also depends on how careful you want to be about backwards compatibility. If someone does have a shell script that uses |
|
If I rebase this, can we get it merged? |
|
Sincere apologies for the delay! Yes, please rebase and check for conflicts, and I'll review to refresh my memory and see if I can help out with those open questions for the Cucumber tests. I should hopefully have some spare time next week to do so. |
|
I've rebased - let me know if there's any else I can do to help merge. |
|
This is looking good to me and I think it's ready to merge! 🎉 We'll probably want to cut a release shortly thereafter. (I'm wondering if it makes sense to do a "release candidate" build of some kind to verify no unexpected behavior is hitting people with edge case setups? Though I don't know if we'd have enough RC testers to actually get that feedback in a timely fashion.) |
I'd love to get fish support into that release if possible - I have a branch for that which builds on top of this one. I'll try and get that tidied up this weekend. |
|
@jdelStrother it's been a year and neither of us has been doing much on this repo -- should we potentially go ahead and re-visit doing this merge now? (I'm thinking of doing some build tooling cleanup in this repo to get it to build macOS ARM builds for this with M1 chipsets, but would want to try to get the baseline app in a stable state first.) |
|
Sure, yes please. FWIW since then I've been using https://github.com/jdelStrother/scmpuff/commits/master daily without running into any issues - that's just this branch with added support for |
|
@jdelStrother Awesome. Can you please rebase this PR branch off the latest (After that, perhaps we should start a new issue to work on getting the fish support into main as well!) |
|
|
This is an attempt to sidestep limitations in the
eval $(scmpuff expand -- git ... )approach.Instead of needing to escape the arguments and then have the shell eval them (which seems difficult/impossible in a cross-shell manner), how about having scmpuff run git internally? For example:
This is just a POC - there's no tests, and exec.go is mostly a copy-paste of expand.go. If it seems like a good approach I can try to fix those.
Is
scmpuff expandworth keeping? What use case does it solve thatscmpuff execcan't be used for?