diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-01-05 14:08:48 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-01-05 14:08:48 +0000 |
commit | 7ff248232a414b907b3abe464cc015e5ea48c236 (patch) | |
tree | f2db3d57cbd6db1e68779907f1477dca315220c5 /src/cmd/list_files.rs | |
parent | fee70c974049560164d8950dabc63554f55671b1 (diff) | |
parent | c2f7b5af1b9a237c740c71b3b65a155a8440cf3a (diff) | |
download | obnam2-7ff248232a414b907b3abe464cc015e5ea48c236.tar.gz |
Merge branch 'iterattor' into 'main'
refactor: add BackedUpFile to avoid using a tuple
See merge request larswirzenius/obnam!63
Diffstat (limited to 'src/cmd/list_files.rs')
-rw-r--r-- | src/cmd/list_files.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/list_files.rs b/src/cmd/list_files.rs index aa4bed0..a69c3df 100644 --- a/src/cmd/list_files.rs +++ b/src/cmd/list_files.rs @@ -1,3 +1,4 @@ +use crate::backup_reason::Reason; use crate::client::BackupClient; use crate::client::ClientConfig; use crate::error::ObnamError; @@ -22,8 +23,8 @@ pub fn list_files(config: &ClientConfig, gen_ref: &str) -> anyhow::Result<()> { }; let gen = client.fetch_generation(&gen_id, &dbname)?; - for (_, entry, reason) in gen.files()? { - println!("{}", format_entry(&entry, &reason)); + for file in gen.files()? { + println!("{}", format_entry(&file.entry(), file.reason())); } // Delete the temporary file. @@ -32,7 +33,7 @@ pub fn list_files(config: &ClientConfig, gen_ref: &str) -> anyhow::Result<()> { Ok(()) } -fn format_entry(e: &FilesystemEntry, reason: &str) -> String { +fn format_entry(e: &FilesystemEntry, reason: Reason) -> String { let kind = match e.kind() { FilesystemKind::Regular => "-", FilesystemKind::Directory => "d", |