Add actual image processing

This commit is contained in:
Bob Polis 2024-01-19 12:04:47 +01:00
parent 60dd2f5b70
commit 52ad6f619d

View File

@ -3,10 +3,12 @@
#include <string>
#include <stdexcept>
#include <getopt.h>
#include <netpbm/pam.h>
#include "commit.inc"
#include "pixels.hpp"
void print_help() {
std::cout << "usage: termage [-h|--version]\n";
std::cout << "usage: termage [-h|--version] <imagefile>\n";
std::cout << " -h, --help show this help text and exit\n";
std::cout << " --version show version number and exit\n";
}
@ -21,6 +23,7 @@ void print_version() {
int main(int argc, char* argv[]) {
try {
pm_init("termage", 0);
int opt_char, opt_val;
struct option long_options[] = {
{"help", no_argument, nullptr, 'h'},
@ -52,11 +55,11 @@ int main(int argc, char* argv[]) {
for (int i = optind; i < argc; ++i) {
try {
// process file argv[i]
write_image(std::cout, argv[i]);
} catch (const std::runtime_error& ex) {
std::cerr << "termage: " << ex.what() << '\n';
}
}
std::cout << "hello, termage\n";
} catch (const std::exception& ex) {
std::cerr << "termage: " << ex.what() << '\n';
return EXIT_FAILURE;