1- """Command line tool for managing tmux workspaces and tmuxp configurations .
1+ """Command line tool for managing tmuxp workspaces .
22
33tmuxp.cli.load
44~~~~~~~~~~~~~~
@@ -109,7 +109,7 @@ def set_layout_hook(session: Session, hook_name: str) -> None:
109109
110110def load_plugins (sconf : t .Any ) -> t .List [t .Any ]:
111111 """
112- Load and return plugins in config
112+ Load and return plugins in workspace
113113 """
114114 plugins = []
115115 if "plugins" in sconf :
@@ -173,7 +173,7 @@ def _reattach(builder: WorkspaceBuilder):
173173
174174def _load_attached (builder : WorkspaceBuilder , detached : bool ) -> None :
175175 """
176- Load config in new session
176+ Load workspace in new session
177177
178178 Parameters
179179 ----------
@@ -206,7 +206,7 @@ def _load_attached(builder: WorkspaceBuilder, detached: bool) -> None:
206206
207207def _load_detached (builder : WorkspaceBuilder ) -> None :
208208 """
209- Load config in new session but don't attach
209+ Load workspace in new session but don't attach
210210
211211 Parameters
212212 ----------
@@ -223,7 +223,7 @@ def _load_detached(builder: WorkspaceBuilder) -> None:
223223
224224def _load_append_windows_to_current_session (builder : WorkspaceBuilder ) -> None :
225225 """
226- Load config as new windows in current session
226+ Load workspace as new windows in current session
227227
228228 Parameters
229229 ----------
@@ -289,29 +289,29 @@ def load_workspace(
289289 Notes
290290 -----
291291
292- tmuxp will check and load a configuration file. The file will use ConfigReader
292+ tmuxp will check and load a workspace file. The file will use ConfigReader
293293 to load a JSON/YAML into a :py:obj:`dict`. Then :func:`config.expand` and
294294 :func:`config.trickle` will be used to expand any shorthands, template
295295 variables, or file paths relative to where the config/script is executed
296296 from.
297297
298298 :func:`config.expand` accepts the directory of the config file, so the
299- user's configuration can resolve absolute paths relative to where the
300- config file is. In otherwords, if a config file at */var/moo/hi.yaml*
301- has *./* in its configs , we want to be sure any file path with *./* is
299+ user's workspace can resolve absolute paths relative to where the
300+ workspace file is. In otherwords, if a workspace file at */var/moo/hi.yaml*
301+ has *./* in its workspaces , we want to be sure any file path with *./* is
302302 relative to */var/moo*, not the user's PWD.
303303
304304 A :class:`libtmux.Server` object is created. No tmux server is started yet,
305305 just the object.
306306
307- The prepared configuration and the server object is passed into an instance
307+ The prepared workspace and its server object is passed into an instance
308308 of :class:`~tmuxp.workspace.builder.WorkspaceBuilder`.
309309
310310 A sanity check against :meth:`libtmux.common.which` is ran. It will raise
311311 an exception if tmux isn't found.
312312
313313 If a tmux session under the same name as ``session_name`` in the tmuxp
314- configuration exists, tmuxp offers to attach the session. Currently, tmuxp
314+ workspace exists, tmuxp offers to attach the session. Currently, tmuxp
315315 does not allow appending a workspace / incremental building on top of a
316316 current session (pull requests are welcome!).
317317
@@ -365,15 +365,19 @@ def load_workspace(
365365 )
366366
367367 # ConfigReader allows us to open a yaml or json file as a dict
368- raw_config = config_reader .ConfigReader ._from_file (workspace_file ) or {}
368+ raw_workspace = config_reader .ConfigReader ._from_file (workspace_file ) or {}
369369
370- # shapes configurations relative to config / profile file location
371- sconfig = config .expand (raw_config , cwd = os .path .dirname (workspace_file ))
372- # Overwrite session name
370+ # shapes workspaces relative to config / profile file location
371+ expanded_workspace = config .expand (
372+ raw_workspace , cwd = os .path .dirname (workspace_file )
373+ )
374+
375+ # Overridden session name
373376 if new_session_name :
374- sconfig ["session_name" ] = new_session_name
375- # propagate config inheritance (e.g. session -> window, window -> pane)
376- sconfig = config .trickle (sconfig )
377+ expanded_workspace ["session_name" ] = new_session_name
378+
379+ # propagate workspace inheritance (e.g. session -> window, window -> pane)
380+ expanded_workspace = config .trickle (expanded_workspace )
377381
378382 t = Server ( # create tmux server object
379383 socket_name = socket_name ,
@@ -384,15 +388,15 @@ def load_workspace(
384388
385389 shutil .which ("tmux" ) # raise exception if tmux not found
386390
387- try : # load WorkspaceBuilder object for tmuxp config / tmux server
391+ try : # load WorkspaceBuilder object for tmuxp workspace / tmux server
388392 builder = WorkspaceBuilder (
389- sconf = sconfig , plugins = load_plugins (sconfig ), server = t
393+ sconf = expanded_workspace , plugins = load_plugins (expanded_workspace ), server = t
390394 )
391395 except exc .EmptyWorkspaceException :
392- tmuxp_echo ("%s is empty or parsed no config data" % workspace_file )
396+ tmuxp_echo ("%s is empty or parsed no workspace data" % workspace_file )
393397 return None
394398
395- session_name = sconfig ["session_name" ]
399+ session_name = expanded_workspace ["session_name" ]
396400
397401 # if the session already exists, prompt the user to attach
398402 if builder .session_exists (session_name ) and not append :
@@ -465,7 +469,7 @@ def load_workspace(
465469
466470
467471def workspace_file_completion (ctx , params , incomplete ):
468- config_dir = pathlib .Path (get_workspace_dir ())
472+ workspace_dir = pathlib .Path (get_workspace_dir ())
469473 choices : t .List [pathlib .Path ] = []
470474
471475 # CWD Paths
@@ -480,8 +484,8 @@ def workspace_file_completion(ctx, params, incomplete):
480484 for p in pathlib .Path .cwd ().glob ("*/.tmuxp.*" )
481485 ]
482486
483- # Project configs
484- choices += sorted ((config_dir / c ).stem for c in in_dir (str (config_dir )))
487+ # Project workspace
488+ choices += sorted ((workspace_dir / c ).stem for c in in_dir (str (workspace_dir )))
485489
486490 return sorted (str (c ) for c in choices if str (c ).startswith (incomplete ))
487491
@@ -491,7 +495,7 @@ def create_load_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP
491495 "workspace_files" ,
492496 nargs = "+" ,
493497 metavar = "workspace-file" ,
494- help = "filepath to session or filename of session if in tmuxp config directory" ,
498+ help = "filepath to session or filename of session in tmuxp workspace directory" ,
495499 )
496500 parser .add_argument (
497501 "-L" ,
@@ -539,7 +543,7 @@ def create_load_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP
539543 "--append" ,
540544 dest = "append" ,
541545 action = "store_true" ,
542- help = "load configuration , appending windows to the current session" ,
546+ help = "load workspace , appending windows to the current session" ,
543547 )
544548 colorsgroup = parser .add_mutually_exclusive_group ()
545549
@@ -583,25 +587,25 @@ def command_load(
583587 args : CLILoadNamespace ,
584588 parser : t .Optional [argparse .ArgumentParser ] = None ,
585589) -> None :
586- """Load a tmux workspace from each CONFIG .
590+ """Load a tmux workspace from each WORKSPACE_FILE .
587591
588- CONFIG is a specifier for a configuration file.
592+ WORKSPACE_FILE is a specifier for a workspace file.
589593
590- If CONFIG is a path to a directory, tmuxp will search it for
594+ If WORKSPACE_FILE is a path to a directory, tmuxp will search it for
591595 ".tmuxp.{yaml,yml,json}".
592596
593- If CONFIG is has no directory component and only a filename, e.g.
594- "myconfig .yaml", tmuxp will search the users's config directory for that
597+ If WORKSPACE_FILE is has no directory component and only a filename, e.g.
598+ "myworkspace .yaml", tmuxp will search the users's workspace directory for that
595599 file.
596600
597- If CONFIG has no directory component, and only a name with no extension,
598- e.g. "myconfig ", tmuxp will search the users's config directory for any
601+ If WORKSPACE_FILE has no directory component, and only a name with no extension,
602+ e.g. "myworkspace ", tmuxp will search the users's workspace directory for any
599603 file with the extension ".yaml", ".yml", or ".json" that matches that name.
600604
601- If multiple configuration files that match a given CONFIG are found, tmuxp
605+ If multiple workspace files that match a given WORKSPACE_FILE are found, tmuxp
602606 will warn and pick the first one found.
603607
604- If multiple CONFIGs are provided, workspaces will be created for all of
608+ If multiple WORKSPACE_FILEs are provided, workspaces will be created for all of
605609 them. The last one provided will be attached. The others will be created in
606610 detached mode.
607611 """
0 commit comments