From 0f7b4ecf63312acc1e3a21aba2c3bcfa192043ce Mon Sep 17 00:00:00 2001 From: Sy Le Date: Fri, 29 Dec 2023 13:24:34 -0800 Subject: [PATCH] now construct the font list programmatically --- .build/font-linux.md | 3 +++ .build/font-windows.md | 5 +++++ fonts/README.md | 42 +++++---------------------------------- software/scripts/fonts.js | 30 ++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 37 deletions(-) diff --git a/.build/font-linux.md b/.build/font-linux.md index 6c31ab82..67da147a 100644 --- a/.build/font-linux.md +++ b/.build/font-linux.md @@ -1,3 +1,4 @@ +``` cd ~/Desktop curl https://github.com/synle/bashrc/raw/master/fonts/CascadiaCode.ttf -O -J -L && \ curl https://github.com/synle/bashrc/raw/master/fonts/CascadiaCodePL.ttf -O -J -L && \ @@ -9,4 +10,6 @@ curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Medium.ttf -O -J curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Regular.ttf -O -J -L && \ curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Retina.ttf -O -J -L && \ curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-SemiBold.ttf -O -J -L && \ +curl https://github.com/synle/bashrc/raw/master/fonts/Trace.ttf -O -J -L && \ echo "Done downloading fonts" +``` \ No newline at end of file diff --git a/.build/font-windows.md b/.build/font-windows.md index d6faab26..eb553cec 100644 --- a/.build/font-windows.md +++ b/.build/font-windows.md @@ -1,3 +1,6 @@ +``` +C: +cd C: Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/CascadiaCode.ttf Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/CascadiaCodePL.ttf Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/CascadiaMono.ttf @@ -8,4 +11,6 @@ Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/Fira Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Regular.ttf Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Retina.ttf Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/FiraCode-SemiBold.ttf +Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/Trace.ttf echo "Done downloading fonts" +``` \ No newline at end of file diff --git a/fonts/README.md b/fonts/README.md index 722b830a..3d88245e 100644 --- a/fonts/README.md +++ b/fonts/README.md @@ -1,41 +1,9 @@ -These fonts are copied from the owner of Fira Code. Repo is at https://github.com/tonsky/FiraCode +These fonts are copied from the owner of Fira Code. Repo is at https://github.com/tonsky/FiraCode and https://www.fontspace.com/trace-font-f3625 -### Bash +### Linux - Bash -```bash -cd ~/Desktop -curl https://github.com/synle/bashrc/raw/master/fonts/CascadiaCode.ttf -O -J -L && \ -curl https://github.com/synle/bashrc/raw/master/fonts/CascadiaCodePL.ttf -O -J -L && \ -curl https://github.com/synle/bashrc/raw/master/fonts/CascadiaMono.ttf -O -J -L && \ -curl https://github.com/synle/bashrc/raw/master/fonts/CascadiaMonoPL.ttf -O -J -L && \ -curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Bold.ttf -O -J -L && \ -curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Light.ttf -O -J -L && \ -curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Medium.ttf -O -J -L && \ -curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Regular.ttf -O -J -L && \ -curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Retina.ttf -O -J -L && \ -curl https://github.com/synle/bashrc/raw/master/fonts/FiraCode-SemiBold.ttf -O -J -L && \ -echo "Done downloading fonts" -``` +https://github.com/synle/bashrc/blob/master/.build/font-linux.md -### Powershell +### Windows - Powershell -``` -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/CascadiaCode.ttf -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/CascadiaCodePL.ttf -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/CascadiaMono.ttf -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/CascadiaMonoPL.ttf -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Bold.ttf -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Light.ttf -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Medium.ttf -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Regular.ttf -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/FiraCode-Retina.ttf -Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/FiraCode-SemiBold.ttf -echo "Done downloading fonts" -``` - -Source: - -``` -Trace.ttf -https://www.fontspace.com/trace-font-f3625 -``` +https://github.com/synle/bashrc/blob/master/.build/font-windows.md diff --git a/software/scripts/fonts.js b/software/scripts/fonts.js index 99c19f2f..2bc5c9a2 100644 --- a/software/scripts/fonts.js +++ b/software/scripts/fonts.js @@ -18,6 +18,36 @@ async function doWork() { return process.exit(); } + // write to build file + const fontBaseNames = fonts.map((font) => path.basename(font)); + writeToBuildFile([ + [ + 'font-linux.md', + ` +\`\`\` +cd ~/Desktop +${fontBaseNames.map((fontBaseName) => `curl https://github.com/synle/bashrc/raw/master/fonts/${fontBaseName} -O -J -L && \\`).join('\n')} +echo "Done downloading fonts" +\`\`\` +`.trim(), + false, + ], + [ + 'font-windows.md', + ` +\`\`\` +C: +cd C: +${fontBaseNames + .map((fontBaseName) => `Start-BitsTransfer -Source https://github.com/synle/bashrc/raw/master/fonts/${fontBaseName}`) + .join('\n')} +echo "Done downloading fonts" +\`\`\` +`.trim(), + false, + ], + ]); + const promises = []; for (const font of fonts) { promises.push(