I'd like to make a diff between to file, one is local and the other is online using for example
opendiff http://www.tex.ac.uk/ctan/web/lua2dox/Doxyfile Doxyfile
But it throw the following error :
2014-02-12 15:23:43.579 opendiff[72650:1007] /Users/Dev/Joker/http:/www.tex.ac.uk/ctan/web/lua2dox/Doxyfile does not exist
So how can I use a online file the same way as a local one ?
Since this is a programming Q&A site, we may as well write a program to do this for us :-)
You can create a script called (for example)
odw
forOpenDiffWeb
which will detect whether you're trying to access web-based files and first download them to a temporary location.Examine the following script, it's pretty rudimentary but it shows the approach that can be taken.
In this case, we detect a web-based file as one starting with
http://
. If it is, we simply usewget
to bring it down to a temporary location. Both files are checked this way.Once both files are on the local disk (either because they were brought down or because thet were already there), you can run the
diff
- I've used the standarddiff
but you can substitute your own.Then, the temporary files are cleaned up.
As a test, I downloaded the page
http://www.example.com
and made a very minor change to it then compared the page to my modified local copy:Now there's all sorts of added stuff that could go into that script, the ability to pass flags to the
diff
andwget
programs, the ability to handle other URL types, deletion of temporary files on signals and so on.But it should hopefully be enough to get you started.