Skip to content

Releases: Napreth/PSDirEnv

Napreth.PSDirEnv 0.1.0

Choose a tag to compare

@Napreth Napreth released this 21 Oct 07:22
v0.1.0
ee6d7fc

中文

Napreth.PSDirEnv 首次发布。

进入项目目录时自动加载 .ps.envrc,离开时恢复原有状态。支持环境变量、普通变量、函数和别名,父子目录的配置可以逐层覆盖。

配置文件需要授权后才能执行,修改内容后需要重新授权。加载失败时会回滚本次修改,卸载时会保留用户手动修改的值。

支持 Windows、Linux 和 macOS,需要 PowerShell 7.4 或更高版本。

安装

Install-Module -Name Napreth.PSDirEnv -Scope CurrentUser

也可以下载附件中的 Napreth.PSDirEnv.0.1.0.nupkg,手动安装步骤见 README。

启用

将以下内容加入 $PROFILE。使用 Oh My Posh、Starship 或自定义 prompt 时,放在提示符初始化之后。

Import-Module Napreth.PSDirEnv
Enable-DirEnv

审阅项目中的 .ps.envrc 后,在项目目录运行 Approve-DirEnv,配置会立即生效。

English

Initial release of Napreth.PSDirEnv.

Automatically loads .ps.envrc when entering a project directory and restores the previous state when leaving. Supports environment variables, PowerShell variables, functions, and aliases, with layered overrides across parent and child directories.

Configuration files require approval before execution. Changes to their contents require renewed approval. Failed loads are rolled back, and manual changes are preserved when unloading.

Supports Windows, Linux, and macOS. Requires PowerShell 7.4 or later.

Installation

Install-Module -Name Napreth.PSDirEnv -Scope CurrentUser

Alternatively, download the attached Napreth.PSDirEnv.0.1.0.nupkg and follow the manual installation instructions in the README.

Setup

Add the following to $PROFILE. When using Oh My Posh, Starship, or a custom prompt, place these lines after prompt initialization.

Import-Module Napreth.PSDirEnv
Enable-DirEnv

Review the project's .ps.envrc, then run Approve-DirEnv in the project directory to apply the configuration immediately.