File tree 1 file changed +52
-0
lines changed
1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # script for creating a new problem in a directory with the name of the problem
4
+ # and the files index.js, index.test.js, and README.md
5
+ echo ' 📁 Which directory do you want to create the solution? '
6
+ read directory
7
+
8
+ # validate if the directory exists, if not, create it
9
+ if [ ! -d " $directory " ]; then
10
+ echo ' 📁 The directory does not exist, do you want to create it? (y/n)'
11
+ read createDirectory
12
+ if [ " $createDirectory " = " y" ]; then
13
+ mkdir " $directory "
14
+ else
15
+ echo ' ❌ You must create the directory'
16
+ exit 1
17
+ fi
18
+ fi
19
+
20
+ cd " $directory "
21
+
22
+ echo ' 🎄 What is the name of the problem? '
23
+ read problem
24
+
25
+
26
+ directoryName=$( echo " $problem " | tr ' ' ' -' )
27
+ mkdir " $directoryName "
28
+
29
+ cd " $directoryName "
30
+
31
+ touch " index.js"
32
+ touch " index.test.js"
33
+ touch " README.md"
34
+
35
+ problemNumber=" ${problem: 0: 2} "
36
+
37
+ # primera letra en mayuscula
38
+ problemName=" ${problem: 3} "
39
+ problemName=" ${problemName^} "
40
+
41
+ echo " # Reto $problemNumber : $problemName " >> README.md
42
+ echo " " >> README.md
43
+ echo " ## Problema" >> README.md
44
+ echo " describe('$problemNumber => $problemName ', () => {
45
+ const testCases = [];
46
+
47
+ it('should return a ', () => {});
48
+
49
+ it.each(testCases)('', (testCase) => {});
50
+ });" >> index.test.js
51
+
52
+ echo ' ✅ The problem has been created'
You can’t perform that action at this time.
0 commit comments