Skip to content

Commit

Permalink
Fix: updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ssleert committed Jul 17, 2022
1 parent 9d6fbe3 commit 1c6955c
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 37 deletions.
94 changes: 58 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,65 +60,88 @@ flags:
<br>

# Configuration ⚙️
### `nitch` is configured through editing source code

### **src/funcs/drawing.nim**
### main conf file
### `nitch` is configured by changing the source code
### `src/funcs/drawing.nim` - config file
```nim
import std/terminal # import standard terminal lib
import ../assets/logos # import logos from nitch/src/assets/logos
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] # import nitches to get info about user system
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: " "
hnameIcon: string = "->" # recomended: " "
distroIcon: string = "->" # recomended: " "
kernelIcon: string = "->" # recomended: " "
uptimeIcon: string = "->" # recomended: " "
shellIcon: string = "->" # recomended: " "
pkgsIcon: string = "->" # recomended: " "
ramIcon: string = "->" # recomended: " "
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 │ "
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
defaultLogo: string = nitchLogo # default nitch logo from nitch/src/assets/logos
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() # get amount of packages in distro
ramInfo: string = getRam() # get ram through /proc/meminfo
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, fgRed, defaultLogo)
stdout.styledWrite(styleBright, logoColor, defaultLogo)
stdout.styledWrite(styleBright, " ╭───────────╮\n")
stdout.styledWrite(styleBright, " │ ", fgGreen, userIcon, fgDefault, userCat, fgGreen, userInfo, "\n")
stdout.styledWrite(styleBright, " │ ", fgYellow, hnameIcon, fgDefault, hnameCat, fgYellow, hostnameInfo, "\n")
stdout.styledWrite(styleBright, " │ ", fgRed, distroIcon, fgDefault, distroCat, fgRed, distroInfo, "\n")
stdout.styledWrite(styleBright, " │ ", fgBlue, kernelIcon, fgDefault, kernelCat, fgBlue, kernelInfo, "\n")
stdout.styledWrite(styleBright, " │ ", fgCyan, uptimeIcon, fgDefault, uptimeCat, fgCyan, uptimeInfo, "\n")
stdout.styledWrite(styleBright, " │ ", fgMagenta, shellIcon, fgDefault, shellCat, fgMagenta, shellInfo, "\n")
stdout.styledWrite(styleBright, " │ ", fgGreen, pkgsIcon, fgDefault, pkgsCat, fgGreen, pkgsInfo, "\n")
stdout.styledWrite(styleBright, " │ ", fgYellow, ramIcon, fgDefault, ramCat, fgYellow, ramInfo, "\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")
```

Expand All @@ -140,7 +163,6 @@ nimble build
```
After that you will get a ready-made binary file in the root directory of the project.

<br>
<br>

# File architecture 📁
Expand Down
2 changes: 1 addition & 1 deletion src/funcs/packages/getRpmPkgs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ proc getRpmPkgs*(): string =
let
count: string = osproc.execCmdEx("rpm -qa | wc -l")[0]

result = count[0 .. ^2]
result = count[0 .. ^3]
5 changes: 5 additions & 0 deletions templates/slice.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const
asd: string = "1234567890"


echo asd[0 .. ^3]

0 comments on commit 1c6955c

Please sign in to comment.