Exemplo n.º 1
0
Arquivo: sh.py Projeto: m-col/qtile
    def do_cd(self, arg: str | None) -> str:
        """Change to another path.

        Examples
        ========

            cd layout/0

            cd ../layout
        """
        if arg is None:
            self._command_client = self._command_client.root
            return "/"

        next_node, rest_path = self._find_path(arg)
        if next_node is None:
            return "No such path."

        if rest_path is None:
            self._command_client = next_node
        else:
            allow_root, _ = next_node.items(rest_path)
            if not allow_root:
                return "Item required for {}".format(rest_path)
            self._command_client = next_node.navigate(rest_path, None)

        return format_selectors(self._command_client.selectors) or "/"
Exemplo n.º 2
0
Arquivo: sh.py Projeto: m-col/qtile
    def do_pwd(self, arg) -> str:
        """Returns the current working location

        This is the same information as presented in the qshell prompt, but is
        very useful when running iqshell.

        Examples
        ========

            > pwd
            /
            > cd bar/top
            bar['top']> pwd
            bar['top']
        """
        return format_selectors(self._command_client.selectors) or "/"
Exemplo n.º 3
0
    def do_cd(self, arg) -> str:
        """Change to another path.

        Examples
        ========

            cd layout/0

            cd ../layout
        """
        next_node = self._find_path(arg)
        if next_node is not None:
            self._current_node = next_node
            return format_selectors(self._current_node.selectors) or '/'
        else:
            return "No such path."
Exemplo n.º 4
0
Arquivo: sh.py Projeto: m-col/qtile
 def prompt(self) -> str:
     return "{} > ".format(format_selectors(self._command_client.selectors))
Exemplo n.º 5
0
 def prompt(self) -> str:
     return "{} > ".format(format_selectors(self._current_node.selectors))