Also drop install.ps1 because it needs a full clone and still can not
install the new fonts. There are better Powershell alternatives.
Fixes: #1902
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
I guess people do not know this probably, or gloss over it when reading the readme.md.
We would need to throw together something new that maybe utilizes
bin/scripts/fetch-archives.sh
But then, cloning the repo is no good idea in any situation. And how would
people get the new script without cloning. Not sure it's worth it.
Lets see if people complain with this warning.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We want to have this scripts working with the standard MacOS bash, which
is an ancient version 3.
[how]
Change the shebang to `sh` and use checkbashisms and shellcheck.
Afterwards change to `bash` again. See note in the code about
exceptions:
# This script must run with bash 3
# In fact it is checked against `checkbashisms` and no bashisms are
# used, except (because the workarounds are too involved):
#
# - <( ) process substitution
# - read -d option
# - $'\0' to supply a nullbyte to read -d
# - <<< here-string
See also https://askubuntu.com/questions/1059265/whats-the-problem-with-bashisms
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
At the moment we have every font only in one format (ttf or otf), so the
preference option does not do much (does not do anything).
Anyhow, it was there before and maybe at some point we take the multiple
formats up again, and then we are prepared.
[how]
Instead of the previous solution to search for all formats and then try
to remove the duplicates we search first for the desired format and if
we find not one font we search for the other format. This is slightly
different but the outcome is the same.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Vanilla MacOS has just some very old bash 3 installed by default. People
might want to use the install.sh, but not install a newer bash (via
Homebrew for example).
[how]
The `nerdfonts_dirs` array is replaced by a normal bash variable (string)
where the directories are '/' separated. Because there are never
subdirectories in the list but only direct children of 'patched-fonts/'
it is possible to use slash as unique and out-of-band separator.
The `fonts` array is replaced by a function that delivers the list of
files in null-byte separated form. That means we can not manipulate the
list and thus the duplicate checking is dropped. As we do not have any
font in both formats (anymore) it will never happen anyhow.
Dropping the duplicates check also removes the extension preference
option functionality. We keep the now defunct option, though.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Pull some common code out of a nested double case into a function.
That makes the code much more readable (for me).
Also simplify find expression.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
There is some risk that an arbitrary command can be smuggled in and
possibly executed with root rights in some situations.
See PR #1861.
[how]
Use xargs instead of eval to store the predefined filter arguments (that
come as one string) into individual arguments of the find command.
Reported-by: Nick Brady <nbgeniu1@gmail.com>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
There are three possible options to specify the Nerd Font Mono generation:
-s
--mono
--use-single-width-glyphs
All the three are handled the same.
In order to add a new long option that also handles glyph width in a "single"
cell manner the fear is that two too similar options will confuse users.
[how]
Just hide the longest form.
Also remove from the readme files.
Need to adapt the install.sh script.
(The option still works but is not 'advertised'.)
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
When a user sets the XDG_DATA_HOME environment variable the default of
$HOME/.local/share should not be used.
https://wiki.archlinux.org/title/XDG_Base_Directory
[how]
Enable XDG_DATA_HOME to override the default user data directory on Unix
and MacOS platforms.
There is some controversy if XDG_DATA_HOME should be honored on MacOS,
see for example platformdirs (link below). But me also working on Linux
and MacOS (and Windows) in parallel, I can not quite follow the
downsides and believe we should allow XDG_DATA_HOME also for MacOS.
Related: https://github.com/platformdirs/platformdirs/issues/4Fixes: #1324
Suggested-by: Anthony Foglia <@afoglia>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The install script does not install anything after the 3.0.0 release.
[how]
Throw away all the (unused) patches stuff.
Throw away the compat stuff.
Introduce clean find patterns for all three Nerd Font variants.
Use them depending on the user's desire - also adding an option to
install the new proportional variants.
Additionally throw an error when we did not find any file (instead of
just failing in obscure ways).
[note]
Also output version number on runs.
Also remove some unused options in getopts.
Fixes: #1183
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
I can not fix the script right now, this is postponed.
But still it should tell users that something is amiss.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The implode function can not work correctly because the bash pattern
expansion inserts blanks in unexpected places.
[how]
Use a dump loop instead of being smart.
Fixes: #280
Reported-by: Geoffrey Biggs <gbiggs>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
I'm not sure why it has been in the code like this, and I removed these
strange globs already before in some places [1].
find -name "*.[o,t]tf"
actually allows
*.otf
*.ttf
*.,tf
[how]
Remove spurious comma in all `find` calls.
Systematically.
[note]
Just some commits mentioned here:
2ace3de8e7722458821ac6817bc729e2
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Maybe people would like to uninstall the fonts installed with the
script.
In fact the uninstall could already be acieved by giving the --clean
option and installing no new font. Well, apart from the fact that the
scripts prevents runs with no installed font. And then the user must
specify the same installpath that has been used for the install, which
is a bit tedious.
[how]
Add new command '--remove' (with no short option).
Make -L / --list option a dry-run option for --remove.
Uninstall both possible installpaths.
Fixes: #407
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We have only 'Complete' in the repo anymore, so it does not make sense
to provide commands to select un-complete patched fonts.
[how]
Leave stub/comment in so that - if there ever is a need to resurrect the
feature - one can find this commit and the deleted code.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Installation would fail if you did not first cd in into the nerd-fonts
directory before running install.sh as $nerdfonts_root_dir referenced
${PWD} which is the path your shell is into when calling the script,
not the basepath of the script, parent of "patched-fonts".
It now has more options than copying all patched files or one font’s
patched font files.
In short, you can choose which patchset, which compatibility, which
method (copy or symlink), and which fonts you want to install.