@@ -77,13 +77,9 @@ def _sorted_merge(*dicts):
77
77
78
78
def _create_global_config (args ):
79
79
username = input (
80
- f"Please enter the name of the user to put in the diffpy global config file "
81
- f"[{ args .get ('username' , '' )} ]: "
80
+ f"Please enter the name you would want future work to be credited to " f"[{ args .get ('username' , '' )} ]: "
82
81
).strip () or args .get ("username" , "" )
83
- email = input (
84
- f"Please enter the email of the user to put in the diffpy global config file "
85
- f"[{ args .get ('email' , '' )} ]: "
86
- ).strip () or args .get ("email" , "" )
82
+ email = input (f"Please enter the your email " f"[{ args .get ('email' , '' )} ]: " ).strip () or args .get ("email" , "" )
87
83
return_bool = False if username is None or email is None else True
88
84
with open (Path ().home () / "diffpyconfig.json" , "w" ) as f :
89
85
f .write (json .dumps ({"username" : stringify (username ), "email" : stringify (email )}))
@@ -114,6 +110,15 @@ def get_user_info(args=None):
114
110
global_config = load_config (Path ().home () / "diffpyconfig.json" )
115
111
local_config = load_config (Path ().cwd () / "diffpyconfig.json" )
116
112
if global_config is None and local_config is None :
113
+ print (
114
+ "No global configuration file was found containing "
115
+ "information about the user to associate with the data.\n "
116
+ "By following the prompts below you can add your name and email to this file on the current"
117
+ " computer and your name will be automatically associated with subsequent diffpy data by default.\n "
118
+ "This is not recommended on a shared or public computer. "
119
+ "You will only have to do that once.\n "
120
+ "For more information, please refer to www.diffpy.org/diffpy.utils/examples/toolsexample.html"
121
+ )
117
122
config_bool = _create_global_config (args )
118
123
global_config = load_config (Path ().home () / "diffpyconfig.json" )
119
124
config = _sorted_merge (clean_dict (global_config ), clean_dict (local_config ), clean_dict (args ))
0 commit comments