mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 18:38:51 +00:00
Cmdline option to open a file in write mode (#2216)
* Added an option to directly enable write mode via -w/--writemode to the command line option parser
This commit is contained in:
parent
433f056ec5
commit
cd6fc26ed1
@ -50,7 +50,13 @@ Options
|
||||
|
||||
.. option:: -i <file>
|
||||
|
||||
Run script file
|
||||
Run script file
|
||||
|
||||
.. option:: -w, --writemode
|
||||
|
||||
Open a file in write mode, instead of the default read-only mode.
|
||||
When used together with -A/--analysis <level>, it will open a file directly
|
||||
in write mode without any further dialog or confirmation.
|
||||
|
||||
.. option:: --pythonhome <PYTHONHOME>
|
||||
|
||||
|
@ -241,7 +241,7 @@ bool CutterApplication::loadTranslations()
|
||||
return true;
|
||||
}
|
||||
const auto &allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript,
|
||||
QLocale::AnyCountry);
|
||||
QLocale::AnyCountry);
|
||||
|
||||
bool cutterTrLoaded = false;
|
||||
|
||||
@ -325,6 +325,11 @@ bool CutterApplication::parseCommandLineOptions()
|
||||
QObject::tr("file"));
|
||||
cmd_parser.addOption(scriptOption);
|
||||
|
||||
QCommandLineOption writeModeOption({"w", "writemode"},
|
||||
QObject::tr("Open file in write mode"));
|
||||
cmd_parser.addOption(writeModeOption);
|
||||
|
||||
|
||||
QCommandLineOption pythonHomeOption("pythonhome",
|
||||
QObject::tr("PYTHONHOME to use for embedded python interpreter"),
|
||||
"PYTHONHOME");
|
||||
@ -407,6 +412,8 @@ bool CutterApplication::parseCommandLineOptions()
|
||||
break;
|
||||
}
|
||||
opts.fileOpenOptions.script = cmd_parser.value(scriptOption);
|
||||
|
||||
opts.fileOpenOptions.writeEnabled = cmd_parser.isSet(writeModeOption);
|
||||
}
|
||||
|
||||
if (cmd_parser.isSet(pythonHomeOption)) {
|
||||
|
@ -165,6 +165,9 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options)
|
||||
ui->entry_loadOffset->setText(RAddressString(options.binLoadAddr));
|
||||
}
|
||||
|
||||
ui->writeCheckBox->setChecked(options.writeEnabled);
|
||||
|
||||
|
||||
// TODO: all other options should also be applied to the ui
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user