Skip to content

Commit 16e49e4

Browse files
committed
doc update for about page
1 parent bb9b6ff commit 16e49e4

File tree

6 files changed

+76
-32
lines changed

6 files changed

+76
-32
lines changed

doc/about.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,28 @@ Differences
5454

5555
**Programming Language** python. teamocil and tmuxinator uses ruby.
5656

57-
**Internals** teamocil and tmuxinator pipe configurations into
57+
**Internals** teamocil and tmuxinator process configurations into shell
5858
commands. tmuxp turns configuration into a live :class:`Session` object
5959
with access to all window and pane data. See :ref:`internals`.
6060

61-
**CLI** tmuxp's CLI can attach and kill sessions with tab-completion
62-
support.
63-
6461
Additional Features
6562
-------------------
6663

67-
**Unit tests** Tests against live tmux version to test statefulness of
68-
tmux sessions, windows and panes. See :ref:`travis`.
64+
**CLI** tmuxp's CLI can attach and kill sessions with tab-completion
65+
support. See :ref:`commands`.
6966

70-
**Import config** import configs from Teamocil / Tmuxinator [1]_.
67+
**Import config** import configs from Teamocil / Tmuxinator [1]_. See
68+
:ref:`cli_import`.
7169

7270
**Session freezing** Supports session freezing into YAML and JSON
73-
format [1]_.
71+
format [1]_. See :ref:`cli_freeze`.
72+
73+
**JSON config** JSON config support. See :ref:`Examples`.
7474

75-
**JSON config** JSON config support
75+
**ORM-based API** - Utilitizes tmux >= 1.8's unique ID's for panes,
76+
windows and sessions to create an object relational view of the tmux
77+
:class:`Server` and its entities; :class:`Session`, :class:`Window`,
78+
:class:`Pane`. See :ref:`Internals`.
7679

7780
**Conversion** ``$ tmuxp convert <filename>`` can convert files to and
7881
from JSON and YAML.
@@ -84,6 +87,8 @@ from JSON and YAML.
8487
Minor tweaks
8588
------------
8689

90+
- Unit tests against live tmux version to test statefulness of tmux
91+
sessions, windows and panes. See :ref:`travis`.
8792
- Load + switch to new session from inside tmux.
8893
- Resume session if config loaded.
8994
- Pre-commands virtualenv / rvm / any other commands.

doc/cli.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ directory may be loaded with:
3636
3737
$ tmuxp load .
3838
39+
.. _cli_import:
40+
3941
Import
4042
""""""
4143

tmuxp/cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ def command_load(args):
369369
startup(config_dir)
370370
configs_in_user = config.in_dir(config_dir)
371371
configs_in_cwd = config.in_cwd()
372+
print(configs_in_cwd)
373+
sys.exit()
372374

373375
output = ''
374376

@@ -390,13 +392,18 @@ def command_load(args):
390392
if '.' == args.config:
391393
if config.in_cwd():
392394
configfile = config.in_cwd()[0]
395+
print(configfile)
393396
else:
394397
sys.exit('No tmuxp configs found in current directory.')
395398
else:
396399
configfile = args.config
397400
file_user = os.path.join(config_dir, configfile)
398401
file_cwd = os.path.join(cwd_dir, configfile)
402+
print(file_user)
403+
print(file_cwd)
404+
print(cwd_dir)
399405
if os.path.exists(file_cwd) and os.path.isfile(file_cwd):
406+
print('load %s' % file_cwd)
400407
load_workspace(file_cwd, args)
401408
elif os.path.exists(file_user) and os.path.isfile(file_user):
402409
load_workspace(file_user, args)

tmuxp/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ def trickle(sconf):
206206
if not 'start_directory' in windowconfig:
207207
windowconfig['start_directory'] = session_start_directory
208208
else:
209-
if not any(windowconfig['start_directory'].startswith(a) for a in ['~', '/']):
209+
if any(windowconfig['start_directory'] == a for a in ['.', './']):
210+
windowconfig['start_directory'] = os.getcwd()
211+
elif not any(windowconfig['start_directory'].startswith(a) for a in ['~', '/']):
210212
windowconfig['start_directory'] = os.path.join(
211213
session_start_directory, windowconfig['start_directory'])
212214

tmuxp/testsuite/test_config.py

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ def tearDownClass(cls):
132132

133133
class ExpandTest(unittest.TestCase):
134134

135-
'''
136-
assumes the configuration has been imported into a python dict correctly.
137-
'''
135+
"""Assume configuration has been imported into a python dict correctly."""
138136

