-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add args: --edit-page
and --edit-patch
#388
base: main
Are you sure you want to change the base?
Conversation
c54276c
to
b540fc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! In addition to the comments, the added functionality is not tested by our automated tests yet. I think the tests could run tldr --edit-page foo
with EDITOR=touch
and the custom pages dir set to some temporary directory. Then we can observe that the correct command touch /some/tmp/dir/foo.page.md
is run by checking whether the file exists or not.
Please feel free to reach out for questions, thoughts, or help :)
src/main.rs
Outdated
let editor = env::var("EDITOR").context("env `EDITOR` not set").unwrap(); | ||
let _ = std::process::Command::new(editor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, this does not work if people set EDITOR to something that includes arguments, for example EDITOR="nvim --clean" tldr --edit-page foo
. I checked a couple of programs for how they handle this. Both git config --edit
and sudoedit
just spawn nvim without arguments, omitting the --clean
. I suppose that having arguments in EDITOR is not a common thing then.
I think that crashing is better than omitting the arguments, so the current handling of EDITOR is fine. However, we should handle and print errors returned here.
Additionally, we should think about adding some documentation for this behavior, but let's postpone this until the code is ready.
c757300
to
6e0b71a
Compare
Fix tealdeer-rs#383 Co-authored-by: Niklas Mohrin <dev@niklasmohrin.de>
Fix #383