diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..393363e --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,20 @@ +pkgbase = nitch + pkgdesc = Incredibly fast system fetch written in Nim + pkgver = 0.2.4 + pkgrel = 1 + url = https://github.com/ruxir-ig/nitch + arch = x86_64 + license = MIT + makedepends = nim + makedepends = nimble + source = nitch-0.2.4.tar.gz::https://github.com/ruxir-ig/nitch/archive/refs/tags/v0.2.4.tar.gz + sha256sums = 8e386ba7cbf53cc1a5017d209e5b369cbd16df3f47f7e3cf1af9bb28d12aec44 + +pkgname = nitch + pkgdesc = Incredibly fast system fetch written in Nim (Nerd Font icons) + optdepends = nerd-fonts: for icon support + +pkgname = nitch-nonerd + pkgdesc = Incredibly fast system fetch written in Nim (no Nerd Font icons) + provides = nitch + conflicts = nitch diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9133002 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + name: Build binaries + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install choosenim (Nim toolchain) + run: | + curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y + echo "$HOME/.nimble/bin" >> $GITHUB_PATH + echo "$HOME/.nim/bin" >> $GITHUB_PATH + + - name: Show Nim version + run: nim --version + + - name: Build Nerd Font binary + run: nimble build -d:release -y + + - name: Build Non-Nerd Font binary + run: nim c -d:release -o:nitchNoNerd src/nitchNoNerd.nim + + - name: Upload binaries as workflow artifacts + uses: actions/upload-artifact@v4 + with: + name: nitch-binaries + path: | + ./nitch + ./nitchNoNerd + + packaging-sanity: + name: Packaging sanity check + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Validate .SRCINFO matches PKGBUILD (run in Arch container) + run: | + docker pull archlinux:latest + docker run --rm -e GITHUB_REPOSITORY='${{ github.repository }}' -e GITHUB_SHA='${{ github.sha }}' archlinux:latest /bin/bash -lc "\ + pacman -Sy --noconfirm --needed base-devel git nim && \ + useradd -m builder && \ + git clone https://github.com/\$GITHUB_REPOSITORY /tmp/nitch && \ + cd /tmp/nitch && git checkout \$GITHUB_SHA || true && \ + chown -R builder:builder /tmp/nitch && \ + su builder -c 'cd /tmp/nitch && makepkg --printsrcinfo > .SRCINFO.new' && \ + diff -u .SRCINFO .SRCINFO.new || (echo '.SRCINFO mismatch' && exit 1)" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6812e9d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + build-and-release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install choosenim (Nim toolchain) + run: | + curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y + echo "$HOME/.nimble/bin" >> $GITHUB_PATH + echo "$HOME/.nim/bin" >> $GITHUB_PATH + + - name: Build Nerd Font binary + run: nimble build -d:release -y + + - name: Build Non-Nerd Font binary + run: nim c -d:release -o:nitchNoNerd src/nitchNoNerd.nim + + - name: Verify binaries + run: | + ls -la nitch nitchNoNerd || (echo "build failed: binaries missing" && exit 1) + chmod +x nitch nitchNoNerd || true + + - name: Create GitHub release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: ${{ github.ref_name }} + body: "Release ${{ github.ref_name }}" + draft: false + prerelease: ${{ contains(github.ref_name, '-ci-test') }} + + - name: Upload release assets + uses: softprops/action-gh-release@v1 + with: + files: | + nitch + nitchNoNerd + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index ca92a8c..3b32ec5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,13 @@ -nitch* +# Compiled binaries +/nitch +/nitchNoNerd + +# Packaging artifacts +/pkg/ +/nitch-*.tar.gz +/src/nitch-*.tar.gz +/src/nitch-*/ + +# Arch package artifacts +/*.pkg.tar.zst +/*.pkg.tar.zst.sig diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..daae00b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,43 @@ +# Maintainer: ruxir-ig +# Contributor: unxsh (original author) + +pkgbase=nitch +pkgname=('nitch' 'nitch-nonerd') +pkgver=0.2.4 +pkgrel=1 +pkgdesc="Incredibly fast system fetch written in Nim" +arch=('x86_64') +url="https://github.com/ruxir-ig/nitch" +license=('MIT') +makedepends=('nim' 'nimble') +source=("$pkgbase-$pkgver.tar.gz::https://github.com/ruxir-ig/nitch/archive/refs/tags/v$pkgver.tar.gz") +sha256sums=('8e386ba7cbf53cc1a5017d209e5b369cbd16df3f47f7e3cf1af9bb28d12aec44') # Release tarball sha256 + +build() { + cd "$pkgbase-$pkgver" + + # Build Nerd Font version + nimble build -d:release -y + + # Build Non-Nerd Font version + nim c -d:release -o:nitchNoNerd src/nitchNoNerd.nim +} + +package_nitch() { + pkgdesc="Incredibly fast system fetch written in Nim (Nerd Font icons)" + optdepends=('nerd-fonts: for icon support') + + cd "$pkgbase-$pkgver" + install -Dm755 nitch "$pkgdir/usr/bin/nitch" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} + +package_nitch-nonerd() { + pkgdesc="Incredibly fast system fetch written in Nim (no Nerd Font icons)" + conflicts=('nitch') + provides=('nitch') + + cd "$pkgbase-$pkgver" + install -Dm755 nitchNoNerd "$pkgdir/usr/bin/nitch" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} diff --git a/README.md b/README.md index b512423..6f04cdd 100644 --- a/README.md +++ b/README.md @@ -1,217 +1,188 @@
- +> **Fork Notice:** This is a maintained fork of the original [nitch by unxsh](https://github.com/unxsh/nitch). The original project appears unmaintained, so this fork continues development with bug fixes and new features. # `NiTch` -

- incredibly fast system fetch written in nim👑 -

-
+### ⚡ Incredibly fast system fetch written in Nim -![Maintenance](https://shields.io/maintenance/yes/2022?style=for-the-badge) -![License](https://shields.io/github/license/unxsh/nitch?style=for-the-badge) -![Commits](https://shields.io/github/commit-activity/m/unxsh/nitch?style=for-the-badge) - -![GitHub Repo stars](https://img.shields.io/github/stars/unxsh/nitch?style=for-the-badge) -![GitHub issues](https://img.shields.io/github/issues/unxsh/nitch?style=for-the-badge) -![GitHub pull requests](https://img.shields.io/github/issues-pr/unxsh/nitch?style=for-the-badge) +``` + _ ___ ______ __ + / |/ (_)_ __/___/ / + / / / / / / __/ _ \ +/_/|_/_/ /_/ \__/_//_/ +``` -![GitHub release (latest by date)](https://img.shields.io/github/v/release/unxsh/nitch?style=for-the-badge) +[![License](https://img.shields.io/github/license/ruxir-ig/nitch?style=for-the-badge)](LICENSE) +[![Release](https://img.shields.io/github/v/release/ruxir-ig/nitch?style=for-the-badge)](https://github.com/ruxir-ig/nitch/releases) +[![Stars](https://img.shields.io/github/stars/ruxir-ig/nitch?style=for-the-badge)](https://github.com/ruxir-ig/nitch/stargazers)
-# Description 📖 +--- - +## Features -`nitch` 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. +- **Blazing Fast** — Executes in ~1.7ms +- **Zero Dependencies** — Pure Nim, no external libraries +- **Nerd Font Support** — Beautiful icons (with non-Nerd Font fallback) +- **Lightweight** — ~150KB binary +- **Multi-Distro** — Supports Arch, CachyOS, Debian, Ubuntu, Fedora, and more -The source code of `nitch` is highly documented and I hope it will act as a learning resource for nim -and linux systems architecture +## Preview (without logo) -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"! +**Nerd Font version:** +``` + ╭───────────╮ + │  user │ ruxir + │  hname │ odysseus + │ 󰻀 distro │ CachyOS + │ 󰌢 kernel │ 6.18.2-2-cachyos + │  uptime │ 2h 43m + │  shell │ zsh + │ 󰏖 pkgs │ 1536 + │ 󰍛 memory │ 8512 | 15708 MiB + ├───────────┤ + │ 󰏘 colors │         + ╰───────────╯ +``` +**Non-Nerd Font version:** +``` + ╭───────────╮ + │ > user │ ruxir + │ > hname │ odysseus + │ > distro │ CachyOS + │ > kernel │ 6.18.2-2-cachyos + │ > uptime │ 1h 30m + │ > shell │ zsh + │ > pkgs │ 1536 + │ > memory │ 4096 | 16384 MiB + ├───────────┤ + │ > colors │ # # # # # # # # + ╰───────────╯ +``` -btw written in `nim👑` +--- -why `nim👑`? because it's fast and simple +## Installation -
+### Quick Install (Binary) -# Installation ☁️ -```fish -wget https://raw.githubusercontent.com/unxsh/nitch/main/setup.sh && sh setup.sh +```bash +wget https://raw.githubusercontent.com/ruxir-ig/nitch/main/setup.sh && sh setup.sh ``` -# Usage 🪨 -``` -nitch +The installer will ask if you want Nerd Font icons or not. + +### Arch Linux / CachyOS (PKGBUILD) + +```bash +git clone https://github.com/ruxir-ig/nitch.git +cd nitch +makepkg -si ``` -flags: +Choose between: +- `nitch` — Nerd Font version +- `nitch-nonerd` — Standard font version + +### Build from Source + +```bash +# Install Nim +# Arch: sudo pacman -S nim +# Ubuntu: sudo apt install nim + +# Clone and build +git clone https://github.com/ruxir-ig/nitch.git +cd nitch +nimble build -d:release + +# For non-Nerd Font version +nim c -d:release -o:nitchNoNerd src/nitchNoNerd.nim ``` - -f --fetch | return fetch about system - -h --help | return help message - -v --version | return version of program + +--- + +## Usage + +```bash +nitch # Display system info +nitch -a # Display without ASCII art +nitch --no-ascii # Same as above +nitch -h # Show help +nitch -v # Show version ``` -
+--- + +## Configuration + +nitch is configured by editing the source code directly. + +**Icon customization:** Edit `src/funcs/drawing.nim` -# Configuration ⚙️ -### `nitch` is configured by changing the source code -### `src/funcs/drawing.nim` - config file ```nim -import std/terminal # import standard terminal lib -import getDistroId # import to get distro id through /etc/os-release -#import ../assets/logos # uncomment if you use your own logo -import ../nitches/[getUser, getHostname, - getDistro, getKernel, - getUptime, getShell, - getPkgs, getRam, - getLogo, getLogoColor] # import nitches to get info about user system - -# the main function for drawing fetch -proc drawInfo*() = - let # distro id (arch, manjaro, debian) - distroId: string = getDistroId() - - let # logo and it color - logoColor: ForegroundColor = getLogoColor(distroId) # color for logo - defaultLogo: string = getLogo(distroId) # default logo from nitch/src/assets/logos - - const # icons before cotegores - userIcon: string = " " # recomended: " " or "|>" - hnameIcon: string = " " # recomended: " " or "|>" - distroIcon: string = "󰻀 " # recomended: "󰻀 " or "|>" - kernelIcon: string = "󰌢 " # recomended: "󰌢 " or "|>" - uptimeIcon: string = " " # recomended: " " or "|>" - shellIcon: string = " " # recomended: " " or "|>" - pkgsIcon: string = "󰏖 " # recomended: "󰏖 " or "|>" - ramIcon: string = "󰍛 " # recomended: "󰍛 " or "|>" - colorsIcon: string = "󰏘 " # recomended: "󰏘 " or "->" - # please insert any char after the icon - # to avoid the bug with cropping the edge of the icon - - dotIcon: string = "" # recomended: "" or "■" - # icon for demonstrate colors - - const # categories - userCat: string = " user │ " # recomended: " user │ " - hnameCat: string = " hname │ " # recomended: " hname │ " - distroCat: string = " distro │ " # recomended: " distro │ " - kernelCat: string = " kernel │ " # recomended: " kernel │ "- - uptimeCat: string = " uptime │ " # recomended: " uptime │ " - shellCat: string = " shell │ " # recomended: " shell │ " - pkgsCat: string = " pkgs │ " # recomended: " pkgs │ " - ramCat: string = " memory │ " # recomended: " memory │ " - colorsCat: string = " colors │ " # recomended: " colors │ " - - let # all info about system - userInfo: string = getUser() # get user through $USER env variable - hostnameInfo: string = getHostname() # get Hostname hostname through /etc/hostname - distroInfo: string = getDistro() # get distro through /etc/os-release - kernelInfo: string = getKernel() # get kernel through /proc/version - uptimeInfo: string = getUptime() # get Uptime through /proc/uptime file - shellInfo: string = getShell() # get shell through $SHELL env variable - pkgsInfo: string = getPkgs(distroId) # get amount of packages in distro - ramInfo: string = getRam() # get ram through /proc/meminfo - - const # aliases for colors - color1: ForegroundColor = fgRed - color2: ForegroundColor = fgYellow - color3: ForegroundColor = fgGreen - color4: ForegroundColor = fgCyan - color5: ForegroundColor = fgBlue - color6: ForegroundColor = fgMagenta - color7: ForegroundColor = fgWhite - color8: ForegroundColor = fgBlack - color0: ForegroundColor = fgDefault - - # colored out - stdout.styledWrite(styleBright, logoColor, defaultLogo) - stdout.styledWrite(styleBright, " ╭───────────╮\n") - stdout.styledWrite(styleBright, " │ ", color1, userIcon, color0, userCat, color1, userInfo, "\n") - stdout.styledWrite(styleBright, " │ ", color2, hnameIcon, color0, hnameCat, color2, hostnameInfo, "\n") - stdout.styledWrite(styleBright, " │ ", color3, distroIcon, color0, distroCat, color3, distroInfo, "\n") - stdout.styledWrite(styleBright, " │ ", color4, kernelIcon, color0, kernelCat, color4, kernelInfo, "\n") - stdout.styledWrite(styleBright, " │ ", color5, uptimeIcon, color0, uptimeCat, color5, uptimeInfo, "\n") - stdout.styledWrite(styleBright, " │ ", color6, shellIcon, color0, shellCat, color6, shellInfo, "\n") - stdout.styledWrite(styleBright, " │ ", color1, pkgsIcon, color0, pkgsCat, color1, pkgsInfo, "\n") - stdout.styledWrite(styleBright, " │ ", color2, ramIcon, color0, ramCat, fgYellow, ramInfo, "\n") - stdout.styledWrite(styleBright, " ├───────────┤\n") - stdout.styledWrite(styleBright, " │ ", color7, colorsIcon, color0, colorsCat, color7, dotIcon, " ", color1, dotIcon, " ", color2, dotIcon, " ", color3, dotIcon, " ", color4, dotIcon, " ", color5, dotIcon, " ", color6, dotIcon, " ", color8, dotIcon, "\n") - stdout.styledWrite(styleBright, " ╰───────────╯\n\n") +const # icons before categories + userIcon = " " # Nerd Font icon + # or + userIcon = "|>" # Plain text fallback ``` -# Building 📦 -### 0) install [nim](https://nim-lang.org/) +**Supported Distros:** +- Arch Linux, CachyOS, Manjaro +- Debian, Ubuntu, Linux Mint +- Fedora, CentOS, RHEL +- openSUSE, Gentoo, Slackware +- Pop!_OS, Zorin OS +- Void Linux, NixOS +- And more... -### 1) clone repo -```fish -git clone https://github.com/unxsh/nitch.git -``` -### 2) change dir to `nitch` -```fish -cd nitch/ -``` +--- + +## Project Structure -### 3) build program with `nimble` -```fish -nimble build ``` -After that you will get a ready-made binary file in the root directory of the project. - -
- -# File architecture 📁 -```fish -nitch - ├── LICENSE - ├── nitch - ├── nitch.nimble - ├── README.md - ├── src - │ ├── assets - │ │ ├── assets.nim - │ │ └── logos.nim - │ ├── flags - │ │ └── argParser.nim - │ ├── funcs - │ │ ├── drawing.nim - │ │ ├── packages - │ │ │ └── getPacmanPkgs.nim - │ │ └── perform.nim - │ ├── nitches - │ │ ├── getDistro.nim - │ │ ├── getHostname.nim - │ │ ├── getKernel.nim - │ │ ├── getPkgs.nim - │ │ ├── getRam.nim - │ │ ├── getShell.nim - │ │ ├── getUptime.nim - │ │ └── getUser.nim - │ ├── nitch.nim - │ └── nitch.nim.cfg - └── templates - ├── cfgParser - ├── cfgParser.nim - ├── data.dat - ├── listFiles.nim - ├── readLine.nim - ├── refTest.nim - ├── shellCheck.nim - ├── test.cfg - ├── testFile - └── testProc.nim - - 7 directories, 30 files +nitch/ +├── src/ +│ ├── nitch.nim # Main entry (Nerd Font) +│ ├── nitchNoNerd.nim # Main entry (Non-Nerd Font) +│ ├── assets/ +│ │ ├── assets.nim # Help text, version +│ │ └── logos.nim # ASCII logos +│ ├── flags/ +│ │ └── argParser.nim # CLI argument parser +│ ├── funcs/ +│ │ ├── drawing.nim # Output rendering (Nerd) +│ │ ├── drawingNoNerd.nim +│ │ ├── perform.nim # Action handlers +│ │ └── packages/ # Package managers +│ └── nitches/ # System info fetchers +├── PKGBUILD # Arch Linux package +├── setup.sh # Quick installer +└── nitch.nimble # Nim package config ``` -# Thanks for ideas & examples 💬 -- [pfetch](https://github.com/dylanaraps/pfetch/) -- [neofetch](https://github.com/dylanaraps/neofetch) -- [paleofetch](https://github.com/ss7m/paleofetch) -- [rxfetch](https://github.com/Mangeshrex/rxfetch) -- [nerdfetch](https://github.com/ThatOneCalculator/NerdFetch) +--- + +## Contributing + +Contributions are welcome! Feel free to: +- Report bugs +- Suggest new features +- Add support for more distros +- Submit pull requests + +--- + +## License + +MIT License — see [LICENSE](LICENSE) + +--- + +## Credits + +- Original project by [unxsh](https://github.com/unxsh/nitch) +- Inspired by [pfetch](https://github.com/dylanaraps/pfetch), [neofetch](https://github.com/dylanaraps/neofetch), [paleofetch](https://github.com/ss7m/paleofetch) diff --git a/nitch.nimble b/nitch.nimble index affcb64..a415478 100644 --- a/nitch.nimble +++ b/nitch.nimble @@ -1,7 +1,7 @@ # Package -version = "0.2.2" -author = "sfome" +version = "0.2.4" +author = "ruxir-ig" description = "System fetch in nim lang" license = "MIT" diff --git a/setup.sh b/setup.sh index aefbb3b..2b4fa79 100755 --- a/setup.sh +++ b/setup.sh @@ -1,7 +1,7 @@ #!/bin/sh -linkNerd="https://github.com/unxsh/nitch/releases/download/0.1.6/nitchNerd" -linkNoNerd="https://github.com/unxsh/nitch/releases/download/0.1.6/nitchNoNerd" +linkNerd="https://github.com/ruxir-ig/nitch/releases/download/v0.2.4/nitch" +linkNoNerd="https://github.com/ruxir-ig/nitch/releases/download/v0.2.4/nitchNoNerd" sudo rm -fv /usr/local/bin/nitch diff --git a/src/assets/logos.nim b/src/assets/logos.nim index 2fd73a3..f9cf819 100644 --- a/src/assets/logos.nim +++ b/src/assets/logos.nim @@ -111,6 +111,14 @@ const ___ __ _ __ __ / _ | ____ / /_(_)\ \/ / - / __ |/ __// __/ / > < + / __ |/ __// __/ / > < /_/ |_/_/ \__/_/ /_/\_\ -""" \ No newline at end of file +""" + cachyosLogo* = r""" + + _____ __ ____ ____ + / ___/__ _____/ / __ __/ __ \/ __/ + / /__/ _ `/ __/ _ \/ // / /_/ /\ \ + \___/\_,_/\__/_//_/\_, /\____/___/ + /___/ +""" diff --git a/src/funcs/drawingNoNerd.nim b/src/funcs/drawingNoNerd.nim new file mode 100644 index 0000000..3a6877f --- /dev/null +++ b/src/funcs/drawingNoNerd.nim @@ -0,0 +1,87 @@ +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 (non-Nerd Font version) +proc drawInfo*(asciiArt: bool) = + let # distro id (arch, manjaro, debian) + distroId = getDistroId() + + let # logo and it color + coloredLogo = getLogo(distroId) # color + logo tuple + # (fgRed, nitchLogo) + + const # icons before cotegores (non-Nerd Font) + userIcon = "> " # non-nerd alternative (1 char + space = 2 cols) + hnameIcon = "> " # non-nerd alternative + distroIcon = "> " # non-nerd alternative + kernelIcon = "> " # non-nerd alternative + uptimeIcon = "> " # non-nerd alternative + shellIcon = "> " # non-nerd alternative + pkgsIcon = "> " # non-nerd alternative + ramIcon = "> " # non-nerd alternative + colorsIcon = "> " # non-nerd alternative + # please insert any char after the icon + # to avoid the bug with cropping the edge of the icon + + dotIcon = "#" # non-nerd alternative + # 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") diff --git a/src/funcs/performNoNerd.nim b/src/funcs/performNoNerd.nim new file mode 100644 index 0000000..98a2426 --- /dev/null +++ b/src/funcs/performNoNerd.nim @@ -0,0 +1,19 @@ +import + ./drawingNoNerd, + ../assets/assets + +# if if no flag +proc arg0*() = + drawInfo(true) + +# if -a --no-ascii flags +proc arg1*() = + drawInfo(false) + +# if -h --help flags +proc arg2*() = + stdout.write(helpMsg) # write to stdout helpMsg from nitch/assets/assets file + +# if -v --version flags +proc arg3*() = + stdout.write(programVersion) # write to stdout programVersion from nitch/assets/assets file diff --git a/src/nitchNoNerd.nim b/src/nitchNoNerd.nim new file mode 100644 index 0000000..1556ed4 --- /dev/null +++ b/src/nitchNoNerd.nim @@ -0,0 +1,30 @@ +import + std/os, # import os module from stdlib + flags/argParser, # import arg parser from nitch/flags/argParser + funcs/performNoNerd # perform funcs for flags (non-Nerd Font version) + +let + arg = argParser(commandLineParams(), paramCount()) # called argParser with args seq and amount of args + +# case return of argParser +case arg: + +# if no flags +of 0: + arg0() # cal arg0 func from perform + +# if -a --no-ascii flags +of 1: + arg1() # cal arg1 func from perform + +# if -h --help flags +of 2: + arg2() # cal arg1 func from perform + +# if -v --version flags +of 3: + arg3() # cal arg2 func from perform + +# nim xdd +else: + arg0() diff --git a/src/nitches/getLogo.nim b/src/nitches/getLogo.nim index cb33720..c403dca 100644 --- a/src/nitches/getLogo.nim +++ b/src/nitches/getLogo.nim @@ -4,7 +4,7 @@ import func getLogo*(distroId: string): tuple = const - coloredLogos: array[16, tuple] = [ + coloredLogos: array[17, tuple] = [ (fgRed, nitchLogo), (fgBlue, archLogo), (fgRed, ubuntuLogo), @@ -20,7 +20,8 @@ func getLogo*(distroId: string): tuple = (fgRed, redhatLogo), (fgMagenta, gentooLogo), (fgMagenta, endeavourosLogo), - (fgBlue, artixLogo) + (fgBlue, artixLogo), + (fgCyan, cachyosLogo) ] case distroId: @@ -69,5 +70,8 @@ func getLogo*(distroId: string): tuple = of "artix": result = coloredLogos[15] + of "cachyos": + result = coloredLogos[16] + else: result = coloredLogos[0] diff --git a/src/nitches/getPkgs.nim b/src/nitches/getPkgs.nim index ca05971..caac44d 100644 --- a/src/nitches/getPkgs.nim +++ b/src/nitches/getPkgs.nim @@ -7,7 +7,7 @@ proc getPkgs*(distroId: string): string = case distroId: of "arch": result = getPacmanPkgs() - + of "artix": result = getPacmanPkgs() @@ -23,6 +23,9 @@ proc getPkgs*(distroId: string): string = of "garuda": result = getPacmanPkgs() + of "cachyos": + result = getPacmanPkgs() + of "fedora": result = getRpmPkgs()