-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iss66 - Improvements to export handling #72
Conversation
Keeps users HOME dir a little tidier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log_file = os.path.join(HOME, ".konsave_log.txt")
Why did you include this in this PR? The change to save log files to .cache
was already merged from another PR.
Argh, yes, thats my bad. I've just checked my branches and I've inadvertently branched from a folk that already had fixes in. Now that the .cache fix is merged, there should be no conflict with those commits into the main branch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I'm merging it then :)
This PR adds functionality for exporting profiles and adds some protection against overwriting data.
You can pass -n/--export-name to set the name of the exported archive. If this is not set, it is defaulted to the profile name as per the original functionality.
You can pass -d/--export-directory to set the directory of an exported profile. If this is not set, it is now set to the current working directory instead of the users home directory.
You can pass -f/--force alongside -e/--export to force the overwriting of data as per the original functionality. Although this is dangerous, it is important for my workflows to keep the functionality. I use this as part of an ansible provisioner for new workstations, and I rely on a fixed archive name being kept up to date with changes. I could rework my provisioner code to take backups before restoring from konsave so if you wanted to remove the ability to overwrite data completely, it is understandable. I think its important that this function is "hidden" behind the -f option and not default functionality.
I've changed code that creates a unique export_path to use date time rather than a random string. Helps keep the archives sorted in order, alphanumerically.
I've removed .capitalize() from the log function as it was causing the output logging to present an incorrect name. I have spot checked the other functions that reference the log function and can't see why this would have a knock on effect.