Compare commits

...

No commits in common. "v1.0.0" and "main" have entirely different histories.
v1.0.0 ... main

9 changed files with 330 additions and 213 deletions

290
Cargo.lock generated
View file

@ -2,6 +2,55 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "anstream"
version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
[[package]]
name = "anstyle-parse"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@ -10,15 +59,16 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
version = "3.15.4"
version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "bunbun"
version = "0.2.0"
version = "1.3.0"
dependencies = [
"colored",
"clap",
"owo-colors",
"sysinfo",
"whoami",
]
@ -30,15 +80,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "colored"
version = "2.1.0"
name = "clap"
version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7"
dependencies = [
"lazy_static",
"windows-sys",
"clap_builder",
"clap_derive",
]
[[package]]
name = "clap_builder"
version = "4.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_derive"
version = "4.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
[[package]]
name = "colorchoice"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
[[package]]
name = "core-foundation-sys"
version = "0.8.6"
@ -66,15 +152,27 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
version = "0.8.19"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]]
name = "either"
version = "1.10.0"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
[[package]]
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "is_terminal_polyfill"
version = "1.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
[[package]]
name = "js-sys"
@ -85,17 +183,11 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.153"
version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "log"
@ -119,28 +211,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "proc-macro2"
version = "1.0.79"
name = "owo-colors"
version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f"
[[package]]
name = "proc-macro2"
version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.35"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rayon"
version = "1.9.0"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd"
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [
"either",
"rayon-core",
@ -166,10 +264,16 @@ dependencies = [
]
[[package]]
name = "syn"
version = "2.0.53"
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "2.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
dependencies = [
"proc-macro2",
"quote",
@ -178,9 +282,9 @@ dependencies = [
[[package]]
name = "sysinfo"
version = "0.30.7"
version = "0.30.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c385888ef380a852a16209afc8cfad22795dd8873d69c9a14d2e2088f118d18"
checksum = "732ffa00f53e6b2af46208fba5718d9662a421049204e156328b66791ffa15ae"
dependencies = [
"cfg-if",
"core-foundation-sys",
@ -197,6 +301,12 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "utf8parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "wasite"
version = "0.1.0"
@ -307,7 +417,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core",
"windows-targets 0.52.4",
"windows-targets",
]
[[package]]
@ -316,128 +426,78 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.52.4",
"windows-targets",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.48.5",
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
dependencies = [
"windows_aarch64_gnullvm 0.52.4",
"windows_aarch64_msvc 0.52.4",
"windows_i686_gnu 0.52.4",
"windows_i686_msvc 0.52.4",
"windows_x86_64_gnu 0.52.4",
"windows_x86_64_gnullvm 0.52.4",
"windows_x86_64_msvc 0.52.4",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
[[package]]
name = "windows_i686_gnu"
version = "0.52.4"
name = "windows_i686_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"

View file

@ -1,11 +1,17 @@
[package]
name = "bunbun"
version = "1.0.0"
description = "A simple and adorable sysinfo utility."
authors = ["Muhammad Nauman Raza <devraza@skiff.com>"]
version = "1.3.0"
edition = "2021"
categories = ["command-line-utilities"]
license-file = "LICENSE"
readme = "README.md"
[dependencies]
colored = "2.1.0"
sysinfo = "0.30.7"
clap = { version = "4.5.6", features = ["derive"] }
owo-colors = "4.0.0"
sysinfo = "0.30.12"
whoami = "1.5.1"
[profile.release]

View file

@ -1,3 +1,24 @@
# bunbun
> A simple and adorable sysinfo utility written in Rust.
A simple and adorable sysinfo utility written in Rust.
<p align="center">
<img src="./demo/demo.gif" alt="bunbun demo" width="400"/>
</p>
## Installation
To build `bunbun`, you'll need [Rust](https://rust-lang.org) installed:
```bash
$ git clone https://git.devraza.giize.com/devraza/bunbun
$ cd bunbun
$ cargo build --release # `--release` adds a few optimisations
```
> **Using the flake!**
> This repository contains a `flake.nix` - if you have Nix installed, you can run `nix run github:devraza/bunbun` to compile and run the program.
## Inspiration
- [Rosettea/bunnyfetch](https://github.com/Rosettea/bunnyfetch)
- [elenapan's `bunnyfetch` script](https://github.com/elenapan/dotfiles/blob/master/bin/bunnyfetch)
## License
This project is covered by the [MIT License](./LICENSE).

BIN
demo/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

14
demo/demo.tape Normal file
View file

@ -0,0 +1,14 @@
Output demo.gif
Set FontSize 40
Set FontFamily "Iosevka Comfy"
Set Width 950
Set Height 650
Set Shell "bash"
Type "../target/release/bunbun"
Sleep 500ms
Enter
Sleep 5s

View file

@ -1,33 +1,12 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1711088506,
"narHash": "sha256-USdlY7Tx2oJWqFBpp10+03+h7eVhpkQ4s9t1ERjeIJE=",
"owner": "nix-community",
"repo": "fenix",
"rev": "85f4139f3c092cf4afd9f9906d7ed218ef262c97",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"lastModified": 1716509168,
"narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"rev": "bfb7a882678e518398ce9a31a881538679f6f092",
"type": "github"
},
"original": {
@ -39,28 +18,10 @@
},
"root": {
"inputs": {
"fenix": "fenix",
"nixpkgs-unstable": "nixpkgs-unstable",
"utils": "utils"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1711052942,
"narHash": "sha256-lLsAhLgm/Nbin41wdfGKU7Rgd6ONBxYCUAMv53NXPjo=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "7ef7f442fc34b5eadb1c6ad6433bd6d0c51b056b",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,

View file

@ -1,55 +1,24 @@
{
description = "Rust development environment for bunbun using fenix";
description = "Rust development environment for bunbun";
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
utils.url = "github:numtide/flake-utils";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = {
self,
nixpkgs-unstable,
utils,
fenix,
...
}:
outputs = { self, nixpkgs-unstable, utils, ... }:
utils.lib.eachDefaultSystem
(
system: let
pkgs = import nixpkgs-unstable {
inherit system;
overlays = [fenix.overlays.default];
};
toolchain = pkgs.fenix.complete;
pkgs = import nixpkgs-unstable { inherit system; };
in rec
{
packages.default =
(pkgs.makeRustPlatform {
inherit (toolchain) cargo rustc;
})
.buildRustPackage {
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "bunbun";
version = "1.0.0";
version = "1.3.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
};
# Executed by `nix run`
apps.default = utils.lib.mkApp {drv = packages.default;};
# Used by `nix develop`
devShells.default = pkgs.mkShell rec {
buildInputs = with pkgs; [
(with toolchain; [
cargo rustc rust-src clippy rustfmt # rust components
])
];
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
};
}
);
}

15
justfile Normal file
View file

@ -0,0 +1,15 @@
set export
RUSTFLAGS := "-Zlocation-detail=none"
target := `rustc -Vv | awk 'FNR == 5 {print $2}'`
# Build for a small executable
tiny:
cargo +nightly build \
-Z build-std=std,panic_abort \
-Z build-std-features=panic_immediate_abort \
--target {{target}} --release
# Normal build, in this file for no good reason
build:
cargo build --release

View file

@ -1,34 +1,105 @@
use colored::Colorize;
use clap::Parser;
use owo_colors::{AnsiColors::*, OwoColorize};
use std::{env::var, path::PathBuf};
use sysinfo::System;
use whoami::*;
use std::env;
/// A simple and adorable sysinfo utility written in Rust.
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
/// Show ASCII art only
#[arg(short, long)]
ascii_only: bool,
/// Show CPU architecture
#[arg(short = 'x', long)]
arch: bool,
/// Show the kernel version
#[arg(short = 'k', long)]
kernel: bool,
/// Hide terminal colours
#[arg(short = 'z', long, default_value_t = false)]
hide_colours: bool,
}
// Display the CPU architecture
fn cpu_arch(args: &Args) {
if args.arch {
let arch = arch();
println!("{:>17} {}", "Arch".cyan().bold(), arch);
}
}
// Display the kernel version
fn display_kernel(args: &Args) {
if args.kernel {
let kernel = System::kernel_version().unwrap_or(String::from("N/A"));
println!("{:>19} {}", "Kernel".yellow().bold(), kernel);
}
}
fn main() {
let args = Args::parse();
let bottom = format!("c({})({})", "\"".red(), "\"".red()).to_string();
let ascii = vec!["(\\ /)", "( . .)", &bottom];
let ascii = ["(\\ /)", "( . .)", &bottom];
let hostname = fallible::hostname().unwrap_or(String::from("N/A"));
let user = env!("USER");
let arch = arch();
let user = username();
let combined = format!("{}@{}", user, hostname);
let kernel = System::kernel_version().unwrap_or(String::from("N/A"));
let pretty = distro();
let wm: &str;
let wm: String;
if cfg!(windows) {
wm = "Aero";
wm = "Aero".to_string();
} else if cfg!(unix) {
wm = env!("XDG_CURRENT_DESKTOP");
let xdg_current_desktop = var("XDG_CURRENT_DESKTOP");
let desktop = desktop_env().to_string();
if desktop != "Unknown: Unknown" {
wm = desktop;
} else if xdg_current_desktop.is_ok() {
wm = xdg_current_desktop.unwrap();
} else {
wm = "N/A".to_string();
}
} else {
wm = "N/A";
wm = "N/A".to_string();
}
println!("{:>32}", combined.italic());
println!("{:>17} {}", "Arch".cyan().bold(), arch);
println!("{:>8} {:>6} {}", ascii[0], "OS".blue().bold(), pretty);
println!("{:>9} {:>9} {}", ascii[1], "Kernel".red().bold(), kernel);
println!("{:>28} {:>4} {}", ascii[2], "WM".green().bold(), wm);
let shell_path = PathBuf::from(var("SHELL").unwrap_or(String::from("N/A")));
let shell = shell_path
.file_name()
.expect("Could not get $SHELL path")
.to_str()
.unwrap();
println!();
if !args.ascii_only {
println!("{: <13}{}", "", combined.bold());
cpu_arch(&args);
display_kernel(&args);
println!("{:>8} {:>6} {}", ascii[0], "OS".red().bold(), pretty);
println!("{:>9} {:>8} {}", ascii[1], "Shell".green().bold(), shell);
println!("{:>30} {:>4} {}", ascii[2], "WM".blue().bold(), wm);
} else {
for i in ascii {
println!(" {}", i);
}
}
if !args.hide_colours && !args.ascii_only {
println!();
let colors = [Black, Red, Green, Yellow, Blue, Magenta, Cyan, White];
let mut color_string: String = " ".to_string();
for color in colors {
color_string.push_str(&format!("{:>3}", "".color(color)));
}
println!("{}", color_string);
}
}