Added reporting for configuration used when executing `getmyancestors.py`.
authorchangeling <cklarson@gmail.com>
Tue, 29 Jan 2019 06:40:49 +0000 (00:40 -0600)
committerchangeling <cklarson@gmail.com>
Tue, 5 Feb 2019 02:36:28 +0000 (20:36 -0600)
Added reporting for configuration used when executing `getmyancestors.py`.
Added `.vscode/` and `scratchpad.py` to .gitignore.

.gitignore
getmyancestors.py

index 282a1530f06e48005924fbdeac541af28df406ef..d4ab07c65b9b051a02f90f468a2b98c9fc08a7e5 100644 (file)
@@ -1,3 +1,5 @@
 *.pyc
 *.ged
-*.log
\ No newline at end of file
+*.log
+.vscode/
+scratchpad.py
index 6c94bfd81913d5ef01f6eae5904d78e44cf4b3fc..1f4840f75843e466009f1c490ad5f8d7ae232f1b 100755 (executable)
@@ -921,6 +921,27 @@ if __name__ == '__main__':
 
     time_count = time.time()
 
+    # Report settings used when getmyancestors.py is executed.
+    redact_password = True
+    setting_list = [string for setting in [[
+            str('-' + action.dest + ' ' + action.help),
+            '******' if action.dest == 'p' and redact_password 
+                else str(vars(args)[action.dest].name) if hasattr(vars(args)[action.dest], 'name')
+                else str(vars(args)[action.dest])]
+            for action in vars(parser)['_actions']] for string in setting]
+    setting_list.insert(0,time.strftime('%X %x %Z'))
+    setting_list.insert(0,'time stamp: ')
+
+    formatting = '{:74}{:\t>1}\n' * int(len(setting_list) / 2)
+    settings_output = ((
+                formatting
+                ).format(
+                    *setting_list))
+    print(settings_output)
+
+    with open(args.o.name.split('.')[0] + '.settings', 'w') as settings_record:
+        settings_record.write(settings_output)
+
     # initialize a FamilySearch session and a family tree object
     print('Login to FamilySearch...')
     fs = Session(username, password, args.v, args.l, args.t)