mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-31 12:27:22 +02:00
ShellCheck fixes WIP (related to #120)
This commit is contained in:
parent
e8cf985c63
commit
338b0c6bdc
@ -9,6 +9,6 @@ echo "dir $dir"
|
|||||||
"${dir}/autohint.sh" "$fontfile"
|
"${dir}/autohint.sh" "$fontfile"
|
||||||
"${dir}/../fpfix.py" "$fontfile"
|
"${dir}/../fpfix.py" "$fontfile"
|
||||||
|
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
printf "[Nerd Fonts] Post Processed Hack '%s'\n" "$fontfile"
|
printf "[Nerd Fonts] Post Processed Hack '%s'\\n" "$fontfile"
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# version: 1.2.0
|
# version: 1.2.0
|
||||||
# Generates CSS file for the font
|
# Generates CSS file for the font
|
||||||
|
|
||||||
|
# shellcheck disable=SC1091
|
||||||
source ./lib/i_all.sh
|
source ./lib/i_all.sh
|
||||||
|
|
||||||
output_css_file="../../css/nerd-fonts-generated.css"
|
output_css_file="../../css/nerd-fonts-generated.css"
|
||||||
@ -11,17 +12,17 @@ LINE_PREFIX="# [Nerd Fonts] "
|
|||||||
version="1.2.0"
|
version="1.2.0"
|
||||||
|
|
||||||
# clear files
|
# clear files
|
||||||
> "$output_css_file" 2> /dev/null
|
true > "$output_css_file" 2> /dev/null
|
||||||
> "$output_cheat_sheet_file" 2> /dev/null
|
true > "$output_cheat_sheet_file" 2> /dev/null
|
||||||
|
|
||||||
# describe how the classes were established
|
# describe how the classes were established
|
||||||
{
|
{
|
||||||
printf "/*\n"
|
printf "/*\\n"
|
||||||
printf " *%s Website: https://www.nerdfonts.com\n" "$LINE_PREFIX"
|
printf " *%s Website: https://www.nerdfonts.com\\n" "$LINE_PREFIX"
|
||||||
printf " *%s Development Website: https://github.com/ryanoasis/nerd-fonts\n" "$LINE_PREFIX"
|
printf " *%s Development Website: https://github.com/ryanoasis/nerd-fonts\\n" "$LINE_PREFIX"
|
||||||
printf " *%s Version: %s\n" "$LINE_PREFIX" "$version"
|
printf " *%s Version: %s\\n" "$LINE_PREFIX" "$version"
|
||||||
printf " *%s The following is generated from the build script\n" "$LINE_PREFIX"
|
printf " *%s The following is generated from the build script\\n" "$LINE_PREFIX"
|
||||||
printf " */\n\n"
|
printf " */\\n\\n"
|
||||||
# add top section of CSS
|
# add top section of CSS
|
||||||
cat $header_css_file
|
cat $header_css_file
|
||||||
} >> "$output_css_file"
|
} >> "$output_css_file"
|
||||||
@ -49,25 +50,25 @@ for var in "${!i@}"; do
|
|||||||
# generate css rules
|
# generate css rules
|
||||||
{
|
{
|
||||||
printf ".nf-%s:before, .nerd-font-%s:before, .nerd-fonts-%s:before {" "$glyph_name" "$glyph_name" "$glyph_name"
|
printf ".nf-%s:before, .nerd-font-%s:before, .nerd-fonts-%s:before {" "$glyph_name" "$glyph_name" "$glyph_name"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
printf " content: \"\%s\";" "$glyph_code"
|
printf " content: \"\\%s\";" "$glyph_code"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
printf "}"
|
printf "}"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
} >> "$output_css_file"
|
} >> "$output_css_file"
|
||||||
|
|
||||||
# generate HTML cheat sheet
|
# generate HTML cheat sheet
|
||||||
{
|
{
|
||||||
printf "<div class=\"column\">"
|
printf "<div class=\"column\">"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
printf " <div class=\"nerd-font nerd-font-%s center\"></div>" "$glyph_name"
|
printf " <div class=\"nerd-font nerd-font-%s center\"></div>" "$glyph_name"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
printf " <span>nf-%s <br/>(%s)</span>" "$glyph_name" "$glyph_code"
|
printf " <span>nf-%s <br/>(%s)</span>" "$glyph_name" "$glyph_code"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
printf "</div>"
|
printf "</div>"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
} >> "$output_cheat_sheet_file"
|
} >> "$output_cheat_sheet_file"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Generated CSS and Cheat Sheet HTML\n"
|
printf "Generated CSS and Cheat Sheet HTML\\n"
|
||||||
|
@ -18,7 +18,7 @@ cd $unpatched_parent_dir || {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# clear output file (needed for multiple runs or updates):
|
# clear output file (needed for multiple runs or updates):
|
||||||
> "$to" 2> /dev/null
|
true > "$to" 2> /dev/null
|
||||||
|
|
||||||
# add to the file
|
# add to the file
|
||||||
{
|
{
|
||||||
@ -60,6 +60,6 @@ done
|
|||||||
|
|
||||||
# add to the file
|
# add to the file
|
||||||
{
|
{
|
||||||
printf "\n</fontconfig>\n"
|
printf "\\n</fontconfig>\\n"
|
||||||
} >> "$to"
|
} >> "$to"
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# version: 1.2.0
|
# version: 1.2.0
|
||||||
|
|
||||||
# used for debugging
|
# used for debugging
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
# for executing script to rebuild JUST the readmes:
|
# for executing script to rebuild JUST the readmes:
|
||||||
# ./gotta-patch-em-all-font-patcher\!.sh "" info
|
# ./gotta-patch-em-all-font-patcher\!.sh "" info
|
||||||
@ -75,9 +75,11 @@ function patch_font {
|
|||||||
# source the font config file if exists:
|
# source the font config file if exists:
|
||||||
if [ -f "$config_dir/config.cfg" ]
|
if [ -f "$config_dir/config.cfg" ]
|
||||||
then
|
then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$config_dir/config.cfg"
|
source "$config_dir/config.cfg"
|
||||||
elif [ -f "$config_parent_dir/config.cfg" ]
|
elif [ -f "$config_parent_dir/config.cfg" ]
|
||||||
then
|
then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$config_parent_dir/config.cfg"
|
source "$config_parent_dir/config.cfg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -88,13 +90,15 @@ function patch_font {
|
|||||||
post_process=""
|
post_process=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
# we know the '$config_has_powerline' is from the sourced file
|
||||||
if [ "$config_has_powerline" ]
|
if [ "$config_has_powerline" ]
|
||||||
then
|
then
|
||||||
powerline=""
|
powerline=""
|
||||||
combinations=$(printf "./font-patcher ${f##*/} %s\n" {' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
combinations=$(printf "./font-patcher ${f##*/} %s\\n" {' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
||||||
else
|
else
|
||||||
powerline="--powerline"
|
powerline="--powerline"
|
||||||
combinations=$(printf "./font-patcher ${f##*/} %s\n" {' --powerline',}{' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
combinations=$(printf "./font-patcher ${f##*/} %s\\n" {' --powerline',}{' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$parent_dir" || {
|
cd "$parent_dir" || {
|
||||||
@ -138,19 +142,21 @@ function generate_info {
|
|||||||
# source the font config file if exists:
|
# source the font config file if exists:
|
||||||
if [ -f "$config_dir/config.cfg" ]
|
if [ -f "$config_dir/config.cfg" ]
|
||||||
then
|
then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$config_dir/config.cfg"
|
source "$config_dir/config.cfg"
|
||||||
elif [ -f "$config_parent_dir/config.cfg" ]
|
elif [ -f "$config_parent_dir/config.cfg" ]
|
||||||
then
|
then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$config_parent_dir/config.cfg"
|
source "$config_parent_dir/config.cfg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$config_has_powerline" ]
|
if [ "$config_has_powerline" ]
|
||||||
then
|
then
|
||||||
powerline=""
|
powerline=""
|
||||||
combinations=$(printf "./font-patcher ${f##*/} %s\n" {' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
combinations=$(printf "./font-patcher ${f##*/} %s\\n" {' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
||||||
else
|
else
|
||||||
powerline="--powerline"
|
powerline="--powerline"
|
||||||
combinations=$(printf "./font-patcher ${f##*/} %s\n" {' --powerline',}{' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
combinations=$(printf "./font-patcher ${f##*/} %s\\n" {' --powerline',}{' --use-single-width-glyphs',}{' --windows',}{' --fontawesome',}{' --octicons',}{' --fontlinux',}{' --pomicons',}{' --powerlineextra',}{' --fontawesomeextension',}{' --powersymbols',})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
font_families_count=$((font_families_count+1))
|
font_families_count=$((font_families_count+1))
|
||||||
@ -184,7 +190,7 @@ function generate_readme {
|
|||||||
local font_info="$patched_font_dir/font-info.md"
|
local font_info="$patched_font_dir/font-info.md"
|
||||||
|
|
||||||
# clear output file (needed for multiple runs or updates):
|
# clear output file (needed for multiple runs or updates):
|
||||||
> "$combinations_filename"
|
true > "$combinations_filename"
|
||||||
|
|
||||||
if [ -f "$font_info" ];
|
if [ -f "$font_info" ];
|
||||||
then
|
then
|
||||||
@ -202,16 +208,16 @@ function generate_readme {
|
|||||||
# add to the file
|
# add to the file
|
||||||
{
|
{
|
||||||
printf "\`\`\`sh"
|
printf "\`\`\`sh"
|
||||||
printf "\n# %s Possible Combinations:\n" "$combination_count"
|
printf "\\n# %s Possible Combinations:\\n" "$combination_count"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
printf "%s" "$combinations"
|
printf "%s" "$combinations"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
printf "\`\`\`"
|
printf "\`\`\`"
|
||||||
} >> "$combinations_filename"
|
} >> "$combinations_filename"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! $info_only ]
|
if [ ! "$info_only" ]
|
||||||
then
|
then
|
||||||
# Iterate through source fonts
|
# Iterate through source fonts
|
||||||
for i in "${!source_fonts[@]}"
|
for i in "${!source_fonts[@]}"
|
||||||
@ -227,7 +233,7 @@ then
|
|||||||
# however we want to run a certain number in parallel to decrease
|
# however we want to run a certain number in parallel to decrease
|
||||||
# the amount of time patching all the fonts will take
|
# the amount of time patching all the fonts will take
|
||||||
# for now set a 'wait' for each X set of processes:
|
# for now set a 'wait' for each X set of processes:
|
||||||
if [[ $(($i % $max_parallel_process)) == 0 ]];
|
if [[ $((i % max_parallel_process)) == 0 ]];
|
||||||
then
|
then
|
||||||
echo "$LINE_PREFIX Complete Variation Count after max parallel process is $complete_variation_count"
|
echo "$LINE_PREFIX Complete Variation Count after max parallel process is $complete_variation_count"
|
||||||
wait
|
wait
|
||||||
@ -259,11 +265,11 @@ dt3=$(echo "$dt2-3600*$dh" | bc)
|
|||||||
dm=$(echo "$dt3/60" | bc)
|
dm=$(echo "$dt3/60" | bc)
|
||||||
ds=$(echo "$dt3-60*$dm" | bc)
|
ds=$(echo "$dt3-60*$dm" | bc)
|
||||||
|
|
||||||
printf "$LINE_PREFIX Total runtime: %d:%02d:%02d:%02d\n" "$dd" "$dh" "$dm" "$ds"
|
printf "$LINE_PREFIX Total runtime: %d:%02d:%02d:%02d\\n" "$dd" "$dh" "$dm" "$ds"
|
||||||
|
|
||||||
printf "# All fonts patched to sub-directories in \t\t\t'%s'\n" "$patched_parent_dir"
|
printf "# All fonts patched to sub-directories in \\t\\t\\t'%s'\\n" "$patched_parent_dir"
|
||||||
printf "# The total number of font typefaces patched was \t\t'%s'\n" "$font_typefaces_count"
|
printf "# The total number of font typefaces patched was \\t\\t'%s'\\n" "$font_typefaces_count"
|
||||||
printf "# The total number of font families patched was \t\t'%s'\n" "$font_families_count"
|
printf "# The total number of font families patched was \\t\\t'%s'\\n" "$font_families_count"
|
||||||
printf "# The total number of 'complete' patched fonts created was \t'%s'\n" "$complete_variation_count"
|
printf "# The total number of 'complete' patched fonts created was \\t'%s'\\n" "$complete_variation_count"
|
||||||
printf "# The total number of 'variation' patched fonts created was \t'%s'\n" "$total_variation_count"
|
printf "# The total number of 'variation' patched fonts created was \\t'%s'\\n" "$total_variation_count"
|
||||||
printf "# The total number of patched fonts created was \t\t'%s'\n" "$total_count"
|
printf "# The total number of patched fonts created was \\t\\t'%s'\\n" "$total_count"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
for i in $(dirname "${BASH_SOURCE[0]:-$0}")/i_{dev,fae,fa,iec,linux,oct,ple,pom,seti}.sh; do
|
for i in $(dirname "${BASH_SOURCE[0]:-$0}")/i_{dev,fae,fa,iec,linux,oct,ple,pom,seti}.sh; do
|
||||||
|
# shellcheck source=/dev/null
|
||||||
test -f "$i" -a -r "$i" && source "$i"
|
test -f "$i" -a -r "$i" && source "$i"
|
||||||
done
|
done
|
||||||
unset i
|
unset i
|
||||||
|
@ -24,7 +24,7 @@ function appendRfnInfo {
|
|||||||
then
|
then
|
||||||
# add to the file
|
# add to the file
|
||||||
{
|
{
|
||||||
printf "\n## Why \`%s\` and not \`%s\`?\n" "$config_rfn_substitue" "$config_rfn"
|
printf "\\n## Why \`%s\` and not \`%s\`?\\n" "$config_rfn_substitue" "$config_rfn"
|
||||||
cat "$working_dir/../../src/readme-rfn-addendum.md"
|
cat "$working_dir/../../src/readme-rfn-addendum.md"
|
||||||
} >> "$to"
|
} >> "$to"
|
||||||
fi
|
fi
|
||||||
@ -35,7 +35,7 @@ function clearDestination {
|
|||||||
local to=$1; shift
|
local to=$1; shift
|
||||||
[[ -d "$to_dir" ]] || mkdir -p "$to_dir"
|
[[ -d "$to_dir" ]] || mkdir -p "$to_dir"
|
||||||
# clear output file (needed for multiple runs or updates):
|
# clear output file (needed for multiple runs or updates):
|
||||||
> "$to" 2> /dev/null
|
true > "$to" 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
#find ./ProFont -type d | # uncomment to test 1 font (with txt)
|
#find ./ProFont -type d | # uncomment to test 1 font (with txt)
|
||||||
@ -67,6 +67,7 @@ do
|
|||||||
# source the font config file if exists:
|
# source the font config file if exists:
|
||||||
if [ -f "$searchdir/config.cfg" ]
|
if [ -f "$searchdir/config.cfg" ]
|
||||||
then
|
then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$searchdir/config.cfg"
|
source "$searchdir/config.cfg"
|
||||||
else
|
else
|
||||||
# reset the variables
|
# reset the variables
|
||||||
@ -145,7 +146,7 @@ do
|
|||||||
clearDestination "$to_dir" "$to"
|
clearDestination "$to_dir" "$to"
|
||||||
|
|
||||||
{
|
{
|
||||||
printf "# %s\n\n" "$base_directory"
|
printf "# %s\\n\\n" "$base_directory"
|
||||||
} >> "$to"
|
} >> "$to"
|
||||||
|
|
||||||
appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$PWD" "$to"
|
appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$PWD" "$to"
|
||||||
|
@ -27,6 +27,8 @@ function print-decimal-unicode-range() {
|
|||||||
|
|
||||||
# add fillers to array to maintain table:
|
# add fillers to array to maintain table:
|
||||||
if [[ "$leftoverSpaces" < "$wrapAt" ]]; then
|
if [[ "$leftoverSpaces" < "$wrapAt" ]]; then
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
# needs rework without 'i' var?
|
||||||
for i in $(seq 1 $leftoverSpaces); do
|
for i in $(seq 1 $leftoverSpaces); do
|
||||||
originalSequence+=(0)
|
originalSequence+=(0)
|
||||||
done
|
done
|
||||||
@ -34,15 +36,16 @@ function print-decimal-unicode-range() {
|
|||||||
|
|
||||||
local sequenceLength=${#originalSequence[@]}
|
local sequenceLength=${#originalSequence[@]}
|
||||||
|
|
||||||
printf "%b\n" "$topLine"
|
printf "%b\\n" "$topLine"
|
||||||
|
|
||||||
for decimalCode in "${originalSequence[@]}"; do
|
for decimalCode in "${originalSequence[@]}"; do
|
||||||
local hexCode=$(printf '%x' "${decimalCode}")
|
local hexCode
|
||||||
|
hexCode=$(printf '%x' "${decimalCode}")
|
||||||
local code="${hexCode}"
|
local code="${hexCode}"
|
||||||
local char="\u${hexCode}"
|
local char="\\u${hexCode}"
|
||||||
|
|
||||||
# fill in placeholder cells properly formatted:
|
# fill in placeholder cells properly formatted:
|
||||||
if [ "${char}" = "\u0" ]; then
|
if [ "${char}" = "\\u0" ]; then
|
||||||
char=" "
|
char=" "
|
||||||
code=" "
|
code=" "
|
||||||
fi
|
fi
|
||||||
@ -63,12 +66,12 @@ function print-decimal-unicode-range() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%b%b%b" "$bar" "$allCodes" "$reset_color"
|
printf "%b%b%b" "$bar" "$allCodes" "$reset_color"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
printf "%b%b%b" "$bar" "$allChars" "$reset_color"
|
printf "%b%b%b" "$bar" "$allChars" "$reset_color"
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
|
|
||||||
if [ "$counter" != "$sequenceLength" ]; then
|
if [ "$counter" != "$sequenceLength" ]; then
|
||||||
printf "%b\n" "$line"
|
printf "%b\\n" "$line"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
allCodes=""
|
allCodes=""
|
||||||
@ -77,7 +80,7 @@ function print-decimal-unicode-range() {
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "%b\n" "$bottomLine"
|
printf "%b\\n" "$bottomLine"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,14 +6,22 @@ text2='Nerd Fonts'
|
|||||||
leftSymbolsCodes=('E0B0' 'E0B4' 'E0B8' 'E0BC' 'E0C0' 'E0C4' 'E0C6' 'E0C8' 'E0CC' 'E0CE' 'E0CF' 'E0CF' 'E0D1' 'E0D2')
|
leftSymbolsCodes=('E0B0' 'E0B4' 'E0B8' 'E0BC' 'E0C0' 'E0C4' 'E0C6' 'E0C8' 'E0CC' 'E0CE' 'E0CF' 'E0CF' 'E0D1' 'E0D2')
|
||||||
rightSymbolsCodes=('E0B2' 'E0B6' 'E0BA' 'E0BE' 'E0C2' 'E0C5' 'E0C7' 'E0C8' 'E0CC' 'E0CE' 'E0CF' 'E0CF' 'E0D1' 'E0D4')
|
rightSymbolsCodes=('E0B2' 'E0B6' 'E0BA' 'E0BE' 'E0C2' 'E0C5' 'E0C7' 'E0C8' 'E0CC' 'E0CE' 'E0CF' 'E0CF' 'E0D1' 'E0D4')
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
# don't check unused vars we might want to use them later on
|
||||||
colorReset='\033[0m'
|
colorReset='\033[0m'
|
||||||
colorBgWhite='\033[107m'
|
colorBgWhite='\033[107m'
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
# don't check unused vars we might want to use them later on
|
||||||
colorBgLightBlue='\033[104m' # light blue, bright green is 102
|
colorBgLightBlue='\033[104m' # light blue, bright green is 102
|
||||||
colorBgBlack='\033[40m'
|
colorBgBlack='\033[40m'
|
||||||
colorBg1='\033[100m'
|
colorBg1='\033[100m'
|
||||||
colorBg2=$colorBgBlack
|
colorBg2=$colorBgBlack
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
# don't check unused vars we might want to use them later on
|
||||||
colorFgLightBlue='\033[94m'
|
colorFgLightBlue='\033[94m'
|
||||||
colorFgLightGray='\033[90m'
|
colorFgLightGray='\033[90m'
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
# don't check unused vars we might want to use them later on
|
||||||
colorFgLightYellow='\033[93m'
|
colorFgLightYellow='\033[93m'
|
||||||
colorFgBlack='\033[30m'
|
colorFgBlack='\033[30m'
|
||||||
colorFg1=$colorFgBlack
|
colorFg1=$colorFgBlack
|
||||||
@ -23,18 +31,18 @@ colorBgDefault='\033[49m'
|
|||||||
echo -e "$colorReset Nerd Fonts :: Testing Powerline Symbol size and alignment"
|
echo -e "$colorReset Nerd Fonts :: Testing Powerline Symbol size and alignment"
|
||||||
|
|
||||||
for i in "${!leftSymbolsCodes[@]}"; do
|
for i in "${!leftSymbolsCodes[@]}"; do
|
||||||
symbol="\u${leftSymbolsCodes[$i]}"
|
symbol="\\u${leftSymbolsCodes[$i]}"
|
||||||
symbol2="\u${rightSymbolsCodes[$i]}"
|
symbol2="\\u${rightSymbolsCodes[$i]}"
|
||||||
code="${leftSymbolsCodes[$i]}"
|
code="${leftSymbolsCodes[$i]}"
|
||||||
code2="${rightSymbolsCodes[$i]}"
|
code2="${rightSymbolsCodes[$i]}"
|
||||||
|
|
||||||
if [ "$code" = "$code2" ]; then
|
if [ "$code" = "$code2" ]; then
|
||||||
symbol2="\u${rightSymbolsCodes[0]}"
|
symbol2="\\u${rightSymbolsCodes[0]}"
|
||||||
code2='None'
|
code2='None'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "$colorBg1$colorFg1$text1 $code $colorFg2$colorBg2$symbol $text2 $colorFg1$colorBgDefault$symbol -- $colorFg1$colorBgDefault$symbol2$colorFg2$colorBg2 $text2 $symbol2$colorBg1$colorFg1 $code2 $colorReset$colorBgWhite\n$colorReset"
|
echo -e "$colorBg1$colorFg1$text1 $code $colorFg2$colorBg2$symbol $text2 $colorFg1$colorBgDefault$symbol -- $colorFg1$colorBgDefault$symbol2$colorFg2$colorBg2 $text2 $symbol2$colorBg1$colorFg1 $code2 $colorReset$colorBgWhite\\n$colorReset"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "\n"
|
printf "\\n"
|
||||||
|
@ -6,13 +6,13 @@ echo "Click to start"
|
|||||||
# Window geometry
|
# Window geometry
|
||||||
# source: https://www.maketecheasier.com/record-screen-as-animated-gif-ubuntu/
|
# source: https://www.maketecheasier.com/record-screen-as-animated-gif-ubuntu/
|
||||||
XWININFO=$(xwininfo)
|
XWININFO=$(xwininfo)
|
||||||
read X < <(awk -F: '/Absolute upper-left X/{print $2}' <<< "$XWININFO")
|
read -r X < <(awk -F: '/Absolute upper-left X/{print $2}' <<< "$XWININFO")
|
||||||
read Y < <(awk -F: '/Absolute upper-left Y/{print $2}' <<< "$XWININFO")
|
read -r Y < <(awk -F: '/Absolute upper-left Y/{print $2}' <<< "$XWININFO")
|
||||||
read W < <(awk -F: '/Width/{print $2}' <<< "$XWININFO")
|
read -r W < <(awk -F: '/Width/{print $2}' <<< "$XWININFO")
|
||||||
read H < <(awk -F: '/Height/{print $2}' <<< "$XWININFO")
|
read -r H < <(awk -F: '/Height/{print $2}' <<< "$XWININFO")
|
||||||
|
|
||||||
byzanz-record -c --exec=./test-fonts.sh --x=$X --y=$Y --width=$W --height=$H "rec3.gif"
|
byzanz-record -c --exec=./test-fonts.sh --x="$X" --y="$Y" --width="$W" --height="$H" "rec3.gif"
|
||||||
|
|
||||||
convert -coalesce "rec3.gif" "results/nerd-fonts.png"
|
convert -coalesce "rec3.gif" "results/nerd-fonts.png"
|
||||||
convert -append $(ls -v results/*.png) ./test-combined.png
|
convert -append $"(ls -v results/*.png)" ./test-combined.png
|
||||||
|
|
||||||
|
@ -16,12 +16,15 @@ private_config="../private.cfg"
|
|||||||
# source the private confit file if exists:
|
# source the private confit file if exists:
|
||||||
if [ -f "$private_config" ]
|
if [ -f "$private_config" ]
|
||||||
then
|
then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$private_config"
|
source "$private_config"
|
||||||
else
|
else
|
||||||
echo >&2 "$LINE_PREFIX Could not source private config"
|
echo >&2 "$LINE_PREFIX Could not source private config"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
# # we know the '$github_access_token' is from the sourced file
|
||||||
TOKEN=$github_access_token
|
TOKEN=$github_access_token
|
||||||
OWNER="ryanoasis"
|
OWNER="ryanoasis"
|
||||||
REPO="nerd-fonts"
|
REPO="nerd-fonts"
|
||||||
@ -63,7 +66,7 @@ do
|
|||||||
|
|
||||||
printf "$LINE_PREFIX Uploading %s" "$basename"
|
printf "$LINE_PREFIX Uploading %s" "$basename"
|
||||||
|
|
||||||
curl -# -XPOST -H "Authorization:token $TOKEN" -H "Content-Type:application/octet-stream" --data-binary @"$basename" https://uploads.github.com/repos/$OWNER/$REPO/releases/$RELEASE/assets?name="$basename"
|
curl -# -XPOST -H "Authorization:token $TOKEN" -H "Content-Type:application/octet-stream" --data-binary @"$basename" https://uploads.github.com/repos/"$OWNER"/"$REPO"/releases/"$RELEASE"/assets?name="$basename"
|
||||||
|
|
||||||
#exit # uncomment to test only 1 zip
|
#exit # uncomment to test only 1 zip
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@ fi
|
|||||||
|
|
||||||
release=$1
|
release=$1
|
||||||
|
|
||||||
sed -i "s|[0-9]\.[0-9]\.[0-9]|$release|g" ../../font-patcher
|
sed -i "s|[0-9]\\.[0-9]\\.[0-9]|$release|g" ../../font-patcher
|
||||||
sed -i "s|\# version: [0-9]\.[0-9]\.[0-9]|\# version: $release|g" ../../bin/scripts/*.sh
|
sed -i "s|\\# version: [0-9]\\.[0-9]\\.[0-9]|\\# version: $release|g" ../../bin/scripts/*.sh
|
||||||
sed -i "s|version=\"[0-9]\.[0-9]\.[0-9]\"|version=\"$release\"|g" ../../bin/scripts/*.sh
|
sed -i "s|version=\"[0-9]\\.[0-9]\\.[0-9]\"|version=\"$release\"|g" ../../bin/scripts/*.sh
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
26
install.sh
26
install.sh
@ -1,13 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Install Nerd Fonts
|
# Install Nerd Fonts
|
||||||
__ScriptVersion="0.2"
|
__ScriptVersion="0.3"
|
||||||
|
|
||||||
# Default values for option variables:
|
# Default values for option variables:
|
||||||
quiet=false
|
quiet=false
|
||||||
mode="copy"
|
mode="copy"
|
||||||
clean=false
|
clean=false
|
||||||
mono=false
|
|
||||||
windows=false
|
|
||||||
extension="otf"
|
extension="otf"
|
||||||
patches=("Complete")
|
patches=("Complete")
|
||||||
compat=()
|
compat=()
|
||||||
@ -110,7 +108,7 @@ while getopts "$optspec" optchar; do
|
|||||||
# If the user has picked one of these options,
|
# If the user has picked one of these options,
|
||||||
# we need to unset `Complete`
|
# we need to unset `Complete`
|
||||||
delete=("Complete")
|
delete=("Complete")
|
||||||
patches=( "${patches[@]/$delete}" )
|
patches=( "${patches[@]/${delete[0]}}" )
|
||||||
case "${OPTARG}" in
|
case "${OPTARG}" in
|
||||||
fontawesome) patches=( "${patches[@]}" "Font Awesome" );;
|
fontawesome) patches=( "${patches[@]}" "Font Awesome" );;
|
||||||
fontlinux) patches=( "${patches[@]}" "Font Linux" );;
|
fontlinux) patches=( "${patches[@]}" "Font Linux" );;
|
||||||
@ -133,7 +131,7 @@ while getopts "$optspec" optchar; do
|
|||||||
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(($OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
# Set source and target directories, default: all fonts
|
# Set source and target directories, default: all fonts
|
||||||
nerdfonts_root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/patched-fonts"
|
nerdfonts_root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/patched-fonts"
|
||||||
@ -146,7 +144,7 @@ if [ ! -z "$*" ]; then
|
|||||||
if [ ! -z "$font" ]; then
|
if [ ! -z "$font" ]; then
|
||||||
# Ensure that directory exists, and offer suggestions if not
|
# Ensure that directory exists, and offer suggestions if not
|
||||||
if [[ ! -d "$nerdfonts_root_dir/$font" ]]; then
|
if [[ ! -d "$nerdfonts_root_dir/$font" ]]; then
|
||||||
echo -e "Font $font doesn't exist. Options are: \n"
|
echo -e "Font $font doesn't exist. Options are: \\n"
|
||||||
find "$nerdfonts_root_dir" -maxdepth 1 -type d \( \! -name "$(basename "$nerdfonts_root_dir")" \) -exec basename {} \;
|
find "$nerdfonts_root_dir" -maxdepth 1 -type d \( \! -name "$(basename "$nerdfonts_root_dir")" \) -exec basename {} \;
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
@ -164,7 +162,7 @@ implode() {
|
|||||||
# $3... are the elements to join
|
# $3... are the elements to join
|
||||||
local retname=$1 sep=$2 ret=$3
|
local retname=$1 sep=$2 ret=$3
|
||||||
shift 3 || shift $(($#))
|
shift 3 || shift $(($#))
|
||||||
printf -v "$retname" "%s" "$ret${@/#/$sep}"
|
printf -v "$retname" "%s" "$ret${*/#/$sep}"
|
||||||
}
|
}
|
||||||
find_include=
|
find_include=
|
||||||
find_exclude=
|
find_exclude=
|
||||||
@ -179,7 +177,7 @@ if [ ! -z "${compat[*]}" ]; then
|
|||||||
fi
|
fi
|
||||||
# Delete empty elements
|
# Delete empty elements
|
||||||
for i in "${!include[@]}"; do
|
for i in "${!include[@]}"; do
|
||||||
[ "${include[$i]}" = '' ] && unset include[$i]
|
[ "${include[$i]}" = '' ] && unset include["$i"]
|
||||||
done
|
done
|
||||||
if [ ! -z "${include[*]}" ]; then
|
if [ ! -z "${include[*]}" ]; then
|
||||||
implode find_include "*' -and -name '*" "${include[@]}"
|
implode find_include "*' -and -name '*" "${include[@]}"
|
||||||
@ -193,11 +191,11 @@ for delete in "${include[@]}"; do
|
|||||||
done
|
done
|
||||||
# Delete empty elements
|
# Delete empty elements
|
||||||
for i in "${!exclude[@]}"; do
|
for i in "${!exclude[@]}"; do
|
||||||
[ "${exclude[$i]}" = '' ] && unset exclude[$i]
|
[ "${exclude[$i]}" = '' ] && unset exclude["$i"]
|
||||||
done
|
done
|
||||||
if [ ! -z "${exclude[*]}" ]; then
|
if [ ! -z "${exclude[*]}" ]; then
|
||||||
implode find_exclude "*' -and \! -name '*" "${exclude[@]}"
|
implode find_exclude "*' -and \\! -name '*" "${exclude[@]}"
|
||||||
find_exclude="-and \! -name '*${find_exclude}*'"
|
find_exclude="-and \\! -name '*${find_exclude}*'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Construct directories to be searched
|
# Construct directories to be searched
|
||||||
@ -205,7 +203,7 @@ implode find_dirs "\" \"" "${nerdfonts_dirs[@]}"
|
|||||||
find_dirs="\"$find_dirs\""
|
find_dirs="\"$find_dirs\""
|
||||||
|
|
||||||
# Put it all together into the find command we want
|
# Put it all together into the find command we want
|
||||||
find_command="find $find_dirs \( \( -name '*.[o,t]tf' -or -name '*.pcf.gz' \) $find_include $find_exclude \) -type f -print0"
|
find_command="find $find_dirs \\( \\( -name '*.[o,t]tf' -or -name '*.pcf.gz' \\) $find_include $find_exclude \\) -type f -print0"
|
||||||
|
|
||||||
# Find all the font files and store in array
|
# Find all the font files and store in array
|
||||||
files=()
|
files=()
|
||||||
@ -226,12 +224,12 @@ done
|
|||||||
# Remove duplicates
|
# Remove duplicates
|
||||||
for i in "${!files_dedup[@]}"; do
|
for i in "${!files_dedup[@]}"; do
|
||||||
for j in "${!files_dedup[@]}"; do
|
for j in "${!files_dedup[@]}"; do
|
||||||
[ $i = $j ] && continue
|
[ "$i" = "$j" ] && continue
|
||||||
if [ "${files_dedup[$i]}" = "${files_dedup[$j]}" ]; then
|
if [ "${files_dedup[$i]}" = "${files_dedup[$j]}" ]; then
|
||||||
ext="${files[$i]##*.}"
|
ext="${files[$i]##*.}"
|
||||||
# Only remove if the extension is the one we don’t want
|
# Only remove if the extension is the one we don’t want
|
||||||
if [ "$ext" != "$extension" ]; then
|
if [ "$ext" != "$extension" ]; then
|
||||||
unset files[$i]
|
unset files["$i"]
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user