Created
April 26, 2026 05:33
-
-
Save lopesivan/ee8a69271dad076e56fd4c06ebf92994 to your computer and use it in GitHub Desktop.
cmake templates
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
| #!/usr/bin/env bash | |
| REPO_URL="https://github.com/lopesivan/cmake-templates.git" | |
| REPO_NAME="cmake-templates" | |
| # Lista de branches com emojis descritivos | |
| BRANCHES=( | |
| "main" "-> 🌐 Branch principal" | |
| "cpp-with-tests" "🖥️ Projeto C++ moderno com CMake,via Google Test." | |
| ) | |
| # Exibir menu de seleção com emoji no título | |
| choice=$(dialog --clear --title "🚀 Selecionar Template Autotools" \ | |
| --menu "📦 Escolha um template para clonar:" 25 80 18 \ | |
| "${BRANCHES[@]}" \ | |
| 2>&1 >/dev/tty) | |
| clear | |
| # Se nada foi selecionado | |
| if [ -z "$choice" ]; then | |
| echo "❌ Nenhum template selecionado. Abortando." | |
| exit 1 | |
| fi | |
| # Nome do diretório de destino | |
| DEST_DIR="${choice}-template" | |
| # Verifica se o diretório já existe | |
| if [ -d "$DEST_DIR" ]; then | |
| echo "⚠️ O diretório '$DEST_DIR' já existe. Abortando." | |
| exit 1 | |
| fi | |
| # Clonar o branch específico | |
| echo "📥 Clonando o template '$choice' para '$DEST_DIR'..." | |
| git clone --branch "$choice" --single-branch "$REPO_URL" "$DEST_DIR" | |
| if [ $? -eq 0 ]; then | |
| echo "✅ Clone concluído com sucesso!" | |
| echo "📁 Projeto disponível em: $DEST_DIR" | |
| echo "$DEST_DIR" | xclip -selection secondary | |
| echo "📋 Comando 'cd $DEST_DIR' copiado para a área de transferência." | |
| echo "💡 Use o comando xcd para entrar no diretório." | |
| else | |
| echo "❌ Erro durante o clone do repositório." | |
| exit 1 | |
| fi | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment