forked from mmistakes/minimal-mistakes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_aliases.sh
More file actions
executable file
·62 lines (53 loc) · 1.94 KB
/
Copy pathsetup_aliases.sh
File metadata and controls
executable file
·62 lines (53 loc) · 1.94 KB
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
#!/bin/bash
# Setup aliases for Jekyll post generation
# Run this once to add aliases to your shell profile
# Get the directory where this script is located (should be the blog root)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BLOG_DIR="$SCRIPT_DIR"
# Verify this looks like a Jekyll blog directory
if [[ ! -f "$BLOG_DIR/_config.yml" ]] || [[ ! -d "$BLOG_DIR/_posts" ]]; then
echo "❌ This doesn't appear to be a Jekyll blog directory"
echo " Missing _config.yml or _posts directory"
echo " Current directory: $BLOG_DIR"
exit 1
fi
SHELL_PROFILE=""
# Detect shell profile
if [ -f ~/.zshrc ]; then
SHELL_PROFILE="$HOME/.zshrc"
elif [ -f ~/.bashrc ]; then
SHELL_PROFILE="$HOME/.bashrc"
elif [ -f ~/.bash_profile ]; then
SHELL_PROFILE="$HOME/.bash_profile"
else
echo "❌ Could not find shell profile file"
exit 1
fi
echo "🔧 Setting up Jekyll post generation aliases..."
echo "📁 Using blog directory: $BLOG_DIR"
echo "📝 Adding to: $SHELL_PROFILE"
# Create backup
cp "$SHELL_PROFILE" "${SHELL_PROFILE}.backup"
# Add aliases
cat >> "$SHELL_PROFILE" << EOF
# Jekyll Blog Post Generation Aliases
alias new-post='cd "$BLOG_DIR" && python3 new_post.py'
alias quick-post='cd "$BLOG_DIR" && python3 quick_post.py'
alias draft-post='cd "$BLOG_DIR" && python3 draft_to_post.py'
alias blog-dir='cd "$BLOG_DIR"'
EOF
echo ""
echo "✅ Aliases added successfully!"
echo ""
echo "📋 Available commands after restarting your terminal:"
echo " • new-post - Interactive post creator (uses template)"
echo " • quick-post - Command-line post creator (simplified template)"
echo " • draft-post - Copy draft template directly"
echo " • blog-dir - Navigate to blog directory"
echo ""
echo "📖 Usage examples:"
echo ' new-post'
echo ' quick-post "My New Post" "Tutorial" "Docker,Kubernetes"'
echo ' draft-post "My Template Post"'
echo ""
echo "🔄 Restart your terminal or run: source $SHELL_PROFILE"