nushell/docs/commands/autoenv.md
JT bff81f24aa
Autogenerate missing docs (#3514)
* Autogenerate missing docs

* Update ansi.md

* Rename question mark command docs

* Delete empty?.md
2021-05-30 12:57:04 +12:00

1.1 KiB

autoenv

Manage directory specific environment variables and scripts.

Create a file called .nu-env in any directory and run 'autoenv trust' to let nushell load it when entering the directory. The .nu-env file has the same format as your $HOME/nu/config.toml file. By loading a .nu-env file the following applies:

    • environment variables (section "[env]") are loaded from the .nu-env file. Those env variables only exist in this directory (and children directories)
    • the "startup" commands are run when entering the directory
    • the "on_exit" commands are run when leaving the directory

Usage

> autoenv <subcommand> {flags} 

Subcommands

  • autoenv trust - Trust a .nu-env file in the current or given directory
  • autoenv untrust - Untrust a .nu-env file in the current or given directory

Flags

  • -h, --help: Display this help message

Examples

Example .nu-env file

> cat .nu-env
    startup = ["echo ...entering the directory", "echo 1 2 3"]
    on_exit = ["echo ...leaving the directory"]

    [env]
    mykey = "myvalue"