Skip to content

Conversation

@surma
Copy link
Member

@surma surma commented Jan 8, 2026

Summary

Changes shadowenv init nushell to automatically install the shell hook into nushell's autoload directory instead of printing a script for users to manually paste into their config.

Changes

  • src/init.rs: Added install_nushell_hook() function that:

    • Queries nushell for its autoload directory via nu -c '$nu.user-autoload-dirs | first'
    • Creates the autoload directory if it doesn't exist
    • Writes shadowenv.nu with the hook script
    • Returns Result<()> for proper error handling
  • src/main.rs: Updated to handle the new return type from init::run()

  • README.md: Updated nushell instructions to reflect the new behavior

Behavior

Before:

$ shadowenv init nushell
# prints script to stdout, user must paste into config.nu

After:

$ shadowenv init nushell
Wrote shadowenv hook to /Users/you/Library/Application Support/nushell/autoload/shadowenv.nu

The autoload directory is queried from nushell itself, so it works correctly across platforms (macOS, Linux) and respects any custom configuration.

@surma surma requested a review from burke as a code owner January 8, 2026 16:13
@surma surma force-pushed the surma/nu-autoload branch from 471bc96 to 2c7d0aa Compare January 8, 2026 16:15
@surma surma merged commit 2e17729 into main Jan 8, 2026
9 checks passed
@surma surma deleted the surma/nu-autoload branch January 8, 2026 16:17
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.

2 participants