updated README
This commit is contained in:
@@ -1,25 +1,28 @@
|
|||||||
# fetchit
|
# fetchit
|
||||||
|
|
||||||
fetchit is a terminal-based system information viewer written in C++. It works like neofetch/fastfetch and consists of a single file (`main.cpp`).
|
`fetchit` is a Linux terminal system information viewer written in C++. It's a single-file program (`main.cpp`) that prints a colored distro logo (when available) alongside system and hardware info, similar to neofetch/fastfetch.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Displays distro, kernel, uptime, shell, CPU, GPU, RAM, and OS date information.
|
- Shows: distro, kernel, uptime, shell, CPU, GPU, RAM, and "OS Date".
|
||||||
- Detects distro name via `/etc/os-release`.
|
- Distro detection via `/etc/os-release` (`PRETTY_NAME` for display, `ID` for logo matching).
|
||||||
- Shows ASCII logos for supported distros.
|
- Colored ASCII distro logos for supported distros.
|
||||||
- Reads `/usr/share/hwdata/pci.ids` for GPU names; prints hex IDs if missing.
|
- GPU detection by scanning PCI devices (`/sys/bus/pci/devices/`) for class `0x03*`.
|
||||||
- Accounts for Unicode character width (for icon alignment).
|
- GPU name resolution via `/usr/share/hwdata/pci.ids` (falls back to hex IDs if missing).
|
||||||
|
- Accounts for Unicode character width for better alignment in terminals.
|
||||||
|
|
||||||
## Supported Distro Logos
|
## Supported Distro Logos
|
||||||
|
|
||||||
|
Logos are matched against `/etc/os-release` `ID`:
|
||||||
|
|
||||||
`arch`, `cachyos`, `debian`, `ubuntu`, `fedora`, `manjaro`, `opensuse`, `pop`, `linuxmint`, `endeavouros`, `void`, `alpine`
|
`arch`, `cachyos`, `debian`, `ubuntu`, `fedora`, `manjaro`, `opensuse`, `pop`, `linuxmint`, `endeavouros`, `void`, `alpine`
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Linux
|
- Linux
|
||||||
- A C++17-capable compiler (e.g., g++)
|
- A C++17-capable compiler (default: `g++`)
|
||||||
- A UTF-8 terminal with ANSI color support (for icons and colors)
|
- UTF-8 locale + ANSI color support (recommended for icons/colors)
|
||||||
- The following files/paths are read:
|
- Reads the following files/paths:
|
||||||
- `/etc/os-release`
|
- `/etc/os-release`
|
||||||
- `/etc/hostname`
|
- `/etc/hostname`
|
||||||
- `/proc/uptime`
|
- `/proc/uptime`
|
||||||
@@ -31,34 +34,94 @@ fetchit is a terminal-based system information viewer written in C++. It works l
|
|||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
```bash
|
### Using the Makefile (recommended)
|
||||||
g++ -std=c++17 -O2 -o fetchit main.cpp
|
|
||||||
```
|
|
||||||
|
|
||||||
## Run
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./fetchit
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
## Sample Output
|
Binary output: `build/fetchit`
|
||||||
|
|
||||||
```text
|
Run:
|
||||||
--- murat@baklava ---
|
|
||||||
|
|
||||||
/\ distro: Arch Linux
|
```bash
|
||||||
/ \ kernel: 7.0.10-arch1-1
|
make run
|
||||||
/ \ uptime: 1 minutes
|
```
|
||||||
/ \ shell: /usr/bin/bash
|
|
||||||
/ ,, \ CPU: 12th Gen Intel(R) Core(TM) i5-12500H (16) @ 4.5 GHz
|
### Manual build
|
||||||
/ | | \ GPU: AD107M [GeForce RTX 4060 Max-Q / Mobile] / Alder Lake-P GT2 [Iris Xe Graphics]
|
|
||||||
/_-'' ''-_\ RAM: 15.2529 GB
|
```bash
|
||||||
OS Date: 6 months 17 days 3 hours 40 minutes
|
g++ -O2 -Wall -Wextra -std=c++17 -pipe -o fetchit main.cpp
|
||||||
|
```
|
||||||
|
|
||||||
|
## Install / Uninstall
|
||||||
|
|
||||||
|
Install:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
Defaults:
|
||||||
|
|
||||||
|
- `PREFIX=/usr/local`
|
||||||
|
- `BINDIR=$(PREFIX)/bin`
|
||||||
|
- Installs to: `/usr/local/bin/fetchit`
|
||||||
|
|
||||||
|
Uninstall:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo make uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
Packaging-friendly variables:
|
||||||
|
|
||||||
|
- `DESTDIR` (staging root)
|
||||||
|
- `PREFIX`, `BINDIR`
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make install PREFIX=/usr BINDIR=/usr/bin DESTDIR=/tmp/pkgroot
|
||||||
|
```
|
||||||
|
|
||||||
|
## Distribution Archive
|
||||||
|
|
||||||
|
Create a tar.gz containing the built binary:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make dist
|
||||||
|
```
|
||||||
|
|
||||||
|
Output: `dist/fetchit-<version>-linux-x86_64-gnu.tar.gz`
|
||||||
|
|
||||||
|
`<version>` is derived from:
|
||||||
|
`git describe --tags --dirty --always` (when available)
|
||||||
|
|
||||||
|
Full release pipeline:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make release
|
||||||
```
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- `OS Date` is based on the creation time of `/etc/hostname`.
|
- `shell` is taken from `$SHELL` and printed as the basename (e.g. `bash`, not `/usr/bin/bash`).
|
||||||
- If no ASCII logo is found, only the info list is printed.
|
- `OS Date` is computed from `/etc/hostname` file metadata (`ctime`) as an elapsed duration; it may not equal the OS install date.
|
||||||
- The distro logo is displayed in color via ANSI escape codes.
|
- If `pci.ids` is unavailable, GPU(s) are printed as hex IDs like `0xVVVV:0xDDDD`.
|
||||||
- This tool targets Linux systems and is not expected to work on non-Linux OSes.
|
- If no distro logo matches, the logo section will be empty and only info lines are shown.
|
||||||
|
|
||||||
|
## Sample Output
|
||||||
|
|
||||||
|
```text
|
||||||
|
--- user@host ---
|
||||||
|
|
||||||
|
/\ distro: Arch Linux
|
||||||
|
/ \ kernel: 7.0.10-arch1-1
|
||||||
|
/ \ uptime: 12 minutes
|
||||||
|
/ \ shell: bash
|
||||||
|
/ ,, \ CPU: ... (N) @ X.XX GHz
|
||||||
|
/ | | \ GPU: ...
|
||||||
|
/_-'' ''-_\ RAM: 15.25 GB
|
||||||
|
OS Date: 6 months 17 days 3 hours 40 minutes
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user