1
+ def getMaxSpaces (file ):
2
+ max = float ('-inf' )
3
+ for ele in file :
4
+ ele = ele .strip ()
5
+ if (len (ele ) > max ):
6
+ max = len (ele )
7
+ return max
8
+
9
+ def getNestedFiles (rootDir ,ignoredirs ):
10
+ from os import walk
11
+ from os .path import join
12
+ nestfiles = []
13
+ for path , subdirs , files in walk (rootDir ):
14
+ if (all (ele not in path for ele in ignoredirs )):
15
+ for name in files :
16
+ nestfiles .append (join (path , name ))
17
+ return nestfiles
18
+
19
+
20
+ def read_file (onlyfiles ):
21
+ filecontent = []
22
+ for file in onlyfiles :
23
+ with open (onlyfiles [onlyfiles .index (file )], "r" ) as f :
24
+ filecontent .append (f .readlines ())
25
+ return filecontent
26
+
27
+ def initCommands (info ):
28
+ import gitcommands as git
29
+ import filechange
30
+ url ,branch = info
31
+ info .remove ('n' )
32
+ git .init ()
33
+ git .createReadme ()
34
+ git .add (['.' ])
35
+ git .commit (['README.md' ])
36
+ git .setBranch (branch )
37
+ git .setremote (url )
38
+ git .push (url , branch )
39
+ print ('initial setup done :)' )
40
+ filechange .ischanged (url , branch )
41
+
42
+ def commitAndUpdate (changedfile ,diffarr ,url ,branch ):
43
+ from gitcommands import commit ,push ,add
44
+ from logger import updatedata
45
+ from colors import logcolors
46
+ add (changedfile )
47
+ if (commit (changedfile ,diffarr ) == False ):
48
+ print (f'{ logcolors .ERROR } Reverting Push{ logcolors .ENDC } ' )
49
+ # updatedata(changedfile, diffarr)
50
+ else :
51
+ print (f'{ logcolors .SUCCESS } Updating Logs{ logcolors .ENDC } ' )
52
+ updatedata (changedfile , diffarr )
53
+ if (len (changedfile ) == 0 ):
54
+ push (url , branch )
0 commit comments