Skip to content
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

feat: Attach sessions by unique prefix name (#1169) #1360

Merged
merged 9 commits into from
May 3, 2022

Conversation

raphCode
Copy link
Contributor

@raphCode raphCode commented Apr 28, 2022

This missing feature bothered me for a while, see also #1169.
Maybe I also just wanted to have some fun with Rust's fantastic match blocks :D

Ideas what could be improved:

  • generate sessions names that avoid having the same starting characters (probably won't happen often in practice anyway)
  • eliminate session_exists() by using my new match_session_name() at callsites (no idea if this gives a benefit)
  • add tests
  • you tell me

Commit message body:

This make attaching to sessions more convenient since only the first character(s) of the
session name must be typed.
If this prefix matches multiple sessions and is therefore ambiguous, zellij will complain
and show all sessions names starting with these characters.
If any session name matches the given string exact, it is attached immediately, therefore
it is always possible to attach to every session, even if the set of session names is not
prefix-free.

@raphCode raphCode temporarily deployed to cachix April 28, 2022 20:53 Inactive
@raphCode raphCode temporarily deployed to cachix April 28, 2022 20:53 Inactive
This make attaching to sessions more convenient since only the first character(s) of the
session name must be typed.
If this prefix matches multiple sessions and is therefore ambiguous, zellij will complain
and show all sessions names starting with these characters.
If any session name matches the given string exact, it is attached immediately, therefore
it is always possible to attach to every session, even if the set of session names is not
prefix-free.
@raphCode raphCode temporarily deployed to cachix April 28, 2022 20:55 Inactive
@raphCode raphCode temporarily deployed to cachix April 28, 2022 20:55 Inactive
@raphCode raphCode requested review from a-kenji and imsnif and removed request for imsnif and a-kenji May 2, 2022 17:33
@raphCode raphCode temporarily deployed to cachix May 3, 2022 11:24 Inactive
@raphCode raphCode temporarily deployed to cachix May 3, 2022 11:24 Inactive
@raphCode raphCode temporarily deployed to cachix May 3, 2022 11:33 Inactive
@raphCode raphCode temporarily deployed to cachix May 3, 2022 11:33 Inactive
This gets rid of a match block which just exits on errors anyway.
@raphCode raphCode temporarily deployed to cachix May 3, 2022 14:18 Inactive
@raphCode raphCode temporarily deployed to cachix May 3, 2022 14:18 Inactive
@raphCode
Copy link
Contributor Author

raphCode commented May 3, 2022

wtf, a 2 character string message change made the e2e test pass again

@raphCode raphCode temporarily deployed to cachix May 3, 2022 16:04 Inactive
@raphCode raphCode temporarily deployed to cachix May 3, 2022 16:04 Inactive
@raphCode raphCode temporarily deployed to cachix May 3, 2022 16:26 Inactive
@raphCode raphCode temporarily deployed to cachix May 3, 2022 16:26 Inactive
@raphCode raphCode merged commit 7b0a46f into main May 3, 2022
@har7an har7an deleted the attach_convenience branch October 23, 2022 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant