tigersum/main.d

20 lines
461 B
D
Raw Normal View History

2014-09-19 16:19:25 +00:00
import std.stdio;
import std.file;
2014-09-24 18:36:53 +00:00
import tiger;
2014-09-19 16:19:25 +00:00
void main (string[] parArgs) {
const auto cwd = getcwd();
const auto working_dir = cwd ~ (cwd[$-1] == '/' ? "" : "/");
foreach (arg; parArgs[1 .. $]) {
const auto curr_path = working_dir ~ arg;
File curr_file = File(curr_path, "rb");
if (!isDir(curr_path)) {
writefln("%s %s", tigerToString(getTiger(curr_file, true)), arg);
}
else {
writefln("tigersum: %s: is a directory", arg);
}
}
2014-09-19 16:19:25 +00:00
}