File tree Expand file tree Collapse file tree 2 files changed +26
-23
lines changed Expand file tree Collapse file tree 2 files changed +26
-23
lines changed Original file line number Diff line number Diff line change 11import filetype
22
3+
34def guess (path ):
4- kind = filetype .guess (path )
5- if kind is None :
6- print ('{}: File type determination failure.' .format (path ))
7- else :
8- print ('{}: {} ({})' .format (path , kind .extension , kind .mime ))
5+ kind = filetype .guess (path )
6+ if kind is None :
7+ print ('{}: File type determination failure.' .format (path ))
8+ else :
9+ print ('{}: {} ({})' .format (path , kind .extension , kind .mime ))
10+
911
1012def main ():
11- import argparse
12-
13- parser = argparse .ArgumentParser (description = 'Determine type of FILEs.' )
14- parser .add_argument ("file" , nargs = '+' )
15- parser .add_argument ('-v' , '--version' , action = 'store_true' ,
16- help = 'output version information and exit' )
17- args = parser .parse_args ()
18-
19- if args .version :
20- print (filetype .version )
21- else :
22- for i in args .file :
23- guess (i )
24-
13+ import argparse
14+
15+ parser = argparse .ArgumentParser (description = 'Determine type of FILEs.' )
16+ parser .add_argument ("file" , nargs = '+' )
17+ parser .add_argument ('-v' , '--version' , action = 'store_true' ,
18+ help = 'output version information and exit' )
19+ args = parser .parse_args ()
20+
21+ if args .version :
22+ print (filetype .version )
23+ else :
24+ for i in args .file :
25+ guess (i )
26+
27+
2528if __name__ == '__main__' :
26- main ()
29+ main ()
Original file line number Diff line number Diff line change 4040 'examples' ]),
4141 package_data = {'filetype' : ['LICENSE' , '*.md' ]},
4242 zip_safe = True ,
43- entry_points = {
44- 'console_scripts' : [ 'filetype=filetype.__main__:main' ],
45- })
43+ entry_points = {
44+ 'console_scripts' : ['filetype=filetype.__main__:main' ],
45+ })
You can’t perform that action at this time.
0 commit comments