-
Notifications
You must be signed in to change notification settings - Fork 13
143 lines (121 loc) · 4.94 KB
/
androsh-help.yml
File metadata and controls
143 lines (121 loc) · 4.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: AndroSH Help Docs Generator
on:
push:
branches: [main, dev]
workflow_dispatch:
inputs:
reason:
description: 'Reason for running workflow'
required: false
default: 'Manual trigger'
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install --upgrade pip
[ -f requirements.txt ] && pip install -r requirements.txt
- name: Generate Help Documentation
run: |
# Create documentation file
DOC_FILE="AndroSH_Help.md"
# Header
echo "# AndroSH Command Line Reference" > "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo "> Complete documentation for all AndroSH commands and subcommands" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo "---" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
# Main help section
echo "## Main Command" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo '```' >> "$DOC_FILE"
python main.py --help 2>&1 >> "$DOC_FILE"
echo '```' >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
# Extract subcommands using whitespace pattern (successfully tested)
echo "## Available Subcommands" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
# Get subcommands and their descriptions
SUBCOMMANDS=$(python main.py --help 2>&1 | grep -E '^[[:space:]]+[a-z][a-z-]+[[:space:]]+' | awk '{print $1}')
# Convert to array
IFS=$'\n' read -r -d '' -a subcommands < <(echo "$SUBCOMMANDS" && printf "\0")
echo "✅ Found ${#subcommands[@]} subcommands: ${subcommands[*]}" >&2
# Create table of contents with descriptions
echo "| Command | Description |" >> "$DOC_FILE"
echo "|---------|-------------|" >> "$DOC_FILE"
# Process each subcommand for table
for cmd in "${subcommands[@]}"; do
# Get full line with description
FULL_LINE=$(python main.py --help 2>&1 | grep -E "^[[:space:]]+$cmd[[:space:]]+")
# Extract description (remove command name and leading spaces)
DESC=$(echo "$FULL_LINE" | sed -E "s/^[[:space:]]+$cmd[[:space:]]+//")
echo "| \`$cmd\` | $DESC |" >> "$DOC_FILE"
done
echo "" >> "$DOC_FILE"
echo "---" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
# Detailed help for each subcommand
echo "## Detailed Subcommand Help" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
for cmd in "${subcommands[@]}"; do
echo "" >> "$DOC_FILE"
echo "### \`python main.py $cmd\`" >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo '```' >> "$DOC_FILE"
python main.py "$cmd" --help 2>&1 >> "$DOC_FILE" || echo "⚠️ No help available for $cmd" >> "$DOC_FILE"
echo '```' >> "$DOC_FILE"
echo "" >> "$DOC_FILE"
echo "---" >> "$DOC_FILE"
done
# Footer
echo "*Documentation automatically generated by GitHub Actions*" >> "$DOC_FILE"
# Print summary
echo ""
echo "============================================="
echo "ANDROSH COMMAND LINE REFERENCE"
echo "============================================="
echo ""
echo "✅ Found ${#subcommands[@]} subcommands:"
for cmd in "${subcommands[@]}"; do
echo " • $cmd"
done
echo ""
echo "Full documentation saved to: $DOC_FILE"
- name: Print Documentation
run: |
echo "============================================="
echo " ANDROSH COMMAND LINE REFERENCE"
echo "============================================="
echo ""
cat AndroSH_Help.md
echo ""
echo "============================================="
echo " DOCUMENTATION COMPLETE"
echo "============================================="
- name: Commit and push documentation
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
mkdir -p Assets/docs
if [ -f "Assets/docs/AndroSH_Help.md" ]; then
if cmp -s "AndroSH_Help.md" "Assets/docs/AndroSH_Help.md"; then
echo "No changes detected - files are identical"
exit 0
else
echo "Content differs - updating file"
fi
else
echo "File doesn't exist - creating new file"
fi
mv AndroSH_Help.md Assets/docs/AndroSH_Help.md
git add Assets/docs/AndroSH_Help.md
git commit -m "docs: update AndroSH command line reference
Co-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
git push