2003-07-06 15:11:02 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "hash.hh"
|
|
|
|
#include "shared.hh"
|
2003-12-01 15:55:05 +00:00
|
|
|
#include "help.txt.hh"
|
|
|
|
|
|
|
|
|
|
|
|
void printHelp()
|
|
|
|
{
|
|
|
|
cout << string((char *) helpText, sizeof helpText);
|
|
|
|
}
|
2003-07-06 15:11:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
void run(Strings args)
|
|
|
|
{
|
2003-08-06 09:06:32 +00:00
|
|
|
bool flat = false;
|
|
|
|
for (Strings::iterator i = args.begin();
|
|
|
|
i != args.end(); i++)
|
|
|
|
if (*i == "--flat") flat = true;
|
|
|
|
else
|
|
|
|
cout << format("%1%\n") % (string)
|
|
|
|
(flat ? hashFile(*i) : hashPath(*i));
|
2003-07-06 15:11:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string programId = "nix-hash";
|
|
|
|
|