feat: refactor project init script to be idempotent and update setup output formatting
This commit is contained in:
4 files changed
+58
-27
No files matched your search
@@ -17,10 +17,6 @@ pnpm-workspace.yaml
|
||||
# Obsidian
|
||||
.obsidian/workspace.json
|
||||
|
||||
# VitePress
|
||||
.vitepress/dist
|
||||
.vitepress/cache
|
||||
|
||||
# Python
|
||||
.venv
|
||||
__pycache__
|
||||
+39
-17
@@ -1,32 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
init-project() {
|
||||
echo "Init git directory."
|
||||
git init .
|
||||
|
||||
echo "Create tmp folder."
|
||||
mkdir -p tmp
|
||||
local created=()
|
||||
|
||||
echo "Copy gitgnore template."
|
||||
cp -n "$HOME/taskfile.build/.gitignore.template" ./.gitignore
|
||||
if [[ ! -d "tmp" ]]; then
|
||||
mkdir -p tmp
|
||||
created+=("tmp/")
|
||||
fi
|
||||
|
||||
echo "Copy taskfile template."
|
||||
cp -n "$HOME/taskfile.build/task.template" ./task
|
||||
if [[ ! -f ".gitignore" ]]; then
|
||||
cp "$HOME/taskfile.build/.gitignore.template" ./.gitignore
|
||||
created+=(".gitignore")
|
||||
fi
|
||||
|
||||
echo "Copy env template."
|
||||
cp -n "$HOME/taskfile.build/.env.template" ./.env.template
|
||||
if [[ ! -f "task" ]]; then
|
||||
cp "$HOME/taskfile.build/task.template" ./task
|
||||
chmod +x ./task
|
||||
created+=("task")
|
||||
fi
|
||||
|
||||
echo "Copy agents template."
|
||||
cp -n "$HOME/taskfile.build/AGENTS.md.template" ./AGENTS.md
|
||||
if [[ ! -f ".env.template" ]]; then
|
||||
cp "$HOME/taskfile.build/.env.template" ./.env.template
|
||||
created+=(".env.template")
|
||||
fi
|
||||
|
||||
echo "Copy changelog template."
|
||||
cp -n "$HOME/taskfile.build/CHANGELOG.md.template" ./CHANGELOG.md
|
||||
if [[ ! -f "AGENTS.md" ]]; then
|
||||
cp "$HOME/taskfile.build/AGENTS.md.template" ./AGENTS.md
|
||||
created+=("AGENTS.md")
|
||||
fi
|
||||
|
||||
echo "Touch readme file."
|
||||
touch ./README.md
|
||||
if [[ ! -f "CHANGELOG.md" ]]; then
|
||||
cp "$HOME/taskfile.build/CHANGELOG.md.template" ./CHANGELOG.md
|
||||
created+=("CHANGELOG.md")
|
||||
fi
|
||||
|
||||
echo "Copy license file."
|
||||
cp "$HOME/taskfile.build/LICENSE" ./LICENSE
|
||||
if [[ ! -f "README.md" ]]; then
|
||||
touch ./README.md
|
||||
created+=("README.md")
|
||||
fi
|
||||
|
||||
if [[ ! -f "LICENSE" ]] && [[ "$HOME/taskfile.build/LICENSE" != "$PWD/LICENSE" ]]; then
|
||||
cp "$HOME/taskfile.build/LICENSE" ./LICENSE
|
||||
created+=("LICENSE")
|
||||
fi
|
||||
|
||||
if ((${#created[@]} > 0)); then
|
||||
echo "Created: ${created[*]}"
|
||||
fi
|
||||
}
|
||||
inp() {
|
||||
init-project "$@"
|
||||
|
||||
@@ -15,6 +15,19 @@ install-jupyter-lab() {
|
||||
|
||||
echo 'Install project dependencies'
|
||||
uv pip install -r "$req_file"
|
||||
|
||||
if [[ -f ".gitignore" ]]; then
|
||||
if ! grep -q '^\.ipynb_checkpoints$' ".gitignore"; then
|
||||
echo '' >> ".gitignore"
|
||||
echo '# Jupyter' >> ".gitignore"
|
||||
echo '.ipynb_checkpoints' >> ".gitignore"
|
||||
echo 'Added .ipynb_checkpoints to .gitignore'
|
||||
else
|
||||
echo '.ipynb_checkpoints already in .gitignore'
|
||||
fi
|
||||
else
|
||||
echo 'Warning: no .gitignore found; skipping .ipynb_checkpoints entry'
|
||||
fi
|
||||
}
|
||||
|
||||
ijl() {
|
||||
|
||||
@@ -23,14 +23,14 @@ show-project-setup() {
|
||||
echo ""
|
||||
echo "Project: $project_name"
|
||||
echo ""
|
||||
echo "KeePass Database File: $KEEPASS_DATABASE_FILE"
|
||||
echo "KeePass Database Key File: $KEEPASS_DATABASE_KEY_FILE"
|
||||
echo "KeePass Entry: $keepass_entry"
|
||||
echo "KeePass database file: $KEEPASS_DATABASE_FILE"
|
||||
echo "KeePass database key file: $KEEPASS_DATABASE_KEY_FILE"
|
||||
echo "KeePass entry: $keepass_entry"
|
||||
echo ""
|
||||
echo "Age key name: $key_name"
|
||||
echo "Age Key File: $age_key_file"
|
||||
echo "Age KeePass Entry: $age_keepass_entry"
|
||||
echo "Age Pass Entry: $age_pass_entry"
|
||||
echo "Age key file: $age_key_file"
|
||||
echo "Age KeePass entry: $age_keepass_entry"
|
||||
echo "Age Pass entry: $age_pass_entry"
|
||||
|
||||
if [[ -f ".sops.yaml" ]]; then
|
||||
echo "SOPS config:"
|
||||
|
||||
Reference in new issue
Block a user