https://github.com/acupofair/directory-stack
A simple script to switch directory quickly for powershell, bash and zsh
https://github.com/acupofair/directory-stack
bash powershell zsh
Last synced: about 1 month ago
JSON representation
A simple script to switch directory quickly for powershell, bash and zsh
- Host: GitHub
- URL: https://github.com/acupofair/directory-stack
- Owner: ACupofAir
- License: gpl-3.0
- Created: 2023-02-14T16:01:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-19T02:05:49.000Z (over 2 years ago)
- Last Synced: 2025-03-11T11:57:02.647Z (about 1 year ago)
- Topics: bash, powershell, zsh
- Language: PowerShell
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Directory-Stack
A powershell module to switch directory quickly
## :gear: Install
### powershell user
- Install from PowerShell Gallery(Suggestion)
- `Install-Module -Name directory-stack`
- Update from PowerShell Gallery(Suggestion)
- `Update-Module -Name directory-stack`
- [TODO] It seems that you need to manually go to the directory and remove the old version files for the updated module to take effect.
- Install mannual
- download this repository: `git clone git@github.com:ACupofAir/Directory-Stack.git` and rename it to `directory-stack`
- reference the folder in you powershell profile(`$PROFILE` is the default powershell config filek) , add this line to the profile
`Import-Module -Name $repository_path -DisableNameChecking`
- Optional Config: set alias of the function names in your `$PROFILE` to use them easily
```powershell
# in $PROFILE(usually is "~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1")
Set-Alias -Name dv Get-Dir-Stack
Set-Alias -Name pd Add-Dir-Item
Set-Alias -Name pp Remove-Dir-Stack-Item
Set-Alias -Name jp Set-Stacked-Dir
```
### bash or zsh user
```bash
curl -sSL https://raw.githubusercontent.com/ACupofAir/Directory-Stack/main/bash/install.sh | bash
```
## :toolbox: Usage
### powershell user
> **Following usage will run rightly after config alias in $PROFILE**
* [TODO] show be update.

| cmd | info |
| :-------------: | :----------------------------------------------------------------------------------------------------------------------------- |
| `pd` | pushd current directory in the stack |
| `pd $DIR_NAME` | pushd `$DIR_NAME` in the stack |
| `pp $DIR_INDEX` | popd directory index `$DIR_INDEX` in stack out |
| `dv` | show the table of stack(named from the linux command dirs -v), and waiting for user to input the index of directory want to go |
| `jp $DIR_INDEX` | jump to the directory whose index is `$DIR_INDEX` in the stack |
### bash or zsh user
| cmd | info |
| :--------------: | :---------------------------------------------------------------------------------------- |
| `pd` | pushd current directory in the stack |
| `pd $DIR_NAME` | pushd `$DIR_NAME` in the stack |
| `pp $DIR_INDEX` | popd directory index `$DIR_INDEX` in stack out and jump to the directory |
| `rmd $DIR_INDEX` | remove directory index `$DIR_INDEX` in stack |
| `dv` | show the table of stack(named from the linux command dirs -v) |
| `jp $DIR_INDEX` | jump to the directory whose index is `$DIR_INDEX` in the stack |
| `cldirs` | temporarily clear stack, when you start a new stack, the directory stack will be restored |
## :date: Release Log
| version | release date | description |
| ------- | ------------ | -------------------------------- |
| v1.1.0 | 02/03/2023 | add autoload directory support |
| v1.2.2 | 06/27/2023 | make all directory store in file |