mirror of
https://codeberg.org/postscriptum/snac2nex.git
synced 2026-03-31 21:25:28 +00:00
rename filesystem-sync option to filesystem-sync-time
This commit is contained in:
parent
fabc11f9cb
commit
fd102a9715
3 changed files with 8 additions and 8 deletions
|
|
@ -64,8 +64,8 @@ snac2nex -s /path/to/snac/storage -t /path/to/nex -u user1 -u user2
|
||||||
|
|
||||||
[default: "%Y/%m/%d %H:%M:%S"]
|
[default: "%Y/%m/%d %H:%M:%S"]
|
||||||
|
|
||||||
--filesystem-sync
|
--filesystem-sync-time
|
||||||
Sync filesystem meta (e.g. time modified)
|
Sync file meta with Snac entry time (e.g. time modified)
|
||||||
|
|
||||||
--filesystem-file-permissions <FILESYSTEM_FILE_PERMISSIONS>
|
--filesystem-file-permissions <FILESYSTEM_FILE_PERMISSIONS>
|
||||||
Set new file permissions (macos, linux only)
|
Set new file permissions (macos, linux only)
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,9 @@ pub struct Config {
|
||||||
#[arg(long, default_value_t = String::from("%Y/%m/%d %H:%M:%S"))]
|
#[arg(long, default_value_t = String::from("%Y/%m/%d %H:%M:%S"))]
|
||||||
pub format_updated: String,
|
pub format_updated: String,
|
||||||
|
|
||||||
/// Sync filesystem meta (e.g. time modified)
|
/// Sync file meta with Snac entry time (e.g. time modified)
|
||||||
#[arg(long, default_value_t = false)]
|
#[arg(long, default_value_t = false)]
|
||||||
pub filesystem_sync: bool,
|
pub filesystem_sync_time: bool,
|
||||||
|
|
||||||
/// Set new file permissions (macos, linux only)
|
/// Set new file permissions (macos, linux only)
|
||||||
#[arg(long, value_parser = permissions)]
|
#[arg(long, value_parser = permissions)]
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ pub struct Nex {
|
||||||
filename: String,
|
filename: String,
|
||||||
is_cleanup: bool,
|
is_cleanup: bool,
|
||||||
is_debug: bool,
|
is_debug: bool,
|
||||||
is_filesystem_sync: bool,
|
is_filesystem_sync_time: bool,
|
||||||
template: Template,
|
template: Template,
|
||||||
users: HashMap<String, PathBuf>,
|
users: HashMap<String, PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +71,7 @@ impl Nex {
|
||||||
filename: config.format_filename.clone(),
|
filename: config.format_filename.clone(),
|
||||||
is_cleanup: !config.keep,
|
is_cleanup: !config.keep,
|
||||||
is_debug: !config.daemon,
|
is_debug: !config.daemon,
|
||||||
is_filesystem_sync: config.filesystem_sync,
|
is_filesystem_sync_time: config.filesystem_sync_time,
|
||||||
template,
|
template,
|
||||||
users,
|
users,
|
||||||
})
|
})
|
||||||
|
|
@ -189,7 +189,7 @@ impl Nex {
|
||||||
.sync(
|
.sync(
|
||||||
&from,
|
&from,
|
||||||
&to,
|
&to,
|
||||||
if self.is_filesystem_sync {
|
if self.is_filesystem_sync_time {
|
||||||
Some(timestamp.into())
|
Some(timestamp.into())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
@ -290,7 +290,7 @@ impl Nex {
|
||||||
};
|
};
|
||||||
let mut f = fs::File::create(path)?;
|
let mut f = fs::File::create(path)?;
|
||||||
f.write_all(data)?;
|
f.write_all(data)?;
|
||||||
if self.is_filesystem_sync {
|
if self.is_filesystem_sync_time {
|
||||||
f.set_modified((*modified).into())?; // it's important to call after write
|
f.set_modified((*modified).into())?; // it's important to call after write
|
||||||
}
|
}
|
||||||
if let Some(ref p) = self.file_permissions {
|
if let Some(ref p) = self.file_permissions {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue