7
7
# ex: ./make_mdx.sh /Users/potter/dest /Users/potter/src
8
8
9
9
# make temp directory
10
- WORK_DIR=` mktemp -d`
10
+ WORK_DIR=$( mktemp -d)
11
11
12
12
PY_DEST_REPO=" docs/source/ingest/destination_connectors/code/python/"
13
13
SH_DEST_REPO=" docs/source/ingest/destination_connectors/code/bash/"
14
- DEST_DIR =$1 # first argument to script
14
+ DEST_TARGET_DIR =$1 # first argument to script
15
15
PY_SRC_REPO=" docs/source/ingest/source_connectors/code/python/"
16
16
SH_SRC_REPO=" docs/source/ingest/source_connectors/code/bash/"
17
- SRC_DIR =$2 # second argument to script
17
+ SRC_TARGET_DIR =$2 # second argument to script
18
18
19
19
# Clone the correct directories in the open source repo
20
- cd $WORK_DIR
20
+ cd " $WORK_DIR "
21
21
git init
22
22
git remote add -f origin https://github.com/Unstructured-IO/unstructured
23
23
git config core.sparseCheckout true
@@ -27,41 +27,33 @@ echo "$PY_SRC_REPO" >> .git/info/sparse-checkout
27
27
echo " $SH_SRC_REPO " >> .git/info/sparse-checkout
28
28
git pull origin main
29
29
30
- cp -R $WORK_DIR /$PY_DEST_REPO /. $DEST_DIR /
31
- cp -R $WORK_DIR /$SH_DEST_REPO /. $DEST_DIR /
32
- cp -R $WORK_DIR /$PY_SRC_REPO /. $SRC_DIR /
33
- cp -R $WORK_DIR /$SH_SRC_REPO /. $SRC_DIR /
30
+ cp -R " $WORK_DIR /$PY_DEST_REPO /." " $DEST_TARGET_DIR /"
31
+ cp -R " $WORK_DIR /$SH_DEST_REPO /." " $DEST_TARGET_DIR /"
32
+ cp -R " $WORK_DIR /$PY_SRC_REPO /." " $SRC_TARGET_DIR /"
33
+ cp -R " $WORK_DIR /$SH_SRC_REPO /." " $SRC_TARGET_DIR /"
34
+
35
+ function to_mdx() {
36
+ for f in * .py
37
+ do sed -i ' 1i```python\' $f
38
+ sed -i ' $ a ```' $f
39
+ mv $f $f .mdx
40
+ done
41
+
42
+ for f in * .sh
43
+ do sed -i ' 1i```bash\' $f
44
+ sed -i ' $ a ```' $f
45
+ mv $f $f .mdx
46
+ done
47
+ }
34
48
35
49
# Convert the destination_connectors to markdown
36
- cd $DEST_DIR
37
-
38
- for f in * .py
39
- do sed -i ' 1i```python\' $f
40
- sed -i ' $ a ```' $f
41
- mv $f $f .mdx
42
- done
43
-
44
- for f in * .sh
45
- do sed -i ' 1i```bash\' $f
46
- sed -i ' $ a ```' $f
47
- mv $f $f .mdx
48
- done
50
+ cd " $DEST_TARGET_DIR "
51
+ to_mdx
49
52
50
53
# Convert the source_connectors to markdown
51
- cd $SRC_DIR
52
-
53
- for f in * .py
54
- do sed -i ' 1i```python\' $f
55
- sed -i ' $ a ```' $f
56
- mv $f $f .mdx
57
- done
58
-
59
- for f in * .sh
60
- do sed -i ' 1i```bash\' $f
61
- sed -i ' $ a ```' $f
62
- mv $f $f .mdx
63
- done
54
+ cd " $SRC_TARGET_DIR "
55
+ to_mdx
64
56
65
- rm -rf $WORK_DIR
57
+ rm -rf " $WORK_DIR "
66
58
67
- echo " Markdown files created in $DEST_DIR and $SRC_DIR "
59
+ echo " Markdown files created in $DEST_TARGET_DIR and $SRC_TARGET_DIR "
0 commit comments