{
fprintf(stdout,
"Usage:\n"
- " %s [OPTION…] — %s\n"
+ " %s [OPTIONS] [FILE]\n"
"\n"
"Help Options:\n"
" -h, -?, --help Show help option\n"
" -l, --loglevel Set libsigrok/libsigrokdecode loglevel\n"
" -i, --input-file Load input from file\n"
" -I, --input-format Input format\n"
- "\n", PV_BIN_NAME, PV_DESCRIPTION);
+ " -c, --clean Don't restore previous sessions on startup\n"
+ "\n", PV_BIN_NAME);
}
int main(int argc, char *argv[])
int ret = 0;
shared_ptr<sigrok::Context> context;
string open_file, open_file_format;
+ bool restore_sessions = true;
Application a(argc, argv);
{"loglevel", required_argument, nullptr, 'l'},
{"input-file", required_argument, nullptr, 'i'},
{"input-format", required_argument, nullptr, 'I'},
+ {"clean", no_argument, nullptr, 'c'},
{nullptr, 0, nullptr, 0}
};
const int c = getopt_long(argc, argv,
- "l:Vh?i:I:", long_options, nullptr);
+ "l:Vhc?i:I:", long_options, nullptr);
if (c == -1)
break;
case 'I':
open_file_format = optarg;
break;
+
+ case 'c':
+ restore_sessions = false;
+ break;
}
}
pv::DeviceManager device_manager(context);
// Initialise the main window
- pv::MainWindow w(device_manager,
- open_file, open_file_format);
+ pv::MainWindow w(device_manager);
w.show();
+ if (restore_sessions)
+ w.restore_sessions();
+
+ if (!open_file.empty())
+ w.add_session_with_file(open_file, open_file_format);
+ else
+ w.add_default_session();
+
#ifdef ENABLE_SIGNALS
if (SignalHandler::prepare_signals()) {
SignalHandler *const handler =