Show files in single-file mode

Since it may be useful for scripting purposes, show file list, even for
single-file torrents.

type: changed
This commit is contained in:
Casey Rodarmor 2020-02-06 00:12:07 -08:00
parent 43d87c06b6
commit f7e9e80f97
No known key found for this signature in database
GPG Key ID: 556186B153EC6FE0
3 changed files with 10 additions and 1 deletions

View File

@ -11,6 +11,10 @@ stats PATH:
cargo build --release
time ./target/release/imdl --unstable torrent stats --input {{PATH}}
push: check
! git branch | grep '* master'
git push github
# clean up feature branch BRANCH
done BRANCH:
git checkout master

View File

@ -84,6 +84,7 @@ Content Size 20 bytes
Piece Size 16 KiB
Piece Count 1
File Count 1
Files foo
";
assert_eq!(have, want);
@ -115,6 +116,7 @@ Trackers\tannounce\tb\tc
Piece Size\t16384
Piece Count\t1
File Count\t1
Files\tfoo
";
assert_eq!(have, want);

View File

@ -130,7 +130,10 @@ impl TorrentSummary {
table.row("Piece Count", self.metainfo.info.pieces.len() / 20);
match &self.metainfo.info.mode {
Mode::Single { .. } => table.row("File Count", 1),
Mode::Single { .. } => {
table.row("File Count", 1);
table.row("Files", &self.metainfo.info.name);
}
Mode::Multiple { files } => {
table.row("File Count", files.len());
table.directory(