Add Python (pip), Void (xbps), and Fedora (dnf) support to package counts. #37
Conversation
src/main.rs
Outdated
fn get_package_count_fedora() -> Result<String> { | ||
let dnf = Command::new("dnf").arg("list").arg("--installed").output().context(Pkgcount)?; | ||
let pkgs = bytecount::count(&dnf.stdout, b'\n'); | ||
let pkgs = pkgs as u32 - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to cast to u32
src/main.rs
Outdated
fn get_package_count_pip() -> Result<String> { | ||
let pip = Command::new("pip").arg("list").output().context(Pkgcount)?; | ||
let pkgs = bytecount::count(&pip.stdout, b'\n'); | ||
let pkgs = pkgs as u32 - 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to do it without them and cargo threw errors at me about how it's unable to do binary operations on strings. So I made them u32 and it worked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous value is an usize
as returned by bytecount::count
, so it should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really weird. I swear I tried that before and it didn't work. But it's working now, so I'll edit and commit again.
No description provided.