Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
degitとは (GitHubリポジトリの中の一部だけを簡単にダウンロードするツール)
#!/bin/sh
# https://github.com/Rich-Harris/degit
# https://qiita.com/masakinihirota/items/418eec4422fd06690924
# コマンドラインで対話型で上記を出来るようにした
TEXT_1="git サービスを選択:"
TEXT_2="リポジトリユーザーを入力(例 vercel):"
TEXT_3="ダウンロード対象のディレクトリを入力(例 next.js/examples/amp/):"
TEXT_4="タグか、ブランチか、コミットを入力 (default:master)]"
TEXT_5="ローカルでのダウンロード先を入力 (default: . )"
echo $TEXT_1
select git_service in github gitlab bitbucket
do
break
done
echo $TEXT_2
read repo_user
while [ -z "$repo_user" ]
do
echo $TEXT_2
read repo_user
done
echo $TEXT_3
read repo_dir
while [ -z "$repo_dir" ]
do
echo $TEXT_3
read repo_dir
done
echo $TEXT_4
read repo_commit
if [ -z "$repo_commit" ]; then
repo_commit=master
fi
echo $TEXT_5
read download_dir
if [ -z "$download_dir" ]; then
download_dir=.
fi
echo download start
npx degit $git_service:$repo_user/$repo_dir#$repo_commit $download_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment