Comments (9)
Released as v0.1.6.
from mmv.
Hmm, this looks to work before merging #10, which allows command line flags in $EDITOR. Not sure how to fix both.
from mmv.
ahh, hm, i see... in this case, i guess C:\Progra~1\Micros~1\Code.exe --wait
will work for me, even if it's not ideal (though very retro)
from mmv.
Using shell could help us? You can configure editor with space path and arguments like export EDITOR="'C:\Program Files\Microsoft VS Code\Code.exe' --wait"
(note the single quotes). This looks like how editor config is handled in git (ref: https://git-scm.com/book/en/v2/Appendix-C%3A-Git-Commands-Setup-and-Config).
diff --git a/cmd/mmv/main.go b/cmd/mmv/main.go
index 8aed5bb..9a627fe 100644
--- a/cmd/mmv/main.go
+++ b/cmd/mmv/main.go
@@ -109,10 +109,8 @@ func rename(args []string) error {
if editor == "" {
editor = "vi"
}
- editorWithArgs := strings.Fields(editor)
- editorWithArgs = append(editorWithArgs, f.Name())
- cmd := exec.Command(editorWithArgs[0], editorWithArgs[1:]...)
+ cmd := exec.Command("sh", "-c", editor+` "$@"`, "", f.Name())
cmd.Stdin = tty.Input()
cmd.Stdout = tty.Output()
cmd.Stderr = tty.Output()
from mmv.
Another patch to reduce the code by resolving the environment in the shell.
diff --git a/cmd/mmv/main.go b/cmd/mmv/main.go
index 8aed5bb..1a97724 100644
--- a/cmd/mmv/main.go
+++ b/cmd/mmv/main.go
@@ -105,14 +105,7 @@ func rename(args []string) error {
}
defer tty.Close()
- editor := os.Getenv("EDITOR")
- if editor == "" {
- editor = "vi"
- }
- editorWithArgs := strings.Fields(editor)
- editorWithArgs = append(editorWithArgs, f.Name())
-
- cmd := exec.Command(editorWithArgs[0], editorWithArgs[1:]...)
+ cmd := exec.Command("sh", "-c", `eval exec ${EDITOR:-vi} '"$@"'`, "", f.Name())
cmd.Stdin = tty.Input()
cmd.Stdout = tty.Output()
cmd.Stderr = tty.Output()
from mmv.
Released as v0.1.5.
from mmv.
i suppose this works on linux, but it broke windows compatibility :/
C:\Users\user\Downloads\mmv_v0.1.5_windows_amd64>mmv *
mmv: abort renames: exec: "sh": executable file not found in %PATH%
sorry about not commenting earlier - i didn't find the time to try the new version until now
from mmv.
I fixed in the main branch. Make sure to confirm the issue is resolved in your environment.
from mmv.
that works, thanks!
from mmv.
Related Issues (13)
- mmv doesn't cope with directory renames correctly HOT 6
- Support to use git mv as an option ? HOT 1
- Please add alternative name
- Support file lists through pipeline HOT 2
- Tips for extensive usage HOT 1
- mmv can overwrite a file over already existing with the same name if it wasn't included in rename. HOT 2
- Feature: Be nice if mmv defaulted to mmv * HOT 1
- A flag to perform `git mv` HOT 2
- lowercasing folder issues HOT 1
- what is difference between vimv ? HOT 2
- mmv command already exists, don't create conflict
- Why there is no -dry-run option?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mmv.