@@ -76,13 +76,17 @@ def main():
7676 keyword ),
7777 "green" )
7878
79+ if args .noSorting is False :
80+ path_file = path .join ("files" , keyword , "{0}.txt" .format (entry ["key" ]))
81+
7982 with open (path_file , "w+" , encoding = 'utf-8' ) as entry_file :
8083 entry_file .write (entry_content )
8184
8285 break
8386 else :
8487 with open (path_file , "w+" , encoding = 'utf-8' ) as entry_file :
8588 entry_file .write (entry_content )
89+
8690 bar .suffix = "%(index)d/%(max)d Saving paste \' {0}\' " .format (entry ["key" ])
8791
8892 bar .next ()
@@ -113,7 +117,7 @@ def main():
113117
114118 AUTHOR = "SYRAPT0R"
115119 COPYRIGHT = "2019-2020"
116- VERSION = "0.4. 5"
120+ VERSION = "0.5"
117121
118122 # parse arguments
119123 keywords = None
@@ -123,6 +127,8 @@ def main():
123127 parser .add_argument ("-k" , "--keywords" , help = "A file containing keywords for the search" )
124128 parser .add_argument ("-i" , "--infinite" , help = "Whether to run in infinite mode (Default: false)" ,
125129 action = "store_true" , default = False )
130+ parser .add_argument ("-nS" , "--noSorting" , help = "Whether to sort keyword pastes into subdirectories" ,
131+ action = "store_true" , default = False )
126132
127133 args = parser .parse_args ()
128134
@@ -141,11 +147,18 @@ def main():
141147
142148 except IOError :
143149 status (termcolor .colored ("Unable to load specified keyword file. Aborting..." , "red" ))
144-
145150 exit (0 )
146151
147152 keywords = [keyword .strip () for keyword in keywords ]
148153
154+ # create subdirectories if required
155+ if args .noSorting is False :
156+ for keyword in keywords :
157+ current_path = path .join ("files" , keyword )
158+ if not path .isdir (current_path ):
159+ status (termcolor .colored ("Creating directory {0}" .format (current_path ), "yellow" ))
160+ mkdir (current_path )
161+
149162 status ("Loaded {0} keywords" .format (len (keywords )))
150163
151164 # create paste ID index
0 commit comments