Ejemplo n.º 1
0
def cat_main(args=None):
    import sys
    from xonsh.main import setup

    setup()
    args = sys.argv[1:] if args is None else args
    cat(args, sys.stdin, sys.stdout, sys.stderr)
Ejemplo n.º 2
0
def cat_main(args=None):
    import sys
    from xonsh.main import setup

    setup()
    args = sys.argv if args is None else args
    cat(args, sys.stdin, sys.stdout, sys.stderr)
Ejemplo n.º 3
0
def run_alias(name: str, args=None):
    import sys
    from xonsh.main import setup
    from xonsh.built_ins import subproc_uncaptured
    from xonsh.xontribs import xontribs_load

    setup()

    xontribs_load(["coreutils"])
    args = sys.argv[1:] if args is None else args

    subproc_uncaptured([name] + args)
Ejemplo n.º 4
0
def main(args=None):
    from xonsh.main import setup

    setup()

    p = make_parser()
    ns = p.parse_args(args=args)

    webconfig_dir = os.path.dirname(__file__)
    if webconfig_dir:
        os.chdir(webconfig_dir)
    serve(ns.browser)
Ejemplo n.º 5
0
def pytest_configure(config):
    setup()
Ejemplo n.º 6
0
from xonsh.main import setup

setup()
del setup

__version__ = "0.0.5"
Ejemplo n.º 7
0
            "banner": self.banner,
        }
        self.send(
            self.shell_stream,
            "kernel_info_reply",
            content,
            parent_header=message["header"],
            identities=identities,
        )


if __name__ == "__main__":
    setup(
        shell_type="jupyter",
        env={'PAGER': 'cat'},
        aliases={'less': 'cat'},
        xontribs=['coreutils'],
        threadable_predictors={
            'git': predict_true,
            'man': predict_true
        },
    )
    if builtins.__xonsh_commands_cache__.is_only_functional_alias('cat'):
        # this is needed if the underlying system doesn't have cat
        # we supply our own, because we can
        builtins.aliases['cat'] = 'xonsh-cat'
        builtins.__xonsh_env__['PAGER'] = 'xonsh-cat'
    shell = builtins.__xonsh_shell__
    kernel = shell.kernel = XonshKernel()
    kernel.start()
Ejemplo n.º 8
0
"""The libcflib package."""
# setup xonsh
from xonsh.main import setup

setup(shell_type="none")
del setup

# setup environment
from libcflib.environ import setup

setup()
del setup


__version__ = "0.0.3"
Ejemplo n.º 9
0
            "implementation": self.implementation,
            "implementation_version": self.implementation_version,
            "language_info": self.language_info,
            "banner": self.banner,
        }
        self.send(
            self.shell_stream,
            "kernel_info_reply",
            content,
            parent_header=message["header"],
            identities=identities,
        )


if __name__ == "__main__":
    setup(
        shell_type="jupyter",
        env={"PAGER": "cat"},
        aliases={"less": "cat"},
        xontribs=["coreutils"],
        threadable_predictors={"git": predict_true, "man": predict_true},
    )
    if builtins.__xonsh__.commands_cache.is_only_functional_alias("cat"):
        # this is needed if the underlying system doesn't have cat
        # we supply our own, because we can
        builtins.aliases["cat"] = "xonsh-cat"
        builtins.__xonsh__.env["PAGER"] = "xonsh-cat"
    shell = builtins.__xonsh__.shell
    kernel = shell.kernel = XonshKernel()
    kernel.start()
Ejemplo n.º 10
0
            "banner": self.banner,
        }
        self.send(
            self.shell_stream,
            "kernel_info_reply",
            content,
            parent_header=message["header"],
            identities=identities,
        )


if __name__ == "__main__":
    setup(
        shell_type="jupyter",
        env={"PAGER": "cat"},
        aliases={"less": "cat"},
        xontribs=["coreutils"],
        threadable_predictors={
            "git": predict_true,
            "man": predict_true
        },
    )
    if XSH.commands_cache.is_only_functional_alias("cat"):  # type:ignore
        # this is needed if the underlying system doesn't have cat
        # we supply our own, because we can
        XSH.aliases["cat"] = "xonsh-cat"  # type:ignore
        XSH.env["PAGER"] = "xonsh-cat"  # type:ignore
    shell = XSH.shell  # type:ignore
    kernel = shell.kernel = XonshKernel()
    kernel.start()
Ejemplo n.º 11
0
import inspect
import importlib
import typing as tp

os.environ["XONSH_DEBUG"] = "1"
os.environ["XONSH_NO_AMALGAMATE"] = "1"

from xonsh import __version__ as XONSH_VERSION
from xonsh.environ import Env, Var, Xettings

if tp.TYPE_CHECKING:
    from xonsh.environ import VarKeyType
import xonsh.main as xmain

xmain.setup()

spec = importlib.util.find_spec("prompt_toolkit")
if spec is not None:
    # hacky runaround to import PTK-specific events
    from xonsh.ptk_shell.shell import events
else:
    from xonsh.events import events

sys.path.insert(0, os.path.dirname(__file__))


# -- General configuration -----------------------------------------------------

# Documentation is being built on readthedocs, this will be true.
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
Ejemplo n.º 12
0
def setup(sphinx):
    from xonsh.main import setup
    setup()
    from xonsh.pyghooks import XonshConsoleLexer
    sphinx.add_lexer("xonshcon", XonshConsoleLexer())
Ejemplo n.º 13
0
def pytest_configure(config):
    setup()
Ejemplo n.º 14
0
        > dev --add
    """

    if ls or (name is None):
        _list_cmds()
    elif add:
        _add_current_path()
    else:
        added_paths = get_added_paths()
        if name in ENVS:
            ENVS[name]()
        elif name in added_paths:
            path = added_paths[name]
            if os.path.exists(path):
                return _start_proj_shell(Path(path))
            else:
                # old/expired link
                added_paths.pop(name)
                update_saved_paths(tuple(added_paths.values()))

        return _start_proj_shell(name)


if __name__ == "__main__":
    from xonsh.main import setup

    setup(env=[
        ("PROJECT_PATHS", ["~/src"]),
    ])
    print(list(_find_proj_path("", str.startswith)))