139137
before_config = {
140138
'session_name': 'sampleconfig',
@@ -154,23 +152,27 @@ class ExpandTest(unittest.TestCase):
154152
{
155153
'window_name': 'logging',
156154
'panes': [
157-
{'shell_command': ['tail -F /var/log/syslog'],
158-
}
155+
{
156+
'shell_command': ['tail -F /var/log/syslog'],
157+
}
159158
]
160159
},
161160
{
162161
'start_directory': '/var/log',
163162
'options': {'automatic_rename': True, },
164163
'panes': [
165-
{'shell_command': 'htop'},
164+
{
165+
'shell_command': 'htop'
166+
},
166167
'vim',
167168
]
168169
},
169170
{
170171
'panes': [
171172
'top'
172173
]
173-
}]
174+
}
175+
]
174176
}
175177

176178
after_config = {
@@ -267,8 +269,10 @@ class InlineTest(unittest.TestCase):
267269
'window_name': 'editor',
268270
'panes': [
269271
{
270-
'start_directory': '~', 'shell_command': 'vim',
271-
}, {
272+
'start_directory': '~',
273+
'shell_command': 'vim',
274+
},
275+
{
272276
'shell_command': 'cowsay "hey"'
273277
},
274278
],
@@ -277,14 +281,20 @@ class InlineTest(unittest.TestCase):
277281
{
278282
'window_name': 'logging',
279283
'panes': [
280-
{'shell_command': 'tail -F /var/log/syslog',
281-
'start_directory': '/var/log'}
284+
{
285+
'shell_command': 'tail -F /var/log/syslog',
286+
'start_directory': '/var/log'
287+
}
282288
]
283289
},
284290
{
285-
'options': {'automatic_rename': True, },
291+
'options': {
292+
'automatic_rename': True,
293+
},
286294
'panes': [
287-
{'shell_command': 'htop'}
295+
{
296+
'shell_command': 'htop'
297+
}
288298
]
289299
}
290300
]
@@ -316,8 +326,10 @@ class InheritanceTest(unittest.TestCase):
316326
'start_directory': '~',
317327
'panes': [
318328
{
319-
'start_directory': '~', 'shell_command': ['vim'],
320-
}, {
329+
'start_directory': '~',
330+
'shell_command': ['vim'],
331+
},
332+
{
321333
'shell_command': ['cowsay "hey"']
322334
},
323335
],
@@ -364,8 +376,10 @@ class InheritanceTest(unittest.TestCase):
364376
{
365377
'window_name': 'logging',
366378
'panes': [
367-
{'shell_command': ['tail -F /var/log/syslog'],
368-
'start_directory':'/var/log'}
379+
{
380+
'shell_command': ['tail -F /var/log/syslog'],
381+
'start_directory':'/var/log'
382+
}
369383
]
370384
},
371385
{

tmuxp/testsuite/test_workspacebuilder.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class StartDirectoryTest(TmuxTestCase):
273273
session_name: sampleconfig
274274
start_directory: '/var'
275275
windows:
276-
- window_name: test
276+
- window_name: supposed to be /var/log
277277
start_directory: '/var/log'
278278
layout: main-horizontal
279279
options:
@@ -283,7 +283,7 @@ class StartDirectoryTest(TmuxTestCase):
283283
- echo "hey"
284284
- shell_command:
285285
- echo "moo"
286-
- window_name: testsa
286+
- window_name: support to be /dev
287287
start_directory: '/dev'
288288
layout: main-horizontal
289289
panes:
@@ -302,6 +302,17 @@ class StartDirectoryTest(TmuxTestCase):
302302
- echo "hey"
303303
- shell_command:
304304
- echo "moo3"
305+
- window_name: cwd relative to config file
306+
layout: main-horizontal
307+
start_directory: ./
308+
panes:
309+
- shell_command:
310+
- pwd
311+
- shell_command:
312+
- echo "hey"
313+
- shell_command:
314+
- echo "moo3"
315+
305316
'''
306317

307318
def test_start_directory(self):
@@ -311,13 +322,16 @@ def test_start_directory(self):
311322
sconfig = config.expand(sconfig)
312323
sconfig = config.trickle(sconfig)
313324

325+
logger.error(sconfig)
326+
314327
builder = WorkspaceBuilder(sconf=sconfig)
315328
builder.build(session=self.session)
316329

317330
assert(self.session == builder.session)
318-
for window in self.session.windows:
319-
for p in window.panes:
320-
self.assertTrue(any(p.get('pane_start_path', ['/var/log', '/dev/', '/var/'])))
331+
for path in ['/var/log', '/dev/', '/var/', os.getcwd()]:
332+
for window in self.session.windows:
333+
for p in window.panes:
334+
self.assertTrue(p.get('pane_start_path', path))
321335

322336
if __name__ == '__main__':
323337
unittest.main()

0 commit comments

Comments
 (0)