(line: str)
Take the command line received from shell completion, and strip the app name from it
        which could be at the form of python script.py or some_app.
        it also corrects the key (COMP_INDEX) to reflect the same location in the striped command line.
        :param line: input line, may contain python file.py followed=by_args..
        :return: tuple(args line, key of cursor in args line)
Take the command line received from shell completion, and strip the app name from it
        which could be at the form of python script.py or some_app.
        it also corrects the key (COMP_INDEX) to reflect the same location in the striped command line.
        :param line: input line, may contain python file.py followed=by_args..
        :return: tuple(args line, key of cursor in args line)
Take the command line received from shell completion and strip the app name from it which could be at the form of python script . py or some_app . it also corrects the key ( COMP_INDEX ) to reflect the same location in the striped command line . : param line : input line may contain python file . py followed = by_args .. : return : tuple ( args line key of cursor in args line )
def strip_python_or_app_name(line: str) -> str:
        """
        Take the command line received from shell completion, and strip the app name from it
        which could be at the form of python script.py or some_app.
        it also corrects the key (COMP_INDEX) to reflect the same location in the striped command line.
        :param line: input line, may contain python file.py followed=by_args..
        :return: tuple(args line, key of cursor in args line)
        """
        python_args = r"^\s*[\w\/]*python[3]?\s*[\w/\.]*\s*(.*)"
        app_args = r"^\s*[\w_\-=\./]+\s*(.*)"
        match = re.match(python_args, line)
        if match:
            return match.group(1)
        else:
            match = re.match(app_args, line)
            if match:
                return match.group(1)
            else:
                raise RuntimeError(f"Error parsing line '{line}'")
def strip_python_or_app_name ( line : str ) -> str : python_args = r"^\s*[\w\/]*python[3]?\s*[\w/\.]*\s*(.*)" app_args = r"^\s*[\w_\-=\./]+\s*(.*)" match = re . match ( python_args , line ) if match : return match . group ( 1 ) else : match = re . match ( app_args , line ) if match : return match . group ( 1 ) else : raise RuntimeError ( f"Error parsing line '{line}'" )