andresgongora / synth-shell Goto Github PK
View Code? Open in Web Editor NEWBoost your terminal, script by script
License: GNU General Public License v3.0
Boost your terminal, script by script
License: GNU General Public License v3.0
After #24 gets done, we need ways to check what programs are there, and then properly use them. I will gather code snippets to here in later comments.
Now the new sys load average that shows "current load" / "available processing units" rounds the "load" number to nearest integer. This isn't too helpful in load context (like it was as percentage figure). Let's change the value from X / Z
to X.YY / Z
to reflect how "load" value works .
Currently getSysDate() has hardcoded value of "%Y.%m.%d - %T"
. This should be also user configurable at config-file.
Most scripts have some sort of internal configuration section, mostly for color schemes and such. It should be possible to optionally allow the user to extract said configuration to an external file (i.e. inside ~/.config) such that the script remains the same for all deployments, but may be configured as needed between different machines (i.e. different color schemes depending on the host).
Thus, I need a config reading script that, when invoked from an external scipt can either:
Thus, sse a mechanism like $var = config_get KEYWORD OPTIONAL_CONFIG_FILE; where it searches in the optional file (if non specified, use current file) and returns the value of said keyword.
All variables that are displayed should be "provided" by a function with the appropriate name, instead of being stored in variables.
That way, we can easily add extra functionality in a modular and salable fashion. For example, a function called getExternalIP
might do several checks to find the best tool to get the IP instead of resorting only to dig
or wget
(as suggested by @olmari ).
This also helps with #20
Most scripts don't clean up after them self and leave lots of variables inside the user's session. Fix this with local variables or unsetting variables that are no longer used.
Right now, when looking at the repo, it's impossible to tell what it does... I probably wouldn't pay much attention to this repo if I stumbled upon it by chance. This must be fixed :P
Right now it's a mess to change the configuration files. The user must really know what she is doing. I think that the configuration files should be in a more logical location.
Where did the actual load-figure went? :P At least develop branch is now not curent vompared to master :)
Currently, the CPU percentage is shown as the average of the last minute. This is meant to avoid showing the spike of loading up a terminal and such. I suggest the following changes:
But beware of breaking CPU_CRIT
alarm. With 8 cores, if one of them is at 100% because some program is doing nasty stuff, but the rest is idle, the average load would still seem to be below 13%. This requires to think everything through.
Maybe replace the bar all together with something different?? (it must still fit in a single line)
@olmari I've noticed a bug causing logo padding not to work as expected. I will fix it ASAP
ls
is not always under /bin/usr/
. The script should search for ls
under different folders (maybe iteratively?) until it finds the correct executable; then, it should store the path to said executable in a variable and from there on use that variable for the rest of the script.
status.sh
color.sh
alias.sh
color.sh
to status.sh
color.sh
and config.sh
to fancy-bash-prompt.sh
With colors (like in my dotfiles) and tags (e.g. in front of the text, explaining what the message implies)
The script status.sh doesn't work properly for me. It hangs at the very part of the script, where it is looking for OS information. The command "cat /etc/*-release" works fine by itself though, so I guess something is wrong with how my system is interpreting the bash script. Any advice?
I know I can just ctrl-c and stop it, but I'd like to actually see the script run the way it is supposed to.
Not very descriptive - but I have the idea in my head ;)
If I call 'exit 1', all echos are ignored, even though I want to print them to tell the user what went wrong
Create a small text file with basic coding style guides for this project - mostly a reference for myself to be more constant and uniform between scripts, but also as a guide for new developers who might want to join this project.
The goal is not to come up with a complete guide, but to start small and gradually add more content as we see fit.
Add a menu script that allows me to run some extra diagnostics, or by default (hitting enter), go into a simple terminal. Said options could include stuff like:
More ideas:
This is just an idea, but how about this:
Depends on #9
I still don't know the exact cause. It only happens when invoking the script from within bashrc. When calle up manually it works perfectly.
For example, ls
should become 'ls'
to protect against aliases
To anyone reading this: Feel free to paste here your configuration files. I will add them and cite you as their original author
fancy-bash-prompt.sh
status.sh
There is an issue for lower MAX_DIGITS values. For instance, if the HDD has 56GB capacity, and 43GB used, it will show as follows:
MAX_DIGITS=5
leads to 43/56 GBMAX_DIGITS=4
leads to 4/56 GB - INCORRECTMost of my scripts rely on colors for aesthetically purposes. Instead of replicating the code in each file, create a single script that takes care of either creating returning color command tags (to be added to a string) or to return "colorized" strings (to be then printed or concatenated).
Recognize terminal color compatibility, and adjust properly. If terminal is B&W, then it should apply no colors.
Intuitive, verbose and explicit
CLip the logo instead of the informative utput if the terminal is too small
Once #9 is done, create a AUR package
This error was reported by drqxr
bash: printf: `Y': invalid format character
which: no dig in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
which: no nslookup in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
Ass soon as all the fixes are implemented on my PC, I will push them to the github repo.
Sort scripts into sub-folders depending on functionality. For example, separate scripts meant to "improve" the terminal experience from those meant to aid in system maintenance or simple utility scripts.
Allow everyone looking into this repo to recognize what each script does. Add a table with the scripts name and its main utility in 1-2 sentences
'terminal/status.sh' seems to have some minor compatibility issues with other distros.
Make logo drawing separate function and do that first, then at separate function draw statusdata lines. This way logo is easier to manage, especially if smaller than maximum lines, and then if terminal windows is too small to fit all the status data we can more easily to cut our way into the logo area.
We can use ANSI escape characters to actiave that, more info at https://unix.stackexchange.com/questions/210325/posix-command-that-moves-cursor-to-specific-position-in-terminal-window
This would also take care/include #42
Also here is very simple test in terminal, I made few lines of positioned text, and then on next command I used overlapping position:
Instead of setting font color, background end effect separately, do it instead as in status.sh
Add installation scripts that take care of copying everything into place, and if possible, an AUR script, for:
Create a utility script that can be called from the other scripts such that I can adapt the path of the code depending on the distro. For instance, the following code is very common in my scripts. It could be converted to a simple function.
## GET LOCATION OF TREE COMMAND -> Check for all possible locations
if [ -f "/usr/bin/tree" ]; then
TREE="/usr/bin/tree"
elif [ -f "/bin/tree" ]; then
TREE="/bin/tree"
else
echo "tree command not found"
fi
alias tree="$TREE --dirsfirst -C"
Some commands, like dig
, might not be present on the user's system.
Either make them a dependency, or make it such that the script just skips them without breaking. Alternatively, see what commands DO usually exist and use them instead.
Depends on #39
As of now, it failed logic values:
param_name true # Comment
@olmari you have more experience. Would it be a good idea? I mean, this way our work could become a "bunch of script" solely aimed at improving the terminal experience; instead of a collection of loose scripts. Also, the installer only installs status and fancy anyway...
Problem is. Can I rename this repo?
common.*
script to print and prompt with beautiful texts and colorsAdvantage: no user environment contamination with function names and variables
Disadvantages: the script must be ensured to be executables. This was not needed because bashrc is an executable and took care of the "permissions" for us.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.