Allow arguments to be passed on to the EDITOR #1

Closed
opened 2025-11-11 22:19:22 +00:00 by mig5 · 1 comment
mig5 commented 2025-11-11 22:19:22 +00:00 (Migrated from github.com)

My EDITOR is vim.

If I open a file but pass an argument like +695 (jump to line 695), vim will take me to that line:

vim bouquin/markdown_editor.py +695

But if I use mirro, the extra argument is rejected and the app doesn't open:

user@vpn-ssh:~/git/bouquin$ mirro bouquin/markdown_editor.py +695
usage: mirro [-h] [--backup-dir BACKUP_DIR] file
mirro: error: unrecognized arguments: +695

Perhaps it's best to accept any extra args after the file itself, and pass them straight to the EDITOR (don't try to operate on them at the mirro level).

In bash this would be something like $EDITOR $* (single string of args) or $EDITOR $@ (array of args) . In your case, since you're using subprocess, you can probably pass the array of args down to the subprocess call easily enough.

My EDITOR is vim. If I open a file but pass an argument like +695 (jump to line 695), vim will take me to that line: ``` vim bouquin/markdown_editor.py +695 ``` But if I use mirro, the extra argument is rejected and the app doesn't open: ``` user@vpn-ssh:~/git/bouquin$ mirro bouquin/markdown_editor.py +695 usage: mirro [-h] [--backup-dir BACKUP_DIR] file mirro: error: unrecognized arguments: +695 ``` Perhaps it's best to accept any extra args after the file itself, and pass them straight to the EDITOR (don't try to operate on them at the mirro level). In bash this would be something like `$EDITOR $*` (single string of args) or `$EDITOR $@` (array of args) . In your case, since you're using subprocess, you can probably pass the array of args down to the subprocess call easily enough.
mdaleo404 commented 2025-11-12 16:53:02 +00:00 (Migrated from github.com)

Thank you for bringing this up.

The tool isn’t really designed to handle editor arguments directly, it’s meant to behave like an unencrypted version of SOPS where all extra flags and positioning logic are handled by the editor itself through $EDITOR.

That said, I’ll keep this open for now. If I find a clean, dynamic way to support this kind of usage without adding editor-specific logic, I’ll revisit it.

Thank you for bringing this up. The tool isn’t really designed to handle editor arguments directly, it’s meant to behave like an unencrypted version of SOPS where all extra flags and positioning logic are handled by the editor itself through `$EDITOR`. That said, I’ll keep this open for now. If I find a clean, dynamic way to support this kind of usage without adding editor-specific logic, I’ll revisit it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: guardutils/mirro#1