incredibly fast system fetch written in nim๐, NiTch Revived is project supposed to continue the NiTch after it become not maintained.
nitchrevived is a small and incredibly fast system fetch written fully in nim๐ without any dependencies, on my pc
it executes in around 1.70 miliseconds.
The source code of nitchrevived is highly documented and I hope it will act as a learning resource for nim
and linux systems architecture
If anything in the source code is unclear or is lacking in its explanation, open an issue. Sometimes you get too close to something and you fail to see the "bigger picture"!
btw written in nim๐
why nim๐? because it's fast and simple
wget -O - https://git.teto.party/pkgs/nitchrevived/raw/branch/main/install.sh | shnitchrevived
flags:
-f --fetch | return fetch about system
-h --help | return help message
-v --version | return version of program
-l --logo | return fetch with specified distro logo
import
std/terminal, # import standard terminal lib
std/strutils,
getDistroId, # import to get distro id through /etc/os-release
../assets/logos, # uncomment if you use your own logo
../nitches/[getUser, getHostname,
getDistro, getKernel,
getUptime, getShell,
getPkgs, getRam, getLogo] # import nitches to get info about user system
# the main function for drawing fetch
proc drawInfo*(asciiArt: bool, distro: string) =
let # distro id (arch, manjaro, debian)
distroId = if distro.len > 0: distro else: getDistroId()
let # logo and it color
coloredLogo = getLogo(distroId) # color + logo tuple
# (fgRed, nitchLogo)
const # icons before cotegores
userIcon = "๏ " # recomended: "๏ " or "|>"
hnameIcon = "๎ " # recomended: "๎ " or "|>"
distroIcon = "๓ฐป " # recomended: "๓ฐป " or "|>"
kernelIcon = "๓ฐข " # recomended: "๓ฐข " or "|>"
uptimeIcon = "๏ " # recomended: "๏ " or "|>"
shellIcon = "๏ " # recomended: "๏ " or "|>"
pkgsIcon = "๓ฐ " # recomended: "๓ฐ " or "|>"
ramIcon = "๓ฐ " # recomended: "๓ฐ " or "|>"
colorsIcon = "๓ฐ " # recomended: "๓ฐ " or "->"
# please insert any char after the icon
# to avoid the bug with cropping the edge of the icon
dotIcon = "๏" # recomended: "๏" or "โ "
# icon for demonstrate colors
const # categories
userCat = " user โ " # recomended: " user โ "
hnameCat = " hname โ " # recomended: " hname โ "
distroCat = " distro โ " # recomended: " distro โ "
kernelCat = " kernel โ " # recomended: " kernel โ "-
uptimeCat = " uptime โ " # recomended: " uptime โ "
shellCat = " shell โ " # recomended: " shell โ "
pkgsCat = " pkgs โ " # recomended: " pkgs โ "
ramCat = " memory โ " # recomended: " memory โ "
colorsCat = " colors โ " # recomended: " colors โ "
let # all info about system
userInfo = getUser() # get user through $USER env variable
hostnameInfo = getHostname() # get Hostname hostname through /etc/hostname
distroInfo = getDistro() # get distro through /etc/os-release
kernelInfo = getKernel() # get kernel through /proc/version
uptimeInfo = getUptime() # get Uptime through /proc/uptime file
shellInfo = getShell() # get shell through $SHELL env variable
pkgsInfo = getPkgs(distroId) # get amount of packages in distro
ramInfo = getRam() # get ram through /proc/meminfo
const # aliases for colors
color1 = fgRed
color2 = fgYellow
color3 = fgGreen
color4 = fgCyan
color5 = fgBlue
color6 = fgMagenta
color7 = fgWhite
color8 = fgBlack
color0 = fgDefault
# ascii art
if not asciiArt:
discard
else:
stdout.styledWrite(styleBright, coloredLogo[0], coloredLogo[1], color0)
# colored out
stdout.styledWrite("\n", styleBright, " โญโโโโโโโโโโโโฎ\n")
stdout.styledWrite(" โ ", color2, userIcon, color0, userCat, color1, userInfo, color0, "\n",)
if not isEmptyOrWhitespace(hostnameInfo):
stdout.styledWrite(" โ ", color2, hnameIcon, color0, hnameCat, color2, hostnameInfo, color0, "\n")
stdout.styledWrite(" โ ", color3, distroIcon, color0, distroCat, color3, distroInfo, color0, "\n")
stdout.styledWrite(" โ ", color4, kernelIcon, color0, kernelCat, color4, kernelInfo, color0, "\n")
stdout.styledWrite(" โ ", color5, uptimeIcon, color0, uptimeCat, color5, uptimeInfo, color0, "\n")
stdout.styledWrite(" โ ", color6, shellIcon, color0, shellCat, color6, shellInfo, color0, "\n")
stdout.styledWrite(" โ ", color1, pkgsIcon, color0, pkgsCat, color1, pkgsInfo, color0, "\n")
stdout.styledWrite(" โ ", color2, ramIcon, color0, ramCat, fgYellow, ramInfo, color0, "\n")
stdout.styledWrite(" โโโโโโโโโโโโโค\n")
stdout.styledWrite(" โ ", color7, colorsIcon, color0, colorsCat, color7, dotIcon, " ", color1, dotIcon, " ", color2, dotIcon, " ", color3, dotIcon, " ", color4, dotIcon, " ", color5, dotIcon, " ", color6, dotIcon, " ", color8, dotIcon, color0, "\n")
stdout.styledWrite(" โฐโโโโโโโโโโโโฏ\n\n")0) install nim
git clone https://git.teto.party/pkgs/nitchrevivedcd nitchrevived/nimble buildAfter that you will get a ready-made binary file in the root directory of the project.
nitchrevived
โโโ LICENSE
โโโ nitchrevived
โโโ nitchrevived.nimble
โโโ README.md
โโโ src
โโโ assets
โ โโโ assets.nim
โ โโโ logos.nim
โโโ flags
โ โโโ argParser.nim
โโโ funcs
โ โโโ drawing.nim
โ โโโ packages
โ โ โโโ getPacmanPkgs.nim
โ โ โโโ getDpkgPkgs.nim
โ โ โโโ getRpmPkgs.nim
โ โ โโโ getXbpsPkgs.nim
โ โ โโโ getPortagePkgs.nim
โ โโโ perform.nim
โโโ nitches
โ โโโ getDistro.nim
โ โโโ getHostname.nim
โ โโโ getKernel.nim
โ โโโ getPkgs.nim
โ โโโ getRam.nim
โ โโโ getShell.nim
โ โโโ getUptime.nim
โ โโโ getUser.nim
โโโ nitchrevived.nim
โโโ nitchrevived.nim.cfg
7 directories, 25 files