forked from lqdev/fitch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lqdev#5 from lamg/main
Refactored project and features added
- Loading branch information
Showing
35 changed files
with
1,232 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"paket": { | ||
"version": "8.0.0", | ||
"commands": [ | ||
"paket" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[*.fs] | ||
indent_size = 2 | ||
end_of_line = lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: mcr.microsoft.com/dotnet/sdk:8.0 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Run tests | ||
run: | | ||
dotnet tool restore | ||
dotnet paket restore | ||
dotnet test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
|
||
<LangVersion>preview</LangVersion> | ||
<Version>1.2.0</Version> | ||
<PackageId>fitch</PackageId> | ||
<PackAsTool>true</PackAsTool> | ||
<ToolCommandName>fitch</ToolCommandName> | ||
<PackageOutputPath>./nupkg</PackageOutputPath> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/lqdev/fitch</RepositoryUrl> | ||
<Description>Command line system information display utility for Linux systems built with .NET (F#).</Description> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="Utils.fs" /> | ||
<Compile Include="Program.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\README.md" Pack="true" PackagePath="\"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Spectre.Console" Version="0.45.0" /> | ||
</ItemGroup> | ||
|
||
</Project> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<LangVersion>preview</LangVersion> | ||
<Version>1.2.0</Version> | ||
<PackageId>fitch</PackageId> | ||
<PackAsTool>true</PackAsTool> | ||
<ToolCommandName>fitch</ToolCommandName> | ||
<PackageOutputPath>./nupkg</PackageOutputPath> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/lqdev/fitch</RepositoryUrl> | ||
<Description>Command line system information display utility for Linux systems built with .NET (F#).</Description> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Program.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="..\README.md" Pack="true" PackagePath="\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Lib\Lib.fsproj" /> | ||
</ItemGroup> | ||
<Import Project="..\.paket\Paket.Restore.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
open System | ||
|
||
DisplayInfo.displayInfo () | ||
Console.ResetColor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FSharp.Core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module Lib.Colorize | ||
|
||
open Lib.Types | ||
|
||
let color (colorCode: string) = | ||
let reset = "\x1b[0m" | ||
|
||
match colorCode with | ||
| "0" | ||
| "1" | ||
| "2" | ||
| "3" | ||
| "4" | ||
| "5" | ||
| "6" -> sprintf "%s\x1b[3%sm" reset colorCode | ||
| "7" | ||
| "fg" -> sprintf "\x1b[37m%s" reset | ||
| _ -> sprintf "\x1b[38;5;%sm" colorCode | ||
|
||
let replaceColors (logo: string) (colors: string list) = | ||
let xs = colors |> List.mapi (fun i c -> sprintf "${c%d}" (i + 1), color $"{c}") | ||
xs |> List.fold (fun (acc: string) -> acc.Replace) logo | ||
|
||
let colorize (l: DistroLogo) = replaceColors l.logo l.colors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module DisplayInfo | ||
|
||
open Lib | ||
open Spectre.Console | ||
open Spectre.Console.Rendering | ||
open Lib.SystemInfo | ||
|
||
let loadLogo (logo: string) = | ||
NeofetchLogos.logoDictionary.TryGetValue logo | ||
|> function | ||
| true, l -> l | ||
| false, _ -> NeofetchLogos.logoDictionary["unknown"] | ||
|> Colorize.colorize | ||
|> Text | ||
:> IRenderable | ||
|
||
let displayInfo () = | ||
let info = systemInfo () | ||
|
||
let (rows: IRenderable seq) = | ||
seq { | ||
Text($"Distribution: {info.distroName}", Style(Color.HotPink)) | ||
Text($"Kernel: {info.kernelName}", Style(Color.HotPink)) | ||
Text($"Shell: {info.shell}", Style(Color.HotPink)) | ||
Text($"User: {info.user}", Style(Color.Yellow)) | ||
Text($"Hostname: {info.hostName}", Style(Color.Yellow)) | ||
Text($"Uptime: {info.upTime}", Style(Color.Blue)) | ||
Text($"Memory: {info.memInfo}", Style(Color.Blue)) | ||
Text($"CPU: {info.cpuModel}", Style(Color.Blue)) | ||
Text($"LocalIP: {info.localIp}", Style(Color.Green)) | ||
} | ||
let logoPanel = loadLogo info.distroId | ||
let textPanel = Rows rows :> IRenderable | ||
let columns = Columns [textPanel; logoPanel] | ||
AnsiConsole.Write columns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Types.fs" /> | ||
<Compile Include="Colorize.fs" /> | ||
<Compile Include="NeofetchLogos.fs" /> | ||
<Compile Include="SystemInfo.fs" /> | ||
<Compile Include="DisplayInfo.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Logos\*.txt" /> | ||
</ItemGroup> | ||
<Import Project="..\.paket\Paket.Restore.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
${c1} -` | ||
${c1} .o+` | ||
${c1} `ooo/ | ||
${c1} `+oooo: | ||
${c1} `+oooooo: | ||
${c1} -+oooooo+: | ||
${c1} `/:-:++oooo+: | ||
${c1} `/++++/+++++++: | ||
${c1} `/++++++++++++++: | ||
${c1} `/+++o${c2}oooooooo${c1}oooo/` | ||
${c2} ${c1}./${c2}ooosssso++osssssso${c1}+` | ||
${c2} .oossssso-````/ossssss+` | ||
${c2} -osssssso. :ssssssso. | ||
${c2} :osssssss/ osssso+++. | ||
${c2} /ossssssss/ +ssssooo/- | ||
${c2} `/ossssso+/:- -:/+osssso+- | ||
${c2} `+sso+:-` `.-/+oso: | ||
${c2} `++:. `-/+/ | ||
${c2} .` `/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
${c2} _,met$$$$$gg. | ||
${c2} ,g$$$$$$$$$$$$$$$P. | ||
${c2} ,g$$P" """Y$$.". | ||
${c2} ,$$P' `$$$. | ||
${c2}',$$P ,ggs. `$$b: | ||
${c2}`d$$' ,$P"' ${c1}.${c2} $$$ | ||
${c2} $$P d$' ${c1},${c2} $$P | ||
${c2} $$: $$. ${c1}-${c2} ,d$$' | ||
${c2} $$; Y$b._ _,d$P' | ||
${c2} Y$$. ${c1}`.${c2}`"Y$$$$P"' | ||
${c2} `$$b ${c1}"-.__ | ||
${c2} `Y$$ | ||
${c2} `Y$$. | ||
${c2} `$$b. | ||
${c2} `Y$$b. | ||
${c2} `"Y$b._ | ||
${c2} `""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
${c1} .',;::::;,'. | ||
${c1} .';:cccccccccccc:;,. | ||
${c1} .;cccccccccccccccccccccc;. | ||
${c1} .:cccccccccccccccccccccccccc:. | ||
${c1} .;ccccccccccccc;${c2}.:dddl:.${c1};ccccccc;. | ||
${c1} .:ccccccccccccc;${c2}OWMKOOXMWd${c1};ccccccc:. | ||
${c1}.:ccccccccccccc;${c2}KMMc${c1};cc;${c2}xMMc${c1};ccccccc:. | ||
${c1},cccccccccccccc;${c2}MMM.${c1};cc;${c2};WW:${c1};cccccccc, | ||
${c1}:cccccccccccccc;${c2}MMM.${c1};cccccccccccccccc: | ||
${c1}:ccccccc;${c2}oxOOOo${c1};${c2}MMM0OOk.${c1};cccccccccccc: | ||
${c1}cccccc;${c2}0MMKxdd:${c1};${c2}MMMkddc.${c1};cccccccccccc; | ||
${c1}ccccc;${c2}XM0'${c1};cccc;${c2}MMM.${c1};cccccccccccccccc' | ||
${c1}ccccc;${c2}MMo${c1};ccccc;${c2}MMW.${c1};ccccccccccccccc; | ||
${c1}ccccc;${c2}0MNc.${c1}ccc${c2}.xMMd${c1};ccccccccccccccc; | ||
${c1}cccccc;${c2}dNMWXXXWM0:${c1};cccccccccccccc:, | ||
${c1}cccccccc;${c2}.:odl:.${c1};cccccccccccccc:,. | ||
${c1}:cccccccccccccccccccccccccccc:'. | ||
${c1}.:cccccccccccccccccccccc:;,.. | ||
${c1} '::cccccccccccccc::;,. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
${c1} c.' | ||
${c1} ,xNMM. | ||
${c1} .OMMMMo | ||
${c1} lMM" | ||
${c1} .;loddo:. .olloddol;. | ||
${c1} cKMMMMMMMMMMNWMMMMMMMMMM0: | ||
${c2} .KMMMMMMMMMMMMMMMMMMMMMMMWd. | ||
${c2} XMMMMMMMMMMMMMMMMMMMMMMMX. | ||
${c3};MMMMMMMMMMMMMMMMMMMMMMMM: | ||
${c3}:MMMMMMMMMMMMMMMMMMMMMMMM: | ||
${c4}.MMMMMMMMMMMMMMMMMMMMMMMMX. | ||
${c4} kMMMMMMMMMMMMMMMMMMMMMMMMWd. | ||
${c5} 'XMMMMMMMMMMMMMMMMMMMMMMMMMMk | ||
${c5} 'XMMMMMMMMMMMMMMMMMMMMMMMMK. | ||
${c6} kMMMMMMMMMMMMMMMMMMMMMMd | ||
${c6} ;KMMMMMMMWXXWMMMMMMMk. | ||
${c6} "cooc*" "*coo'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
${c2} ...-:::::-... | ||
${c2} .-MMMMMMMMMMMMMMM-. | ||
.-MMMM${c1}`..-:::::::-..`${c2}MMMM-. | ||
.:MMMM${c1}.:MMMMMMMMMMMMMMM:.${c2}MMMM:. | ||
-MMM${c1}-M---MMMMMMMMMMMMMMMMMMM.${c2}MMM- | ||
`:MMM${c1}:MM` :MMMM:....::-...-MMMM:${c2}MMM:` | ||
:MMM${c1}:MMM` :MM:` `` `` `:MMM:${c2}MMM: | ||
.MMM${c1}.MMMM` :MM. -MM. .MM- `MMMM.${c2}MMM. | ||
:MMM${c1}:MMMM` :MM. -MM- .MM: `MMMM-${c2}MMM: | ||
:MMM${c1}:MMMM` :MM. -MM- .MM: `MMMM:${c2}MMM: | ||
:MMM${c1}:MMMM` :MM. -MM- .MM: `MMMM-${c2}MMM: | ||
.MMM${c1}.MMMM` :MM:--:MM:--:MM: `MMMM.${c2}MMM. | ||
:MMM${c1}:MMM- `-MMMMMMMMMMMM-` -MMM-${c2}MMM: | ||
:MMM${c1}:MMM:` `:MMM:${c2}MMM: | ||
.MMM${c1}.MMMM:--------------:MMMM.${c2}MMM. | ||
'-MMMM${c1}.-MMMMMMMMMMMMMMM-.${c2}MMMM-' | ||
'.-MMMM${c1}``--:::::--``${c2}MMMM-.' | ||
${c2} '-MMMMMMMMMMMMM-' | ||
${c2} ``-:::::-`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
${c1} ▗▄▄▄ ${c2}▗▄▄▄▄ ▄▄▄▖ | ||
${c1} ▜███▙ ${c2}▜███▙ ▟███▛ | ||
${c1} ▜███▙ ${c2}▜███▙▟███▛ | ||
${c1} ▜███▙ ${c2}▜██████▛ | ||
${c1} ▟█████████████████▙ ${c2}▜████▛ ${c1}▟▙ | ||
${c1} ▟███████████████████▙ ${c2}▜███▙ ${c1}▟██▙ | ||
${c2} ▄▄▄▄▖ ▜███▙ ${c1}▟███▛ | ||
${c2} ▟███▛ ▜██▛ ${c1}▟███▛ | ||
${c2} ▟███▛ ▜▛ ${c1}▟███▛ | ||
${c2}▟███████████▛ ${c1}▟██████████▙ | ||
${c2}▜██████████▛ ${c1}▟███████████▛ | ||
${c2} ▟███▛ ${c1}▟▙ ▟███▛ | ||
${c2} ▟███▛ ${c1}▟██▙ ▟███▛ | ||
${c2} ▟███▛ ${c1}▜███▙ ▝▀▀▀▀ | ||
${c2} ▜██▛ ${c1}▜███▙ ${c2}▜██████████████████▛ | ||
${c2} ▜▛ ${c1}▟████▙ ${c2}▜████████████████▛ | ||
${c1} ▟██████▙ ${c2}▜███▙ | ||
${c1} ▟███▛▜███▙ ${c2}▜███▙ | ||
${c1} ▟███▛ ▜███▙ ${c2}▜███▙ | ||
${c1} ▝▀▀▀ ▀▀▀▀▘ ${c2}▀▀▀▘ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
${c1} .-/+oossssoo+\-. | ||
${c1} ´:+ssssssssssssssssss+:` | ||
${c1} -+ssssssssssssssssssyyssss+- | ||
${c1} .ossssssssssssssssss${c2}dMMMNy${c1}sssso. | ||
${c1} /sssssssssss${c2}hdmmNNmmyNMMMMh${c1}ssssss\ | ||
${c1} +sssssssss${c2}hm${c1}yd${c2}MMMMMMMNddddy${c1}ssssssss+ | ||
${c1} /ssssssss${c2}hNMMM${c1}yh${c2}hyyyyhmNMMMNh${c1}ssssssss\ | ||
${c1}.ssssssss${c2}dMMMNh${c1}ssssssssss${c2}hNMMMd${c1}ssssssss. | ||
${c1}+ssss${c2}hhhyNMMNy${c1}ssssssssssss${c2}yNMMMy${c1}sssssss+ | ||
${c1}oss${c2}yNMMMNyMMh${c1}ssssssssssssss${c2}hmmmh${c1}ssssssso | ||
${c1}oss${c2}yNMMMNyMMh${c1}sssssssssssssshmmmh${c1}ssssssso | ||
${c1}+ssss${c2}hhhyNMMNy${c1}ssssssssssss${c2}yNMMMy${c1}sssssss+ | ||
${c1}.ssssssss${c2}dMMMNh${c1}ssssssssss${c2}hNMMMd${c1}ssssssss. | ||
${c1} \ssssssss${c2}hNMMM${c1}yh${c2}hyyyyhdNMMMNh${c1}ssssssss/ | ||
${c1} +sssssssss${c2}dm${c1}yd${c2}MMMMMMMMddddy${c1}ssssssss+ | ||
${c1} \sssssssssss${c2}hdmNNNNmyNMMMMh${c1}ssssss/ | ||
${c1} .ossssssssssssssssss${c2}dMMMNy${c1}sssso. | ||
${c1} -+sssssssssssssssss${c2}yyy${c1}ssss+- | ||
${c1} `:+ssssssssssssssssss+:` | ||
${c1} .-\+oossssoo+/-. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
${c2} ##### | ||
${c2} ####### | ||
${c2} ##${c1}O${c2}#${c1}O${c2}## | ||
${c2} #${c3}#####${c2}# | ||
${c2} ##${c1}##${c3}###${c1}##${c2}## | ||
${c2} #${c1}##########${c2}## | ||
${c2} #${c1}############${c2}## | ||
${c2} #${c1}############${c2}### | ||
${c3} ##${c2}#${c1}###########${c2}##${c3}# | ||
${c3}######${c2}#${c1}#######${c2}#${c3}###### | ||
${c3}#######${c2}#${c1}#####${c2}#${c3}####### | ||
${c3} #####${c2}#######${c3}##### |
Oops, something went wrong.