Compare commits

..

12 Commits

Author SHA1 Message Date
Amber
48d79e43f2 update cargo.lock 2020-08-27 15:31:52 +00:00
Amber
322f0e57cf update ver to 0.1.3 2020-08-27 15:26:37 +00:00
Amber
71237e1b0b add links to shields 2020-08-27 11:16:28 -04:00
Amber
c6a2b39b3e add shields 2020-08-27 11:13:47 -04:00
Amber
45f51c9a30 add image to README 2020-08-27 10:50:58 -04:00
Amber
1b18746b71 add output png 2020-08-27 10:48:51 -04:00
Amber
5f6c8fd33b comments 2020-08-27 13:56:56 +00:00
Amber
a4cddfe68d update cargo lock 2020-08-27 13:44:49 +00:00
repl.it user
b3366ff19e Merge remote-tracking branch 'origin/master' 2020-08-27 13:43:11 +00:00
Amber
e60e50a7d4 update toml to 0.1.2 2020-08-27 13:43:10 +00:00
Amber
ee60ec98ce remove workflow 2020-08-27 09:41:38 -04:00
Amber
acb296968c add cargo login 2020-08-26 15:12:26 -04:00
6 changed files with 13 additions and 32 deletions

View File

@@ -1,22 +0,0 @@
name: Rust
on:
release:
types: [ published ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: publish
run: cargo publish --verbose

2
Cargo.lock generated
View File

@@ -156,7 +156,7 @@ checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
[[package]]
name = "psysinfo"
version = "0.1.1"
version = "0.1.3"
dependencies = [
"colored",
"sysinfo",

View File

@@ -1,6 +1,6 @@
[package]
name = "psysinfo"
version = "0.1.1"
version = "0.1.3"
authors = ["amberisvibin"]
edition = "2018"
license = "GPL-3.0-or-later"

View File

@@ -1,4 +1,7 @@
# psysinfo
psysinfo [![Crates.io](https://img.shields.io/crates/v/psysinfo)](https://crates.io/crates/psysinfo) [![Crates.io](https://img.shields.io/crates/l/psysinfo)](https://github.com/amberisvibin/psysinfo/blob/master/LICENSE)
=====
psysinfo is a simple CLI utility that prints the sysinfo crate's (static) info, written in Rust.
Available on crates.io [here](https://crates.io/crates/psysinfo).
![](https://github.com/amberisvibin/psysinfo/blob/master/psysinfo-output.png)

14
main.rs
View File

@@ -1,34 +1,34 @@
use std::str;
use colored::*;
use colored::*; //allow .bright_blue()
fn main() {
println!("{}", "System info:".bright_blue());
use sysinfo::{System, SystemExt, DiskExt, ProcessorExt};
use sysinfo::{System, SystemExt, DiskExt, ProcessorExt}; //import sys, disk, processor data
let sys = System::new_all();
println!("{}", " disks:".bright_blue());
println!(" {:32} {:32} {:8} {:8} {:8}",
println!(" {:32} {:32} {:8} {:8} {:8}", //heading
"mount:".bright_blue(),
"name:".bright_blue(),
"fs:".bright_blue(),
"size:".bright_blue(),
"free:".bright_blue());
for disk in sys.get_disks() {
for disk in sys.get_disks() { //print for all disks
println!(" {:32} {:32} {:8} {:8} MB {:8} MB",
disk.get_mount_point().display(),
format!("{}", disk.get_name().to_str().unwrap()),
format!("{}", str::from_utf8(disk.get_file_system()).unwrap()),
format!("{}", disk.get_total_space() / 1000000),
format!("{}", disk.get_total_space() / 1000000), //space is stored in bytes, convert to MB
format!("{}", disk.get_available_space() / 1000000));
}
println!("{}", " memory:".bright_blue());
println!(" {:8} {:<8} MB",
"total:".bright_blue(),
sys.get_total_memory() / 1000);
sys.get_total_memory() / 1000); //space is stored in KB, convert to MB
println!(" {:8} {:<8} MB",
"used:".bright_blue(),
sys.get_used_memory() / 1000);
@@ -36,7 +36,7 @@ fn main() {
println!("{}", " processor:".bright_blue());
println!(" {:8} {:64}",
"brand:".bright_blue(),
sys.get_processors()[0].get_brand());
sys.get_processors()[0].get_brand()); //get_global_processor_info() has bug, so get from first core
println!(" {:8} {:<4}",
"cores:".bright_blue(),
sys.get_processors().len());

BIN
psysinfo-output.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB