72int main(
int argc,
char* argv[])
75 auto show_version = [] {
76 std::cout << PACKAGE_NAME <<
" version " << PACKAGE_VERSION << std::endl;
79 auto simple_usage = [=] {
80 std::cout <<
"Usage:\n " << argv[0] <<
" [OPTIONS] FILE\n\n"
82 std::cout <<
" -h, --help\t\t\t";
83 std::cout <<
"show this help, then exit\n";
84 std::cout <<
" -v, --version\t\t\t";
85 std::cout <<
"show version information, then exit\n";
94 std::cout <<
" -t, --finalcut\t\t";
95 std::cout <<
"run with FINALCUT user interface\n";
98 std::cout <<
" -x, --ftxui\t\t\t";
99 std::cout <<
"run with FTXUI user interface\n";
103 std::string filename;
111 std::string my_arg_options{
"vh"};
113 my_arg_options +=
"t";
116 my_arg_options +=
"x";
121 struct option long_options[] = {
123 {
"help", no_argument,
nullptr,
'h'},
124 {
"version", no_argument,
nullptr,
'v'},
126 {
"ftxui", no_argument, &ftx_flag,
'x'},
129 {
"finalcut", no_argument, &fcut_flag,
't'},
131 {
nullptr, 0,
nullptr, 0}
134 int ch, option_index;
135 while ((ch = getopt_long(argc, argv,
136 my_arg_options.c_str(),
138 &option_index)) != -1) {
164 if (optind > 0 && optind < argc)
165 filename = std::string{argv[argc -1]};
169 for (
int i = 1; i < argc; i++) {
170 std::string arg{argv[i]};
171 if (arg ==
"-v" || arg ==
"--version") {
175 }
else if (arg ==
"-t" || arg ==
"--finalcut") {
179 }
else if (arg ==
"-x" || arg ==
"--ftxui") {
182 }
else if (arg ==
"--") {
184 }
else if (arg ==
"-h" || arg ==
"--help") {
187 }
else if (arg.starts_with(
'-')) {
189 std::cout << argv[0] <<
": illegal option -- " << arg <<
'\n';
200 if (! (fcut_flag || ftx_flag))
214 if (filename.empty()) {
218 KitListFtxui ftxui_app;
219 ftxui_app.run(filename);
225 finalcut_app.
run(argc, argv, filename);
229 std::cerr <<
"\nERROR: " << PACKAGE_NAME
230 <<
" has been built without enabling an interface.\n"
231 <<
"Configure with at least one of "
232 <<
"'--enable-gui', '--enable-ftxui' or\n'--enable-finalcut'. "
233 <<
"Run 'configure --help' in the source folder "
234 <<
"to see the\navailable options.\n"
238 }
catch (
const std::exception& e) {
239 std::cerr <<
"Exception: " << e.what() << std::endl;
int main(int argc, char *argv[])