-
Notifications
You must be signed in to change notification settings - Fork 1
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
WIP: Multiple backup directories #1
base: main
Are you sure you want to change the base?
Conversation
|
||
// The directory that holds the original source files | ||
#[arg(short, long)] | ||
source_dir: PathBuf, |
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.
what are your thoughts on making this optional, and using the first backup_dir if it isn't provided?
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.
agreed. I tried that initially. If that's possible then yes I agree. I can't do source_dir = backup_dir.clone()
or whatever I tried so I wasn't sure how to get around that one. I'll give it a shot and if it doesn't work then I'd like for you to show me how to do it.
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.
I'd do something like making source_dir: Option<PathBuf>
, and then doing something later in the code like let source_dir = source_dir.unwrap_or(backup_dir.first().unwrap())
@@ -27,18 +27,23 @@ struct Args { | |||
#[arg(short, long)] | |||
work_dir: PathBuf, | |||
|
|||
/// The directory that will be copied to. Used to initialize source dir | |||
/// The directory that will be copied to | |||
#[arg(short, long)] | |||
backup_dir: PathBuf, |
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.
Why not rename this to bakcup_dirs, and make it a Vec?
Support multiple backup directories
example:
The reason a
--source-dir
flag is required is we need to know the original source of truth. If we used--backup-dir
with multiple directories (like the above example) then we'd have to choose from the list ofbackup-dir