[ Merci-Libre ]
Check out the source code here.
A simple CLI program written in C to display system information, including CPU, Available Memory, and System Uptime. Designed for Linux Machines. Also can be set to display a customizable initialization prompt.
Concept
Inspired by Neofetch, I made scFetch to do everything I really needed from Neofetch— minus the unnecessary information that Neofetch provides. I designed scFetch to be as minimalist as possible.
I initially wrote the project in bash shell, which wasn't fast enough, so I co-wrote the whole thing with chatGPT in C just to expedite the process.
Building the project:
When I was first starting out, I had this idea of building a terminal program similar to neofetch that could fetch me system information, but had the ability to print random customized prompts. When I was first making this project, I initially just printed out my prompts line line by line INSIDE of the script, until I realized that I could just keep a file containing the prompt inside of a folder, and then print the file. I did this by first having an index file that would generate at run time, and each index would generate a number that would be associated for each file inside of the {config_path}/prompt directory. I then used a random number generator to select one of those indexed files and it would print the custom prompt to the screen. When I first got this to work I was happy with what it was able to accomplish, but since it was written in Bash script, it was just too slow for my liking.
So I rewrote it in C.
Rebuilding it
After about a year or so, I wanted to try my hand at the C programming language. I had never made a project written in C before, but I had the blueprint ready. So I decided that I would see what I generate from ChatGPT, and overtime build the project to my liking. It is my first ever project in C, so using AI to help learn the language actually helped me a lot to start out, and I can write entire projects now without my fellow robot assistance. Some key differences between the C version and the Shell version include:
The C version directly accesses Linux system files.
I had rewritten the uptime command as a function.
The indexing functionality can now just be done through a index inside of the program instead of using the file.
It's way faster— like 10ms faster.
The only 'real' parts that ChatGPT wrote were the file printing function, and the dynamic memory allocation tables that I had trouble learning initially. The rest of the code was written by me.