Skip to content

Instantly share code, notes, and snippets.

@satler-git
Last active May 5, 2024 10:17
Show Gist options
  • Save satler-git/b58c6b8687e15e1d1776469826ecfda8 to your computer and use it in GitHub Desktop.
Save satler-git/b58c6b8687e15e1d1776469826ecfda8 to your computer and use it in GitHub Desktop.
ghq cd
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