-
-
Notifications
You must be signed in to change notification settings - Fork 105
Description
Request
Currently, Carapace needs to be loaded via source command.
Due to a design choice in Nushell, the exact location of the sourced script file must be known at parse time (i.e. no $env calls when sourcing things).
While for most people this should be fine, I am in a situation where I use multiple devices running different operating systems, and this "parse-time magic directory" approach tends to fail.
Proposed solution
Modularizing the generated script should address this problem, as I can generate the script in env.nu file, add the generated module's location to $env.NU_LIB_DIRS, and use the Carapace module without specifying its exact directory.
This would look like below.
# -------- env.nu --------
carapace _carapace nushell | save --force "/path/to/carapace/mod.nu"
$env.NU_LIB_DIRS ++= "/path/to"
# -------- config.nu --------
use carapace
# or
overlay use carapaceAnything else?
Other utilities such as mise already does this.
I have a working, but minimally tested (read: I just made it like 2 minutes ago) example available at hand, so I can make a PR if you'd like.