pscwd

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pscwd holds the PowerShell snippet that keeps a shell's process working directory at its location.

Windows PowerShell's Set-Location (sl, cd, cd..) moves the shell's own location but not the process's working directory, which is what the GitHub screen reads from the PEB (github.LiveDirs). Hook wraps the prompt function so that each prompt sets [Environment]::CurrentDirectory to the last file system location. The prompt it wraps (the default one, starship's, oh-my-posh's, …) is called first, so it still sees the command's $? and $LASTEXITCODE. Running it twice only wraps twice.

Index

Constants

View Source
const Hook = `& { $prompt = $function:prompt; ` +
	`$function:global:prompt = { $out = & $prompt; ` +
	`try { [Environment]::CurrentDirectory = (Get-Location -PSProvider FileSystem).ProviderPath } catch {}; ` +
	`$out }.GetNewClosure() }`

Hook is one line of PowerShell; it wraps the prompt defined when it runs.

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL