Skip to content

Instantly share code, notes, and snippets.

@y-mamanaranu
Created September 19, 2022 22:33
Show Gist options
  • Select an option

  • Save y-mamanaranu/3e205cd03dca092d186a7fb1205b1e9e to your computer and use it in GitHub Desktop.

Select an option

Save y-mamanaranu/3e205cd03dca092d186a7fb1205b1e9e to your computer and use it in GitHub Desktop.
Make code and code-insiders automatically switch based on directory.
function code(){
target="$(pwd)"
if [[ -n "$1" ]]; then
if [[ "$1" =~ "/*" ]]; then
target="$1"
else
target="$(builtin cd $1; pwd)"
fi
fi
if [[ "$target" =~ "$(ghq root)/github.com/y-muen/*" ]]; then
command code-insiders $@
else
command code $@
fi
}
@y-mamanaranu
Copy link
Copy Markdown
Author

y-mamanaranu commented Sep 19, 2022

CodeにはGitHubの仕事アカウント、Code InsiderにはGitHubのプライベートアカウントで入るとかの時に。
ソースをghqで管理すれば、これで必要最低限の認識はするはず?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment