Skip to content

Commit 93ffc3b

Browse files
committed
docs, think about whether to pass in session object or reverse lookup via _TMUX
1 parent db269b4 commit 93ffc3b

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

main.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@
4444
interact with the most recently attached client you attached. When
4545
testing, just run a ``tmux`` in shell and do what you have to do.
4646
47+
fnmatch
48+
tmuxwrapper is intended to work with fnmatch compatible functions. If
49+
an fnmatch isn't working at the API level, please file an issue.
50+
51+
Limitations
52+
The client that is picked is most recently attached. For normal usage,
53+
this isn't an issue, but more much more advanced used cases, <0.5% of
54+
people may not be covered.
55+
4756
"""
4857
import kaptan
4958
from sh import tmux as tmx, cut, ErrorReturnCode_1
@@ -640,13 +649,39 @@ def __repr__(self):
640649

641650
class Server(object):
642651
'''
643-
holds information on live, running tmux server
652+
``t`` global. stores information on live, running tmux server
644653
645654
Server.sessions [<Session>, ..]
646655
Session.windows [<Window>, ..]
647656
Window.panes [<Pane>, ..]
648657
Pane
649658
659+
Panes, Windows and Sessions which are populated with _TMUX MetaData.
660+
661+
This is an experimental design choice to just leave `-F` commands to give
662+
_TMUX information, decorate methods to throw an exception if it requires
663+
interaction with tmux
664+
665+
This way, with ._TMUX, session and window can be accessed as a property,
666+
and the session and window may be looked up dynamically.
667+
668+
The children inside a ``t`` object are created live. We should look into
669+
giving them context managers so::
670+
671+
with Server.select_session(fnmatch):
672+
# have access to session object
673+
# note at this level fnmatch may have to be done via python
674+
# and list-sessions to retrieve object correctly
675+
session.la()
676+
with session.active_window() as window:
677+
# access to current window
678+
pass
679+
with session.find_window(fnmatch) as window:
680+
# access to tmux matches window
681+
with window.active_path() as pane:
682+
# access to pane
683+
pass
684+
650685
'''
651686
def list_sessions(self):
652687
pass

0 commit comments

Comments
 (0)