Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

make the themes a module #648

Merged
merged 4 commits into from
Oct 23, 2023
Merged

Conversation

amtoine
Copy link
Member

@amtoine amtoine commented Oct 20, 2023

related to

description

with nushell/nupm#33, Nupm can now install separate modules from a single package 馃コ

the nu_scripts are a package and looks like they contain a few potential standalone modules:

  • the themes
  • the hooks
  • the custom completions
  • ...

this PR is a proposal to move themes/ to nu-themes/ and add ./nu-themes/ as a module to the nu-scripts package.
that way when running nupm install --path . in the root of the nu_scripts, a nu-themes module will be installed in $env.NUPM_HOME/modules.

then one can run

use nu-themes/themes/nushell-dark.nu

and next get the theme with

nushell-dark

@amtoine amtoine requested a review from kubouch October 20, 2023 13:47
amtoine added a commit to amtoine/dotfiles that referenced this pull request Oct 20, 2023
related to
- nushell/nu_scripts#648

will require to install `nu-scripts` with Nupm from nushell/nu_scripts#648.
@fdncred
Copy link
Collaborator

fdncred commented Oct 20, 2023

seems reasonable

@amtoine
Copy link
Member Author

amtoine commented Oct 20, 2023

seems reasonable

note that there will be more renaming like this if we go that route 馃槒

@kubouch
Copy link
Contributor

kubouch commented Oct 20, 2023

I think you can just rename themes to nu-themes and keep the files as-is? Then, you'd have just use nu-themes/spam-theme.nu. Also, I think it's missing mod.nu for Nushell to recognize nu-themes as a module. nupm is currently very dumb and will blindly copy what you tell it to, but I imagine in the future it might have some validation.

@amtoine
Copy link
Member Author

amtoine commented Oct 21, 2023

I think you can just rename themes to nu-themes and keep the files as-is?

yup, that's the biggest part of this PR, it's just an mv themes/ nu-themes/ 馃槈

Then, you'd have just use nu-themes/spam-theme.nu. Also, I think it's missing mod.nu for Nushell to recognize nu-themes as a module. nupm is currently very dumb and will blindly copy what you tell it to, but I imagine in the future it might have some validation.

i wouldn't do that for now 馃憖
the issue with adding a mod.nu to nu-themes/ is that, when you use one of the theme, aaaaaall the module will be parsed which takes way to much time to be put in a config...
right now, i think the most direct and fastest method is to not add a mod.nu and run

use nu-themes/themes/nushell-dark.nu

馃

@kubouch
Copy link
Contributor

kubouch commented Oct 21, 2023

I see, yeah, it makes sense to access the files directly. mod.nu wouldn't prevent that, you'd still be able to access them individually, but that's ok, we can keep it without.

I was just wondering why not have simply nu-themes/nushell-dark.nu, why is there the themes directory in between.

@amtoine
Copy link
Member Author

amtoine commented Oct 21, 2023

I see, yeah, it makes sense to access the files directly. mod.nu wouldn't prevent that, you'd still be able to access them individually, but that's ok, we can keep it without.

馃憤

I was just wondering why not have simply nu-themes/nushell-dark.nu, why is there the themes directory in between.

because there are not only themes in nu-themes, also a script, a README and screenshots 馃
this is purely to make nu-themes/ easy to look at 馃構

@amtoine
Copy link
Member Author

amtoine commented Oct 21, 2023

may we land this as an experiment? 馃槆

@kubouch
Copy link
Contributor

kubouch commented Oct 21, 2023

Ah, OK, sorry, I'm dumb :-D . I looked wrong and somehow thought you added an extra themes/ subdirectory. One last comment is that now you'd install the screenshots/ as well, not sure if it's desired. But if you're OK with it, feel free to land it.

@amtoine
Copy link
Member Author

amtoine commented Oct 22, 2023

Ah, OK, sorry, I'm dumb :-D . I looked wrong and somehow thought you added an extra themes/ subdirectory. One last comment is that now you'd install the screenshots/ as well, not sure if it's desired. But if you're OK with it, feel free to land it.

that's a very good point and i don't like it 馃

i've tried a fix in a Nupm PR just above.
changes here would be

  • move the directories back and rename the inner theme directory to nu-themes
mv nu-themes/ themes
mv themes/themes/ themes/nu-themes
  • change $.modules in package.nuon to [./themes/nu-themes]

the new Nupm would install the ./themes/nu-themes/ directory in $env.NUPM_HOME/modules/nu-themes/, what do you think? 馃槆

@amtoine
Copy link
Member Author

amtoine commented Oct 22, 2023

additional nice thing is that one would have to run

use nu-themes/nushell-dark.nu

instead of

use nu-themes/themes/nushell-dark.nu

now 馃構

@kubouch
Copy link
Contributor

kubouch commented Oct 22, 2023

Yeah, changing the $.modules to themes/nu-themes should work fine.

commands used
```nushell
mv nu-themes/ themes
mv themes/themes/ themes/nu-themes
```
@amtoine
Copy link
Member Author

amtoine commented Oct 23, 2023

Yeah, changing the $.modules to themes/nu-themes should work fine.

done in 27e81f4 馃槈

let's land this and see how it goes 馃コ

@amtoine amtoine merged commit cc0719b into nushell:main Oct 23, 2023
@amtoine amtoine deleted the make-themes-a-module branch October 23, 2023 16:25
@amtoine
Copy link
Member Author

amtoine commented Oct 23, 2023

i've tried to nupm install it and it works like a charm 馃槍 馃挭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants