-
Notifications
You must be signed in to change notification settings - Fork 116
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 editor feature #131
Add editor feature #131
Conversation
Fixes all the rspec deprecation messages in the current test suite
This looks great. Thanks for the contribution! I'm traveling at the moment but will work on getting this merged and released as soon as possible. It would be great to add some tests to ensure this isn't broken by future changes. Maybe it'd be reasonable to stub the call to |
Hi Sam, Great, I'll separate out the call to the system method so that it can be stubbed easily. One enhancement to make might be the ability to edit notes in the system editor too? One thing I haven't tested yet is non-terminal based editors (like sublime, atom etc.). One person I was chatting to suggested that those editors won't block the call to system, which would mean the tempfile won't have been written to by the time the call returns. Do you see that as a blocker? I might have a play with using sublime as the git commit program and see how it behaves. Anyway, keen to hear your thoughts on that! |
I just did a quick test (thanks this stackoverflow article) Using sublime text as the editor does work, but it requires adding a So, I think the best thing is instead of using the $EDITOR system variable, to do the same thing as git does, and have a I'll proceed with adding tests and altering the behaviour to use a |
Add a note_editor setting and functionality This allows the user to edit notes in an external editor (vim, emacs, atom, sublime etc.)
b1846d5
to
3d02286
Compare
I was confused for a moment while writing tests as I was unable to use pry and unable to see any of my puts debugging ;) Once I realised that it was because we're using StringIO for stubbing it was obvious :) Anyway, this adds a metadata helper so that you can easily write out to a file what was printed to stderr and stdout.
3b75b8a
to
3380d7b
Compare
Hi Sam, I've added in a spec for testing that the external editor is invoked (stubbed). At the moment this only works when you're checking "in" the note. If you want the ability to edit a timesheet entries note then I could do that as a separate PR. I looked at the editing code and there's quite a bit going on with various flags, appending etc. so I wasn't quite sure what the correct behaviour would look like. Perhaps if I think this can be merged as-is, but happy to combine editing functionality if needed. |
This looks pretty good to me as is. In terms of Anyway I don't think we should let complexity of potential |
Hi Sam, I agree, the edit-in-editor functionality should also be there for this to be useful. For the "in" it only opens in an editor if you don't supply a message. I would think similar logic would work for edit. Assuming the
I would guess most people would use the basic Sound like an approach? No extra flag needed. |
That makes sense. The only cases not covered by your examples are changing
Do you agree that's the best behavior? |
Well, it's your gem so whatever you think best ;) But yes, I think it's reasonable that you'd probably want to edit the message only on appending or with the empty If you're happy with the above then I'll try get it implemented in the next week or so, if you want to hold off on the release until all the functionality is there - up to you :) |
Sounds good. If you're planning to implement the edit functionality I'll hold off shipping a new gem version for a week or two. |
Yup I'm away hiking for the next 4 days, but I'll get it done after that. On Wed, 4 May 2016 01:06 Sam Goldstein notifications@github.com wrote:
|
Hi Sam,
I've created the basic functionality to use the system editor. I have tested this on my OSX box using vim & emacs & nano.
I haven't added tests yet as I'm not really sure how best to mock out the use of an external editor. I could just call out to a method which will create the tempfile etc. and then stub it in tests. Happy to implement that / whatever else you like.
Anyway, let me know if this is what you're after, and thanks for a great gem.
Fixes #101
p.s. apologies for opening & closing the other PR. I wanted to fix up my use of the
IO.read
(and test in a few of the editors, as someone had suggested the behaviour might be different in something other than vim)