diff --git a/news/capture-user.rst b/news/capture-user.rst new file mode 100644 index 00000000..b789d46e --- /dev/null +++ b/news/capture-user.rst @@ -0,0 +1,23 @@ +**Added:** + +* Better wording on the capture user info functionality + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/src/diffpy/utils/tools.py b/src/diffpy/utils/tools.py index 1dfb8284..82cca8c9 100644 --- a/src/diffpy/utils/tools.py +++ b/src/diffpy/utils/tools.py @@ -77,13 +77,9 @@ def _sorted_merge(*dicts): def _create_global_config(args): username = input( - f"Please enter the name of the user to put in the diffpy global config file " - f"[{args.get('username', '')}]: " + f"Please enter the name you would want future work to be credited to " f"[{args.get('username', '')}]: " ).strip() or args.get("username", "") - email = input( - f"Please enter the email of the user to put in the diffpy global config file " - f"[{args.get('email', '')}]: " - ).strip() or args.get("email", "") + email = input(f"Please enter the your email " f"[{args.get('email', '')}]: ").strip() or args.get("email", "") return_bool = False if username is None or email is None else True with open(Path().home() / "diffpyconfig.json", "w") as f: f.write(json.dumps({"username": stringify(username), "email": stringify(email)})) @@ -114,6 +110,15 @@ def get_user_info(args=None): global_config = load_config(Path().home() / "diffpyconfig.json") local_config = load_config(Path().cwd() / "diffpyconfig.json") if global_config is None and local_config is None: + print( + "No global configuration file was found containing " + "information about the user to associate with the data.\n" + "By following the prompts below you can add your name and email to this file on the current" + " computer and your name will be automatically associated with subsequent diffpy data by default.\n" + "This is not recommended on a shared or public computer. " + "You will only have to do that once.\n" + "For more information, please refer to www.diffpy.org/diffpy.utils/examples/toolsexample.html" + ) config_bool = _create_global_config(args) global_config = load_config(Path().home() / "diffpyconfig.json") config = _sorted_merge(clean_dict(global_config), clean_dict(local_config), clean_dict(args))