Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit 7e93ee9

Browse files
committed
Add support for displaying enabled features
Uses the {f} format specifier.
1 parent d98dde2 commit 7e93ee9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/format/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum Chunk {
1010
Package,
1111
License,
1212
Repository,
13+
Feature,
1314
}
1415

1516
pub struct Pattern(Vec<Chunk>);
@@ -24,6 +25,7 @@ impl Pattern {
2425
RawChunk::Argument("p") => Chunk::Package,
2526
RawChunk::Argument("l") => Chunk::License,
2627
RawChunk::Argument("r") => Chunk::Repository,
28+
RawChunk::Argument("f") => Chunk::Feature,
2729
RawChunk::Argument(ref a) => {
2830
return Err(anyhow!("unsupported pattern `{}`", a));
2931
}
@@ -77,6 +79,11 @@ impl<'a> fmt::Display for Display<'a> {
7779
write!(fmt, "{}", repository)?
7880
}
7981
}
82+
Chunk::Feature => {
83+
let mut features : Vec<_> = self.package.features.keys().cloned().collect();
84+
features.sort();
85+
write!(fmt, "{}", features.join(","))?
86+
}
8087
}
8188
}
8289

0 commit comments

Comments
 (0)