What it actually means is that it needs the various XDG basedir variables to be set, which they sometimes aren't in a non-desktop session (this is becoming less common).
xdg-mime merely looks at the shared-mime-info db, processes files accordingly and spits out the result.
Also, I did not actually say you should use xdg-mime; I said you should use the shared-mime-info database. xdg-mime is a (very crappy) interface for it, but using an xdg library is a lot, lot more efficient.
For use on the command line, feel free to use xdg-mime (it does not just do mime types, it also does associations with them which means you can view and change associations between file types from it). I don't know of any other tool like it although I was working on one in python (but it's not production ready).
http://standards.freedesktop.org/basedir-spec/basedir-spec-l...
xdg-mime merely looks at the shared-mime-info db, processes files accordingly and spits out the result.
Also, I did not actually say you should use xdg-mime; I said you should use the shared-mime-info database. xdg-mime is a (very crappy) interface for it, but using an xdg library is a lot, lot more efficient.