Skip to content

Commit 4b75e6f

Browse files
committed
Add travel-mode command
1 parent f7dab90 commit 4b75e6f

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

commands/host/travel-mode

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
#ddev-generated
3+
4+
## Description: Delete all DB dumps saved by "ddev pull". Since those dumps are unsanitized until they get imported to a database, it is best to delete them if you plan to leave EU soil.
5+
## Usage: travel-mode
6+
## Example: "ddev travel-mode"
7+
8+
# Prompt for the PROJECTS folder, default to one level up from the current project
9+
GIT_ROOT=$(git rev-parse --show-toplevel)
10+
DEFAULT_PATH=$(dirname "$GIT_ROOT")
11+
read -p "Enter the path to the PROJECTS folder [default: $DEFAULT_PATH]: " PROJECTS
12+
PROJECTS=${PROJECTS:-$DEFAULT_PATH}
13+
PROJECTS=$(realpath "$PROJECTS")
14+
15+
# Check if the folder exists
16+
if [ ! -d "$PROJECTS" ]; then
17+
echo "The folder '$PROJECTS' does not exist. Exiting."
18+
exit 1
19+
fi
20+
21+
# Find files under .ddev/.downloads/*
22+
echo "Listing files under .ddev/.downloads/ in $PROJECTS..."
23+
find "$PROJECTS" -type f -path '*/.ddev/.downloads/*' -print
24+
25+
read -p "Type 'yes' to delete the files: " input
26+
if [ "$input" == "yes" ]; then
27+
echo "Deleting..."
28+
find "$PROJECTS" -type f -path '*/.ddev/.downloads/*' -delete
29+
echo "Deletion complete."
30+
else
31+
echo "You did not type 'yes'. Exiting..."
32+
exit 1
33+
fi
34+
35+

install.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ global_files:
125125
- commands/host/cloudflare
126126
- commands/host/login
127127
- commands/host/timeslip
128+
- commands/host/travel-mode
128129

129130
# Version constraint for DDEV that will be validated against the running DDEV executable
130131
# and prevent add-on from being installed if it doesn't validate.

0 commit comments

Comments
 (0)