mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 15:17:47 +00:00
refactor: ✨ (#418)
* refactor: ✨ move in one commit Eveything in modules should probably be changed to `exported` defs. The idea is to move everything first to keep proper history. * refactor: 📝 add modules readme (wip) * refactor: ✨ small move * refactor: 📝 changed nestring, updated modules readme * refactor: 📝 to document or not to document * fix: 🐛 themes replaced the template to use `main` and regenerated them from lemnos themes. * Revert "fix: 🐛 themes" This reverts commit 4918d3633c8d2d81950a0ed0cfd9eb84241bc886. * refactor: ✨ introduce sourced - Created a source `root` in which sourcable demos are stored. Some might get converted to modules later on. - Moved some files to bin too. * fix: 🐛 fehbg.nu * fix: 🐛 modules/after.nu * moved some other stuff around --------- Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
parent
382696cd21
commit
c47ccd42b8
128 changed files with 185 additions and 12 deletions
33
modules/virtual_environments/auto-venv/README.md
Normal file
33
modules/virtual_environments/auto-venv/README.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Auto virtual environment scripts
|
||||
|
||||
The scripts in this directory activate virtual environments whenever you cd into a directory with a "trigger" file
|
||||
|
||||
## Usage
|
||||
|
||||
1. set `$env.AUTO_VENV_TRIGGER` to the name of a script file
|
||||
1. import `auto-venv` into your environment
|
||||
1. cd into a folder that contains your trigger file
|
||||
|
||||
ex.
|
||||
```nu
|
||||
# config.nu
|
||||
|
||||
export-env {
|
||||
let-env AUTO_VENV_TRIGGER = '__auto-venv.nu'
|
||||
|
||||
source-env ~/path/to/nu_scripts/virtual_environments/auto-venv/auto-venv.nu
|
||||
}
|
||||
|
||||
use ~/path/to/nu_scripts/virtual_environments/auto-venv/auto-venv.nu *
|
||||
```
|
||||
|
||||
When `auto-venv` detects that a file of that name exists in the folder you cd'ed into (or one of it's parents), it will automatically enable an overlay (as defined by the trigger file).
|
||||
|
||||
An example overlay for python venv is in `./venvs`
|
||||
|
||||
NOTE: the trigger file *must* export a custom command called `auto-venv-on-enter` that takes in the `$env` (this is the environment *before* the overlay was enabled).
|
||||
|
||||
|
||||
## Limitations
|
||||
|
||||
- Due to limitations with overlay naming, you cannot nest auto-venv triggers, even for separate languages / toolchains
|
Loading…
Add table
Add a link
Reference in a new issue