forked from abbastoof/transcendence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_django_tree.sh
executable file
·80 lines (71 loc) · 1.75 KB
/
show_django_tree.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# Define the project root directory
PROJECT_ROOT="$(pwd)"
# Define the list of target files
TARGET_FILES=(
"models.py"
"serializers.py"
"views.py"
"tools.sh"
"supervisord.py"
"Dockerfile"
"settings.py"
"init_database.sh"
"run_consumer.sh"
"requirements.txt"
"consumer.py"
"rabbitmq_utils.py"
"user_session_views.py"
"validators.py"
"signals.py"
"consumers.py"
"asgi.py"
"apps.py"
"urls.py"
"asgi.py"
"wsgi.py"
"*.yml"
"*.conf"
"*.ini"
"*.env"
"*.sh"
)
# Function to print the directory tree with an arrow
print_tree_with_arrows() {
local prefix="$1"
local dir="$2"
local depth="$3"
# Print the current directory
echo "${prefix}$(basename "$dir")"
# Iterate over all items in the directory
for item in "$dir"/*; do
if [ -d "$item" ]; then
# Recurse into directories
print_tree_with_arrows "$prefix--> " "$item" "$((depth + 1))"
elif [ -f "$item" ]; then
# Print files
echo "${prefix}--> $(basename "$item")"
fi
done
}
# Function to print the path and content of the target files
print_file_contents() {
local file="$1"
if [ -f "$file" ]; then
echo -e "\nPath: $file"
echo "Directory Tree:"
local dir=$(dirname "$file")
print_tree_with_arrows "" "$dir" 0
echo -e "\nContent of $(basename "$file"):"
cat "$file"
fi
}
# Print the full project tree
echo "Full Project Tree:"
tree -a
# Print the path and content of each target file
for target_file in "${TARGET_FILES[@]}"; do
find "$PROJECT_ROOT" -name "$target_file" -type f | while read -r file; do
print_file_contents "$file"
done
done