@@ -48,7 +48,9 @@ def process(self, event):
4848 print ("Done" )
4949
5050 # Push to master
51- self .git_process ()
51+ if (self .git_directory != None ):
52+ print ("testing" )
53+ self .git_process ()
5254
5355 def git_process (self ):
5456 """
@@ -98,13 +100,13 @@ def main():
98100 parser = argparse .ArgumentParser (
99101 description = "Watch a source directory for PDF modifications or creations, move PDF file to the destination directory, and push to Git" )
100102 parser .add_argument ("-n" , "--author_name" ,
101- help = "author of the commit" , required = True )
103+ help = "author of the commit" )
102104 parser .add_argument ("-e" , "--author_email" ,
103- help = "author's email" , required = True )
105+ help = "author's email" )
104106 parser .add_argument ("-m" , "--commit_message" ,
105- help = "the message associated with the commit" , required = True )
107+ help = "the message associated with the commit" )
106108 parser .add_argument ("-g" , "--git_directory" ,
107- help = "the base Git directory of the destination" , required = True )
109+ help = "the base Git directory of the destination" )
108110 parser .add_argument ("-s" , "--source_path" ,
109111 help = "the directory to watch" , required = True )
110112 parser .add_argument ("-d" , "--destinations" ,
@@ -115,10 +117,18 @@ def main():
115117 # Parse arguments.
116118 arguments = parser .parse_args ()
117119
120+ # If a git_directory is provided, ensure that author_name, author_email,
121+ # and a commit_message was provided.
122+ if (arguments .git_directory != None ):
123+ if (arguments .author_name == None or arguments .author_email == None or arguments .commit_message == None ):
124+ print (
125+ "[ ERROR ]: git directory was specified without an author_name, author_email, or commit_message." )
126+ return
127+
118128 # Run WatchDog with FileUpdater.
119129 observer = Observer ()
120- observer .schedule (FileUpdater (
121- arguments . author_name , arguments . author_email , arguments . commit_message , arguments .git_directory , arguments .destinations , arguments .pattern_matcher ), arguments .source_path )
130+ observer .schedule (FileUpdater (arguments . author_name , arguments . author_email , arguments . commit_message ,
131+ arguments .git_directory , arguments .destinations , arguments .pattern_matcher ), arguments .source_path )
122132 observer .start ()
123133
124134 # Print some initial information.
0 commit comments