feat: add helper script, update doc
Browse files- README.md +2 -0
- batch_push.py +27 -0
README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
4 |
+
|
5 |
+
Check https://github.com/JeffersonQin/DungeonAssistant for details.
|
batch_push.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import subprocess
|
3 |
+
|
4 |
+
def git_add_commit_push(file_path):
|
5 |
+
subprocess.call(['git', 'lfs', 'install'])
|
6 |
+
# Git add the file
|
7 |
+
subprocess.call(['git', 'add', file_path])
|
8 |
+
|
9 |
+
# Git commit the file
|
10 |
+
subprocess.call(['git', 'commit', '-m', 'Committing {}'.format(file_path)])
|
11 |
+
|
12 |
+
# Git push the changes
|
13 |
+
subprocess.call(['git', 'push', 'origin', 'main'])
|
14 |
+
|
15 |
+
def process_directory(directory_path):
|
16 |
+
# Walk through the directory
|
17 |
+
for root, dirs, files in os.walk(directory_path):
|
18 |
+
for file in files:
|
19 |
+
file_path = os.path.join(root, file)
|
20 |
+
git_add_commit_push(file_path)
|
21 |
+
|
22 |
+
# Specify the directory you want to process
|
23 |
+
directory_paths = ['raw', 'processed']
|
24 |
+
|
25 |
+
# Process the directory
|
26 |
+
for directory_path in directory_paths:
|
27 |
+
process_directory(directory_path)
|