Ever wish you could do something like view $(findheader signal.h)
—and have it be fast? Now you can.
(open -h is one alternative, but that opens it in Xcode, rather than a terminal-based or other editor.)
Basically, it's like “Open Quickly” for the command line.
Place the .py file in your ~/bin (or other such directory of your choice) under two names (by hard-linking or copying):
- indexheaders (note plural)
- findheader
Don't forget to chmod +x it (or the copies, if you copy instead of link).
First, run indexheaders
. This will generate an index of pathnames of all of your latest-OS-X-SDK (or, if Xcode is not installed, system) headers, stored at ~/Library/Caches/Header Index.
Subsequently, you can run findheader <header-name>
to find the location of a header by name.
indexheaders supports a --xcode=<path>
if you'd like it to look in a specific Xcode (such as a beta).
Currently, it always uses the latest OS X SDK in that Xcode. There's no provision to choose another platform (iPhoneOS) or another SDK version at this time.
If you really want to index system headers rather than SDK headers, --xcode=/
works.
This is really old code, updated only to be aware of Xcode SDKs. For example, it doesn't use optparse, much less argparse.
Despite the name and purpose, it indexes all files, not only headers. This may be a virtue: You could probably find certain frameworks' internal PNG or ICNS files, for example.
Also, despite the name, it does not index file contents.