-
-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DietPi-Banner | Adds large style banner #5113
Conversation
Many thanks for your suggestion. Looks good, though I suggest to prompt an info and install Also, are there alternatives to figlet? I know toilet, which has some more features, including colours and unicode, though nothing we'd require here. I personally would prefer a native shell script so that no external binary needs to be called, also reading the hostname directly from |
If the decision is made to do 2, 3 or 4, can you point me at an example of "prompting an info" to install a package? |
In theory we could take the characters allowed in hostnames from the font matrix from here or similar open source scripts and put them into an own script to source or to call (so that it returns the output). The logic to concatenate the input character slices line by line is not too complicated. It has the benefit that we can tune each character as we like, change the style etc. I'd then simply go mono colour and in case allow to change it for the whole text block. Agreed that toilet brings much more dependencies and overhead which we do not need, to in case we stay with an external tool, I need to apply some fixes to existing features but will then do a quick port of that shell script and compare performance to |
Okay, I created a shell script now, much like yours, but with minimal logic for what we need + lower case characters: https://github.com/MichaIng/hacks/blob/main/dietpi-print_large Great idea to generate the character arrays with a script from figlet as well. I missed at first that you created an own fork of the original script with such a dedicated translator script. I adopted the idea as well, which can be used with other figlet-like tools or new characters when needed: https://github.com/MichaIng/hacks/blob/main/dietpi-figlet_to_shell Took a while until I got it performing significantly better than figlet itself. Since looping through
Little confusing since all is still pure internal bash syntax/commands. However, The script can be executed or sourced (all variables are declared as local ones, only the wrapper function remains declared in parent shell), in both cases printing the first input argument in large fonts and an error message instead if any invalid character is contained. So we can add it as dedicated script to DietPi, probably finding a further use our end or users may detect and find it useful. And for best performance it can then be sourced from dietpi-banner: . /boot/dietpi/func/dietpi-print_large "$(</etc/hostname)" Shall we implement it like that? Btw, the (small) |
This is great, yes to hostname being ommitted the second time. Would you like me to adapt the PR to use your new script? I think that would answer all feedback then, right? |
Yes please do so when you find time. With the maintainer edit tick set, I can edit scripts changed in this PR but not add new ones to your branch 😉.
Yes, as it's several times faster than |
Your script has been added, displacing Then I went onto making things more consistent and reconsidered some of our thoughts around hostname. The other two options aren't the same thing: the header uses short Looking at this, I changed the code in this PR to use At this point, thanks to your prompting, this feels like a tight & tidy patch. The only thing to consider now is: do we make it the default going forwards? |
I added a change so that the script is now sourced instead of executed, to skip the additional bash process spawn. Also Works great. I'm wondering whether the extra new line is required. Though when using EDIT: And now the small hostname is skipped when the large one is printed already. |
and fix accidentally swapped NIS/YP domainname with hostname
Lovely 🙂. You are right, with the extra newline it looks good in all cases, skipping that with some lower case characters it doesn't look nice. When using this option, obviously terminal height isn't a problem. One more think we may want to implement, is a better full font line break when terminal console is too small. This would basically mean to split the 6 output lines at console with, and if any line is too long, add array indices 7-11 with the overflow, or empty string. But usually hostnames are not that long, so let's skip this for now and add it in a future release if either users report related ugly line breaks or we are in mood to add the additional logic. |
Merging this now, we can tune at any time, e.g. as of feedback during beta phase which starts soon. |
- CHANGELOG | DietPi-Print_large: This new script has been added which can be executed or sourced from /boot/dietpi/func/dietpi-print_large to print the string passed via first argument in large figlet style fonts. It currently only supports the characters a-z, A-Z, 0-9, dot and dash, i.e. those commonly allowed in hostnames. - CHANGELOG | DietPi-Banner: Added an option to print the system's hostname in large figlet style fonts, right below the banner header. In case it is enabled as well, the regular/small hostname line will then be skipped. Many thanks to @matellis for implementing this feature: #5113
Changelog: e82e6ef |
Fix for feature request #5110
Status: Work in Progress
figlet
, simple changeCommit List
dietpi/func/dietpi_banner
| Adds large style banner to the top, configurable via the menu (as option 14)End Result