From 3a6deb19341ab23424d81e4127870dd0fe87e387 Mon Sep 17 00:00:00 2001 From: Simon Guest Date: Tue, 4 Jun 2024 07:54:59 +1200 Subject: [PATCH] Add reference to bash-env to cookbook (#1434) * Add cookbook reference to bash-env plugin * Also for ssh-agent * Add note on unsupported nature of bash-env by core team. * Warnings * Oops, trailing colons --- cookbook/foreign_shell_scripts.md | 13 +++++++++++++ cookbook/ssh_agent.md | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/cookbook/foreign_shell_scripts.md b/cookbook/foreign_shell_scripts.md index 6ce9c59899..91d3a97fa0 100644 --- a/cookbook/foreign_shell_scripts.md +++ b/cookbook/foreign_shell_scripts.md @@ -63,6 +63,19 @@ This quickly gets tricky though, for example when the script is declaring a There are ways to implement some form of expansion too, but at some point it might make more sense to leave the parsing to the shell it was meant for. +## Bash Env Plugin + +There is a third-party Nu plugin [bash-env](https://github.com/tesujimath/nu_plugin_bash_env) +for importing environment variables from Bash format files and pipes. +This plugin uses Bash itself to parse the environment definitions, +and can therefore cope with arbitrarily complex Bash sources. + +::: warning +Please note that the `bash-env` plugin is not supported by the core Nushell team. +All issues and requests for support should be directed to its own +[issue tracker](https://github.com/tesujimath/nu_plugin_bash_env/issues). +::: + ## Capturing the environment from a foreign shell script A more complex approach is to run the script in the shell it is written for and diff --git a/cookbook/ssh_agent.md b/cookbook/ssh_agent.md index bee5e78eb5..3dd4acb980 100644 --- a/cookbook/ssh_agent.md +++ b/cookbook/ssh_agent.md @@ -21,6 +21,18 @@ Adding this to your `env.nu` will however start a new ssh-agent process every ti See the workarounds. ::: +Alternatively, use the third-party Nu plugin [bash-env](https://github.com/tesujimath/nu_plugin_bash_env) as follows. + +```nushell +^ssh-agent | bash-env | load-env +``` + +::: warning +Please note that the `bash-env` plugin is not supported by the core Nushell team. +All issues and requests for support should be directed to its own +[issue tracker](https://github.com/tesujimath/nu_plugin_bash_env/issues). +::: + ## Workarounds You can work around this behavior by checking if a ssh-agent is already running on your user, and start one if none is: