mirror of https://github.com/dswd/zvault
Fixed reading tar files from stdin
This commit is contained in:
parent
1cd58e180d
commit
30bc7d80c5
|
@ -6,6 +6,7 @@ This project follows [semantic versioning](http://semver.org).
|
||||||
### UNRELEASED
|
### UNRELEASED
|
||||||
* [modifed] Changed order of arguments in `addkey` to match src-dst scheme
|
* [modifed] Changed order of arguments in `addkey` to match src-dst scheme
|
||||||
* [fixed] Fixed `addkey` subcommand
|
* [fixed] Fixed `addkey` subcommand
|
||||||
|
* [fixed] Fixed reading tar files from stdin
|
||||||
|
|
||||||
|
|
||||||
### v0.3.1 (2017-05-09)
|
### v0.3.1 (2017-05-09)
|
||||||
|
|
|
@ -279,6 +279,15 @@ fn validate_existing_path(val: String) -> Result<(), String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unknown_lints,needless_pass_by_value)]
|
||||||
|
fn validate_existing_path_or_stdio(val: String) -> Result<(), String> {
|
||||||
|
if val != "-" && !Path::new(&val).exists() {
|
||||||
|
Err("Path does not exist".to_string())
|
||||||
|
} else {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[allow(unknown_lints,cyclomatic_complexity)]
|
#[allow(unknown_lints,cyclomatic_complexity)]
|
||||||
pub fn parse() -> Result<(LogLevel, Arguments), ErrorCode> {
|
pub fn parse() -> Result<(LogLevel, Arguments), ErrorCode> {
|
||||||
|
@ -312,7 +321,7 @@ pub fn parse() -> Result<(LogLevel, Arguments), ErrorCode> {
|
||||||
.arg(Arg::from_usage("--tar 'Read the source data from a tar file'")
|
.arg(Arg::from_usage("--tar 'Read the source data from a tar file'")
|
||||||
.conflicts_with_all(&["reference", "exclude", "excludes_from"]))
|
.conflicts_with_all(&["reference", "exclude", "excludes_from"]))
|
||||||
.arg(Arg::from_usage("<SRC> 'Source path to backup'")
|
.arg(Arg::from_usage("<SRC> 'Source path to backup'")
|
||||||
.validator(validate_existing_path))
|
.validator(validate_existing_path_or_stdio))
|
||||||
.arg(Arg::from_usage("<BACKUP> 'Backup path, [repository]::backup'")
|
.arg(Arg::from_usage("<BACKUP> 'Backup path, [repository]::backup'")
|
||||||
.validator(|val| validate_repo_path(val, true, Some(true), Some(false)))))
|
.validator(|val| validate_repo_path(val, true, Some(true), Some(false)))))
|
||||||
.subcommand(SubCommand::with_name("restore").about("Restore a backup or subtree")
|
.subcommand(SubCommand::with_name("restore").about("Restore a backup or subtree")
|
||||||
|
|
|
@ -313,6 +313,10 @@ pub fn run() -> Result<(), ErrorCode> {
|
||||||
error!("A backup with that name already exists");
|
error!("A backup with that name already exists");
|
||||||
return Err(ErrorCode::BackupAlreadyExists)
|
return Err(ErrorCode::BackupAlreadyExists)
|
||||||
}
|
}
|
||||||
|
if src_path == "-" && !tar {
|
||||||
|
error!("Reading from stdin requires --tar");
|
||||||
|
return Err(ErrorCode::InvalidArgs)
|
||||||
|
}
|
||||||
let mut reference_backup = None;
|
let mut reference_backup = None;
|
||||||
if !full && !tar {
|
if !full && !tar {
|
||||||
reference_backup = match reference {
|
reference_backup = match reference {
|
||||||
|
|
Loading…
Reference in New Issue