@@ -28,7 +28,7 @@ def printSpliter(length=25):
2828 description = "pubmedsoso is a python program for crawler article information and download pdf file" ,
2929 usage = "python main.py -k keyword" )
3030
31- parser .add_argument ('-v' , '--version' , action = 'version' ,
31+ parser .add_argument ('-v ' , '--version' , action = 'version' ,
3232 version = f'\n Current the { ProjectInfo .ProjectName } \n \n version: { ProjectInfo .VersionInfo } \n ' +
3333 f'Last updated date: { ProjectInfo .LastUpdate } \n ' +
3434 f'Author: { ProjectInfo .AuthorName } \n ' ,
@@ -85,7 +85,14 @@ def printSpliter(length=25):
8585 parser .add_argument ("-l" , "--loglevel" , metavar = '' ,
8686 choices = ('debug' , 'info' , 'warning' , 'error' , 'critical' ),
8787 help = 'set the terminal log level while the file log level'
88- ' can only be configured in config.py. Default log level is info' , default = None )
88+ 'the choice of loglevel is "debug" "info" "warning" "error" "critical" '
89+ ' can only be configured in config.py. Default log level is info'
90+ ' ' , default = None )
91+
92+ parser .add_argument ("-Y " , "--yes" , action = "store_true" ,
93+ help = 'add --yes or -Y to skip the confirmation process and start searching directly' ,
94+ default = False )
95+
8996 # todo
9097 # add mutual exclusive group for some args
9198
@@ -135,10 +142,13 @@ def printSpliter(length=25):
135142 except Exception as err :
136143 raise
137144
138- if os .getenv ("DEBUG" ):
145+ medLog .info ("当前关键词在pubmed检索到的相关结果数量为: %s\n " % result_num )
146+
147+ # add --yes parameter to skip the confirmation
148+ if args .Yes is True :
139149 pass
140150 else :
141- medLog . info ( "当前关键词在pubmed检索到的相关结果数量为: %s \n " % result_num )
151+
142152 medLog .info ("是否要根据以上参数开始执行程序?y or n\n " )
143153 startFlag = input ()
144154 if startFlag == 'y' or startFlag == 'Y' or startFlag == 'Yes' :
0 commit comments