Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this is very much a wip, but it is the closest i have ever been to conquering this script file.
it is just war, i was annoyed i could not figure it out. i have been wanting to figure out what is going on in this script for forever.
at the very least, it will probably teach me something i did not know about nushell!
it seemed like black magic but i figured there had to be a method to the madness and maybe one day i would figure it out.
this is so far what i have figured out and where i am stuck and need some help.
in
themes/nu-themesthere are a bunch of|theme_name|.nufiles.preview-generate-screenshots.nuglobs all of the files in this folder, getting the theme name with
path parse | get stem.so for instance the theme
themes/nu-themes/gruvbox.nuthe$theme_nameisgruvboxevery theme that you want to add should go in
themes/nu-themesotherwise the script will not see them and generate stuff for you.load this file with
use ../nu-themes/gruvbox.nu *this file is an
export def mainthat is called withgruvboxand returns an object with keys and values. some of those values are used to configure the theme colors when taking a screenshot it looks like.the script gets
foregroundandbackgroundkeys, and mashes them together withsgr_colorsusing....$agg_themeuses this to convert a screen recording to a gif.in this example, the value
gruvboxis passed in for$theme_nameon the command line, both
or
work.
the main sript gets passed in the
screen_capture_methodand then callssave_screenshot screenshot_capture_method $theme_namefor every
.nufile inthemes/nu-themesafter the file is loaded, you should be able to do
but you cant!
in the script you have to load this theme with
but obviously the compiler throws an error for
$theme_namehere, saying "not a parse-time constant".it is not a constant to be fair, so it is not wrong but it is annoying, i just want to load this file, i know it is there, i just need the compiler to know it is there!
i thought i could get around it by passing
save_screenshotan extra parameter that is a list of all the$theme_name's that are innu-themesand it gets me a bit closer but the
nu -c $commanderrors out withgruvboxis not found"
gruvboxis neither a Nushell built-in or a known external command"
this error is probably why the script feels so magicky with the string escaping going on. how else would you go about hot loading everything?
feel like this might be an
export def mainquirk,because i can call all of my other definitions that are not
export def main's this way.assuming you can get those errors to go away, and you can call the command with nu -c,
this script will be way easier to understand and follow
so for questions,
how would you go about getting around the "not a parse time constant" and how would you tackle not being able to run
nu -c $theme_namewhen you can run the command on the command line?this might be why the script has alot of string escaping going on. this has been something that i wanted to try to fix. at the very least i would gain some knowledge about nushell i did not already know.
maybe i am missing really easy, but this is the point where i can not go any further.
if i can get some help with that i can finish the rest of this pr
i had an idea for the asciinema, powershell, and minicap scripts. they are just template files and you substitute the
theme_namefor the placeholder and it works, but then you get these other errors.