Last active
May 5, 2024 10:17
-
-
Save satler-git/b58c6b8687e15e1d1776469826ecfda8 to your computer and use it in GitHub Desktop.
ghq cd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([String]$repoName) | |
# ghqのルートディレクトリを取得 | |
$ghqRoot = (ghq root) | |
# ghq listコマンドの結果から指定されたリポジトリ名を含む行を検索 | |
if ($repoName) { | |
$repoPath = ghq list | Where-Object { $_ -match $repoName } | |
} else { | |
$repoPath = ghq list | fzf | |
} | |
# 見つかったリポジトリのパスに移動 | |
if ($repoPath) { | |
Set-Location -Path (Join-Path -Path $ghqRoot -ChildPath $repoPath) | |
} else { | |
Write-Host "リポジトリ $repoName が見つかりませんでした。" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment