Skip to content

Commit

Permalink
Show files in single-file mode
Browse files Browse the repository at this point in the history
Since it may be useful for scripting purposes, show file list, even for
single-file torrents.

type: changed
  • Loading branch information
casey committed Apr 8, 2020
1 parent 43d87c0 commit f7e9e80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/opt/torrent/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Content Size 20 bytes
Piece Size 16 KiB
Piece Count 1
File Count 1
Files foo
";

assert_eq!(have, want);
Expand Down Expand Up @@ -115,6 +116,7 @@ Trackers\tannounce\tb\tc
Piece Size\t16384
Piece Count\t1
File Count\t1
Files\tfoo
";

assert_eq!(have, want);
Expand Down
5 changes: 4 additions & 1 deletion src/torrent_summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f7e9e80

Please sign in to comment.