Skip to content

Commit bd38d5f

Browse files
authored
Merge pull request #178 from myw/fix-help
Improvements to doc strings for command-line help
2 parents 327da1c + c4fbfc1 commit bd38d5f

File tree

3 files changed

+45
-12
lines changed

3 files changed

+45
-12
lines changed

requirements/test.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pytest==2.9.2
2-
pytest-rerunfailures==2.0.0
1+
pytest==3.0.2 # updated from 2.9.2
2+
pytest-rerunfailures==2.0.1 # updated from 2.0.0

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
exclude = .*/,.tox,*.egg,tmuxp/_compat.py,tmuxp/__*__.py,
33
select = E,W,F,N
44

5-
[pytest]
5+
[tool:pytest]
66
addopts = --rerun 5

tmuxp/cli.py

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,11 @@ def reattach(session):
306306
@click.option('--log_level', default='INFO',
307307
help='Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)')
308308
def cli(log_level):
309+
"""Manage tmux sessions.
310+
311+
Pass the "--help" argument to any command to see detailed help.
312+
See detailed documentation and examples at:
313+
http://tmuxp.readthedocs.io/en/latest/"""
309314
try:
310315
has_required_tmux_version()
311316
except exc.TmuxpException as e:
@@ -351,7 +356,10 @@ def startup(config_dir):
351356
@click.option('-S', 'socket_path', help='pass-through for tmux -L')
352357
@click.option('-L', 'socket_name', help='pass-through for tmux -L')
353358
def command_freeze(session_name, socket_name, socket_path):
354-
"""Import teamocil config to tmuxp format."""
359+
"""Snapshot a session into a config.
360+
361+
If SESSION_NAME is provided, snapshot that session. Otherwise, use the
362+
current session."""
355363

356364
t = Server(
357365
socket_name=socket_name,
@@ -434,7 +442,7 @@ def command_freeze(session_name, socket_name, socket_path):
434442
sys.exit()
435443

436444

437-
@cli.command(name='load')
445+
@cli.command(name='load', short_help='Load tmuxp workspaces.')
438446
@click.pass_context
439447
@click.argument('config', click.Path(exists=True), nargs=-1,
440448
callback=resolve_config_argument)
@@ -451,8 +459,27 @@ def command_freeze(session_name, socket_name, socket_path):
451459
help='Like -2, but indicates that the terminal supports 88 colours.')
452460
def command_load(ctx, config, socket_name, socket_path, answer_yes,
453461
detached, colors):
454-
"""Load a tmux workspace from one or multiple CONFIG path to config file,
455-
directory with config file or session name.
462+
"""Load a tmux workspace from each CONFIG.
463+
464+
CONFIG is a specifier for a configuration file.
465+
466+
If CONFIG is a path to a directory, tmuxp will search it for
467+
".tmuxp.{yaml,yml,json}".
468+
469+
If CONFIG is has no directory component and only a filename, e.g.
470+
"myconfig.yaml", tmuxp will search the users's config directory for that
471+
file.
472+
473+
If CONFIG has no directory component, and only a name with no extension,
474+
e.g. "myconfig", tmuxp will search the users's config directory for any
475+
file with the extension ".yaml", ".yml", or ".json" that matches that name.
476+
477+
If multiple configuration files that match a given CONFIG are found, tmuxp
478+
will warn and pick the first one found.
479+
480+
If multiple CONFIGs are provided, workspaces will be created for all of
481+
them. The last one provided will be attached. The others will be created in
482+
detached mode.
456483
"""
457484
util.oh_my_zsh_auto_title()
458485

@@ -486,6 +513,7 @@ def command_load(ctx, config, socket_name, socket_path, answer_yes,
486513

487514
@cli.group(name='import')
488515
def import_config_cmd():
516+
"""Import a teamocil/tmuxinator config."""
489517
pass
490518

491519

@@ -544,32 +572,37 @@ def import_config(configfile, importfunc):
544572
sys.exit()
545573

546574

547-
@import_config_cmd.command(name='teamocil')
575+
@import_config_cmd.command(name='teamocil',
576+
short_help='Convert and import a teamocil config.')
548577
@click.argument(
549578
'configfile', click.Path(exists=True), nargs=1,
550579
callback=_create_resolve_config_argument(get_teamocil_dir)
551580
)
552581
def command_import_teamocil(configfile):
553-
"""Import teamocil config to tmuxp format."""
582+
"""Convert a teamocil config from CONFIGFILE to tmuxp format and import
583+
it into tmuxp."""
554584

555585
import_config(configfile, config.import_teamocil)
556586

557587

558-
@import_config_cmd.command(name='tmuxinator')
588+
@import_config_cmd.command(
589+
name='tmuxinator',
590+
short_help='Convert and import a tmuxinator config.')
559591
@click.argument(
560592
'configfile', click.Path(exists=True), nargs=1,
561593
callback=_create_resolve_config_argument(get_tmuxinator_dir)
562594
)
563595
def command_import_tmuxinator(configfile):
564-
"""Import tmuxinator config to tmuxp format."""
596+
"""Convert a tmuxinator config from CONFIGFILE to tmuxp format and import
597+
it into tmuxp."""
565598
import_config(configfile, config.import_tmuxinator)
566599

567600

568601
@cli.command(name='convert')
569602
@click.argument('config', click.Path(exists=True), nargs=1,
570603
callback=resolve_config_argument)
571604
def command_convert(config):
572-
"""Convert tmuxp config to and from JSON and YAML."""
605+
"""Convert a tmuxp config between JSON and YAML."""
573606

574607
_, ext = os.path.splitext(config)
575608
if 'json' in ext:

0 commit comments

Comments
 (0)