Command Line Interface (xonsh.main
)¶
The main xonsh script.
-
class
xonsh.main.
XonshMode
[source]¶ An enumeration.
-
interactive
= 3¶
-
script_from_file
= 1¶
-
script_from_stdin
= 2¶
-
single_command
= 0¶
-
-
xonsh.main.
main_context
(argv=None)[source]¶ Generator that runs pre- and post-main() functions. This has two iterations. The first yields the shell. The second returns None but cleans up the shell.
-
xonsh.main.
path_argument
(s)[source]¶ Return a path only if the path is actually legal
This is very similar to argparse.FileType, except that it doesn’t return an open file handle, but rather simply validates the path.
-
xonsh.main.
postmain
(args=None)[source]¶ Teardown for main xonsh entry point, accepts parsed arguments.
-
xonsh.main.
setup
(ctx=None, shell_type='none', env=(('RAISE_SUBPROC_ERROR', True), ))[source]¶ Starts up a new xonsh shell. Calling this in function in another packages __init__.py will allow xonsh to be fully used in the package in headless or headed mode. This function is primarily indended to make starting up xonsh for 3rd party packages easier.
- Parameters
ctx : dict-like or None, optional
The xonsh context to start with. If None, an empty dictionary is provided.
shell_type : str, optional
The type of shell to start. By default this is ‘none’, indicating we should start in headless mode.
env : dict-like, optional
Environment to update the current environment with after the shell has been initialized.