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
Adds support for tmuxinator start --append #652
Conversation
Thanks for this, @flovilmart! I'll try to give it a proper review before the end of the week. |
Take your time @ethagnawl! No rush for that, i'm using it at the moment and probably will weed out some odd edge cases. Also, if you need I can try to add some tests. I'm not very used to ruby though, so it could take time. |
Very nice. The only confusing bit is that it names the new window I see there is some logic to control this behaviour, but I don't fully understand it. Is there an extra flag or configuration value needed to just have the window be called |
@DestyNova that would be a possible change, if the name is not set with the tmux template I could probably remove the separator. This was intended to make it easy to see which windows were appended. |
Yes I see the motivation for it and it makes sense -- in my case though, I expect to end up with a bunch of files that each describe one window with a couple of panes. Since I use windows and panes where other people might use sessions and windows, I don't need that namespacing. Maybe the behaviour could be specified with an optional flag (e.g. if a simple name is default, then add |
I’m not sure I want to spend additional time adding more configuration flags to this PR. If the naming of the windows is problematic i’ll Remove it altogether and restore the original behavior instead of prefixing with the screen name. |
I like the PR either way and am really happy someone has finally done this. Rather than sidetrack the PR, I'll try to do a separate one adding such a flag afterwards. Thanks for doing this :) |
@flovilmart This is looking pretty good! I do have a few questions/thoughts/requests/etc. for you: 1.) Would you mind adding an entry to the "Other Commands" section of README.md in your PR which documents how this feature and its various CLI options are intended to be used? The documentation will be useful for users going forward and for people reviewing this PR. I wasn't following #265 closely and it took me a few minutes to figure out how this feature was intended to work. 2.) A missing/malformed 3.) Could you replace 4.) Perhaps the "Creating new session ..." message should contain the session name? 5.) We will need some tests around this new behavior. Did you ever get a chance to take a pass at writing any? I know you said you're not used to Ruby, so I can appreciate how that might be a bit daunting and it's awesome that you were able to put this together. (I don't think you're giving yourself enough credit!) If not, that's totally fine and I can take a pass at writing some and submit another PR to your branch. |
All of those make sense, i’ll Have a look at the requests and will do the tests as well. I’m only an amateur rubyist, punching letters in to get the expected result as such as often fail to recognize idiomatic patterns. Therefore the code I produce is most likely to be linearly dumb :) |
I Didn’t forget about this one, but my todo list keeps pushing it down. I hope to have more time soon |
@flovilmart Any ETA, we in 2019 already :) |
Well, yea, I need to but my head back into it :) Sent with GitHawk |
Any issue with getting this merged now that the merge conflicts are resolved? |
@icole I need to work on the few tests and documentation. I haven't found a good time to do it. I'll try this weekend. |
@flovilmart awesome, thanks for the response. If you could use any help with anything let me know. Would love to see this go out. |
Thanks @icole I'll do my best to address all the concerns and add the relevant tests. I'd love to get done with this one. Sorry to have dropped the ball. |
@icole Sorry for the late response. I changed a bit the logic so it uses I'll add some tests around the |
@flovilmart thanks so much! could we pull this in after you add those tests? I am dying to get this in since the version this is based off is older than what our projects Gemfile requires. |
I was trying to figure out if tmuxinator had this feature; well, hope it gets merged! |
I completely forgot I had this one open, thanks for the ping 😅! I’ll do my best. |
Any chance this gets merged? It would be super useful. |
@icole what what left for update? I wanna go ahead with this. Can you pin point in the code the different changes required for the merge? |
From what I recall, it's a minor Code Climate nitpick. Unfortunately, the build is old enough that it's been dropped by CC. Could you try pushing a new commit in order to trigger a new build, @flovilmart? |
@ethagnawl the problem is that the |
I haven't used Code Climate in a long time and don't remember how some of their metrics work. I'd say maybe removing the Does anyone else have any thoughts about this or the PR in general? CC/ @tmuxinator/tmuxinator |
@ethagnawl , finally, codeclimate passed! 🎉 |
Okay, that's great. I'll have to find some time to review this again. Sorry for the bother, but does anyone else have any thoughts? /CC @tmuxinator/tmuxinator |
thanks @ethagnawl ! |
lib/tmuxinator/config.rb
Outdated
@@ -25,6 +25,10 @@ def home? | |||
File.directory?(home) | |||
end | |||
|
|||
def options_file | |||
directory + ".yml" |
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.
The "yaml" extension is also supported. I tried using a project config file with this extension and everything worked as expected. Does that imply that this method isn't being used or am I overlooking something?
EDIT: After reading through this again, I don't think this could ever work. (Again, I may be missing something.)
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.
what do you suggest?
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.
Either this method needs to support both extensions or, if I'm correct in that it's not being used, it should be removed.
lib/tmuxinator/project.rb
Outdated
base = 0 | ||
if in_current_session | ||
# Get the last window index + 1 | ||
base = 1 + `tmux list-windows | awk '{print $1}'`.split.last.to_i |
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.
I think this awk logic should either be handled in Ruby code or we should add a method to the Doctor class which verifies that awk exists on the user's system.
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.
fair, let's me see what I can do
lib/tmuxinator/cli.rb
Outdated
|
||
def should_append?(options) | ||
options[:append] == true || | ||
(options[:append] != false && Tmuxinator::Config.options[:append]) |
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.
Could you walk me through the use case for the right side of this ||
and the related Config
method?
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.
the idea is that can set append in the Tmuxinator::Config.options
so all sessions are appending by default.
if append is not provided by the options
(case != false
) we check that it is set in the global Config.
any chance we can get this merged any time soon? it would really boost productivity with tmux/tmuxinator |
@ethagnawl @flovilmart @icole Thanks for this work. |
There are still some issues (noted above) which need to be worked through. (If you feel like running with what's been done and @flovilmart doesn't mind, feel free to pick them up.) It'd also be good to get feedback from others in @tmuxinator/tmuxinator. |
@ethagnawl let me get back on it |
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.
Looking forward to this feature. I left a drive-by review of the code changes.
lib/tmuxinator/window.rb
Outdated
project_name = project.in_current_session ? "#{project.full_name}:" : "" | ||
name ? "-n #{project_name}#{name}" : "" |
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.
I would prefer to drop this change, i.e., for the window to always be named without the prefix.
Thanks @noahfrederick will have a look later |
lib/tmuxinator/config.rb
Outdated
@@ -56,6 +60,12 @@ def default | |||
"#{directory}/default.yml" | |||
end | |||
|
|||
def options | |||
YAML.safe_load(File.read(options_file), [], [], true) || {} |
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.
@flovilmart Would you mind using the new safe_load method signature (remove positional parameters two, three and four and provide keyword argument for aliases
)? As-is, this will cause errors in some environments because of changes to Psych and libyaml.
It would look something like this:
YAML.safe_load(File.read(options_file), aliases: true)
See this PR for more context.
@flovilmart / @ethagnawl -- just pinging those that have worked on this. How are we feeling about your concerns being addressed and getting this merged? |
@megalithic I haven't had the chance to actually finish this one; yeah I know, that's kinda pathetic after all this time 🤣 |
@flovilmart I know your comment was in jest, but it's not pathetic at all. Your contributions are being provided at the expense of whatever else you might be doing with your life and are greatly appreciated. |
@ethagnawl @flovilmart 💯 agreed! OSS is a gift! i'm grateful for each of you that contribute/create such amazing tools. |
Haha! Thanks y’all! very appreciated. I need to find some time for this. I see this is pretty requested. |
I'm wondering when this patch can be merged? Looks like it has a long history from 2018. |
@flovilmart I know this issue probably hunts you in your dreams already, is there still any chance that you find the time to finish this? |
I attempted to rebase this with |
Closes: #265