|
| 1 | +<!doctype html> |
| 2 | +<html |
| 3 | + lang="en" |
| 4 | + data-depth="2"> |
| 5 | + <head> |
| 6 | + <meta charset="utf-8" /> |
| 7 | + <meta |
| 8 | + name="viewport" |
| 9 | + content="width=device-width, initial-scale=1" /> |
| 10 | + <meta |
| 11 | + name="description" |
| 12 | + content="Day 22 of the 30 Days of AI-Generated Programming Prompts — a Bash project setup tool that scaffolds new projects." /> |
| 13 | + <link |
| 14 | + rel="stylesheet" |
| 15 | + type="text/css" |
| 16 | + href="../../index.css" /> |
| 17 | + |
| 18 | + <title>Day 22 | 30 Days of AI Prompts | Matt G</title> |
| 19 | + <script |
| 20 | + src="../../assets/js/site-style.js" |
| 21 | + defer></script> |
| 22 | + </head> |
| 23 | + <body> |
| 24 | + <div id="site-nav"></div> |
| 25 | + <header class="hero-section"> |
| 26 | + <h1>Day 22</h1> |
| 27 | + <h3>A Bash Project Setup Tool</h3> |
| 28 | + </header> |
| 29 | + <main> |
| 30 | + <h2 style="text-align: center; font-size: 30px" |
| 31 | + >Unfortunately, you can't run this in the browser here</h2 |
| 32 | + > |
| 33 | + <p |
| 34 | + >This is a shell script and must be run locally on a Unix-based system — |
| 35 | + it cannot run in the browser.</p |
| 36 | + > |
| 37 | + <p |
| 38 | + >Run <code>chmod +x setup.sh && ./setup.sh</code> in your terminal to |
| 39 | + use it.</p |
| 40 | + > |
| 41 | + <br /> |
| 42 | + <h2 style="text-align: center">Description</h2> |
| 43 | + <br /> |
| 44 | + <article |
| 45 | + >A Bash script that scaffolds a new project directory. It prompts for a |
| 46 | + project name and language (Python, Go, React, or Rust), then creates the |
| 47 | + appropriate folder structure, starter files, a <code>.gitignore</code>, |
| 48 | + and initializes a git repository.</article |
| 49 | + > |
| 50 | + <br /> |
| 51 | + <h3 style="text-align: center; font-size: 30px">View the source code</h3> |
| 52 | + <br /> |
| 53 | + <div class="code-segment"> |
| 54 | + <pre style="margin: 0; overflow-x: auto"><code>#!/bin/bash |
| 55 | + |
| 56 | +echo "Setup Project Directories Program" |
| 57 | +echo |
| 58 | +echo "What is the name of your project?" |
| 59 | +read -p "> " name |
| 60 | +echo "What is the project language?" |
| 61 | +read -p "> " language |
| 62 | + |
| 63 | +if [ "$language" = "python" ]; then |
| 64 | + mkdir "$name" |
| 65 | + cd "$name" || exit |
| 66 | + git init |
| 67 | + cat > main.py << 'EOF' |
| 68 | +print('Hello, World!') |
| 69 | +EOF |
| 70 | + python main.py |
| 71 | +elif [ "$language" = "go" ]; then |
| 72 | + mkdir "$name" |
| 73 | + cd "$name" || exit |
| 74 | + git init |
| 75 | + go mod init "$name" |
| 76 | + touch main.go |
| 77 | + code main.go |
| 78 | +elif [ "$language" = "react" ]; then |
| 79 | + npx create-react-app "$name" |
| 80 | + cd "$name" || exit |
| 81 | + code . |
| 82 | +elif [ "$language" = "rust" ]; then |
| 83 | + cargo new "$name" |
| 84 | + cd "$name/src" || exit |
| 85 | + code main.rs |
| 86 | +else |
| 87 | + echo "Language not supported" |
| 88 | +fi</code></pre> |
| 89 | + </div> |
| 90 | + <br /> |
| 91 | + <a |
| 92 | + class="text-link" |
| 93 | + href="Day21.html" |
| 94 | + >Previous Day</a |
| 95 | + > |
| 96 | + | |
| 97 | + <a |
| 98 | + class="text-link" |
| 99 | + href="Day23.html" |
| 100 | + >Next Day</a |
| 101 | + > |
| 102 | + <br /> |
| 103 | + </main> |
| 104 | + <div id="site-footer"></div> |
| 105 | + </body> |
| 106 | +</html> |
0 commit comments