h2non/filetype.py

Suggest: add a command-line entry

yanhuihang opened this issue · 2 comments

That would be good.

dosas commented

@yanhuihang Could you elaborate on this?
Do you mean something like this: #2

@yanhuihang Could you elaborate on this?
Do you mean something like this: #2

Yes, just like this: #98

Test:

G:\Users\01\Desktop\filetype.py>filetype
usage: filetype [-h] [-v] file [file ...]
filetype: error: the following arguments are required: file

G:\Users\01\Desktop\filetype.py>filetype -h
usage: filetype [-h] [-v] file [file ...]

Determine type of FILEs.

positional arguments:
  file

optional arguments:
  -h, --help     show this help message and exit
  -v, --version  output version information and exit

G:\Users\01\Desktop\filetype.py>filetype G:\Users\01\Documents\singing.wma G:\Us
ers\01\Pictures\23632981.jpg
G:\Users\01\Documents\singing.wma: wmv (video/x-ms-wmv)
G:\Users\01\Pictures\23632981.jpg: jpg (image/jpeg)

G:\Users\01\Desktop\filetype.py>filetype G:\Users\01\Desktop\windows6.1-kb273177
1-x64.msu G:\Users\01\Documents\reading3.doc
G:\Users\01\Desktop\windows6.1-kb2731771-x64.msu: cab (application/vnd.ms-cab-co
mpressed)
G:\Users\01\Documents\reading3.doc: File type determination failure.

It would be great for Windows users, since there is not a utility like file.