diff --git a/gamestonk_terminal/helper_funcs.py b/gamestonk_terminal/helper_funcs.py index 7c675f4234d..1bab88fe16c 100644 --- a/gamestonk_terminal/helper_funcs.py +++ b/gamestonk_terminal/helper_funcs.py @@ -89,10 +89,14 @@ def check_path(path: str) -> str: str: Ratio of similarity between two strings """ + # Just return empty path because this will be handled outside this function + if not path: + return "" + # Return string of path if such path exists if os.path.isfile(path): return path - logger.error("Expected list of one axis item.") - console.print("The path file provided does not exist.\n[/red]") + logger.error("The path file '%s' does not exist.", path) + console.print(f"[red]The path file '{path}' does not exist.\n[/red]") return "" diff --git a/terminal.py b/terminal.py index f8c0599b17c..2c818ad02dd 100644 --- a/terminal.py +++ b/terminal.py @@ -304,6 +304,13 @@ class TerminalController(BaseController): """Process exe command""" # Merge rest of string path to other_args and remove queue since it is a dir other_args += self.queue + + if not other_args: + console.print( + "[red]Provide a path to the routine you wish to execute.\n[/red]" + ) + return + full_input = " ".join(other_args) if " " in full_input: other_args_processed = full_input.split(" ") @@ -317,7 +324,8 @@ class TerminalController(BaseController): if path_dir in ("-i", "--input"): args = [path_routine[1:]] + other_args_processed[idx:] break - path_routine += f"/{path_dir}" + if path_dir not in ("-p", "--path"): + path_routine += f"/{path_dir}" if not args: args = [path_routine[1:]] @@ -335,6 +343,7 @@ class TerminalController(BaseController): dest="path", default="", type=check_path, + required="-h" not in args, ) parser_exe.add_argument( "-i",