Skip to content
Snippets Groups Projects
Commit e3e56f76 authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

Merge branch 'improve-userfeedback-init' into 'main'

Improve error if current directory (or parents) are not MPSD software instance

See merge request !104
parents 277bdca8 1ea3916f
No related branches found
No related tags found
1 merge request!104Improve error if current directory (or parents) are not MPSD software instance
Pipeline #375474 passed
......@@ -649,7 +649,7 @@ def clone_repo(
)
if checkout_result.returncode != 0:
msg = f"Couldn't find {branch=}\n"
msg = f"Couldnt find {branch=}\n"
branches_result = run(
["git", "branch", "-a"], check=True, capture_output=True
......@@ -1153,16 +1153,17 @@ def get_root_dir() -> Path:
return script_call_dir
# if not found in any parent directory, exit with an error message
logging.getLogger("print").info(
"Error: Couldnt find MPSD software instance"
"in the current directory or any parent directory. \n"
f"Directory {str(script_call_dir)} is not a MPSD software instance. \n"
"Please run 'mpsd-software init' to "
"initialise the software instance here, \n"
"or switch to a directory which is already initialised.\n \n"
f"Hint: Look for the directory containing `{config_vars['cmd_log_file']}`"
+ f"and the hidden file `{config_vars['init_file']}`."
" to check if a directory is initialised"
logging.debug(f"Directory {str(script_call_dir)} is not a MPSD software instance.")
logging.error(
"Could not find MPSD software instance "
"in the current directory or any parent directory.\n\n"
f"The current directory is {script_call_dir}.\n\n"
"To initialise a MPSD software instance here, "
"run 'mpsd-software init'.\n\n"
f"To find the root directory of an existing MPSD software instance, look "
f"for the directory containing '{config_vars['cmd_log_file']}' "
+ f"and the hidden file '{config_vars['init_file']}'."
)
sys.exit(40)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment