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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support nushell #2

Open
cpendery opened this issue Apr 24, 2024 · 3 comments
Open

support nushell #2

cpendery opened this issue Apr 24, 2024 · 3 comments

Comments

@cpendery
Copy link
Owner

No description provided.

@cpendery
Copy link
Owner Author

Nushell doesn't support eval, so we'd need to write to a temporary file and then source that each time

@cpendery
Copy link
Owner Author

Conclusion, nushell doesn't allow dynamic sourcing of files in scripts because it evaluates the files during the parsing phase. Running something like kaldo to populate a file of aliases & then sourcing it won't work because the sourcing will get evaluated before kaldo gets run

image

@andrewthauer
Copy link

andrewthauer commented Jan 5, 2025

The problem you ran into here is the file.nu is relative. You can only source files with absolute (well known) paths. It is also common practice to split this operation into the env.nu & config.nu files as seen below.

# ~/.config/nushell/env.nu
kaldo -s nu | save ~/.config/aliases.nu

# ~/.config/nushell/config.nu
source ~/.config/aliases.nu

It would be pretty easy to optimize this by only running kaldo -s if the .kaldorc is more recent then the target aliases.nu file.

@cpendery cpendery reopened this Jan 6, 2025
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

No branches or pull requests

2 participants