Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Add Python (pip), Void (xbps), and Fedora (dnf) support to package counts. #37

Merged
merged 6 commits into from May 15, 2019

Conversation

Phate6660
Copy link
Member

No description provided.

@Phate6660 Phate6660 changed the title Add pip support to package counts. Add Python (pip) and Void (xbps) support to package counts. May 15, 2019
@Phate6660 Phate6660 changed the title Add Python (pip) and Void (xbps) support to package counts. Add Python (pip), Void (xbps), and Fedora (dnf) support to package counts. May 15, 2019
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;
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

@Phate6660 Phate6660 merged commit a70f0cc into master May 15, 2019
@Phate6660 Phate6660 deleted the pip branch May 15, 2019 07:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants