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>
|
.. 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>
|
.. option:: --pythonhome <PYTHONHOME>
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ bool CutterApplication::loadTranslations()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const auto &allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript,
|
const auto &allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript,
|
||||||
QLocale::AnyCountry);
|
QLocale::AnyCountry);
|
||||||
|
|
||||||
bool cutterTrLoaded = false;
|
bool cutterTrLoaded = false;
|
||||||
|
|
||||||
@ -325,6 +325,11 @@ bool CutterApplication::parseCommandLineOptions()
|
|||||||
QObject::tr("file"));
|
QObject::tr("file"));
|
||||||
cmd_parser.addOption(scriptOption);
|
cmd_parser.addOption(scriptOption);
|
||||||
|
|
||||||
|
QCommandLineOption writeModeOption({"w", "writemode"},
|
||||||
|
QObject::tr("Open file in write mode"));
|
||||||
|
cmd_parser.addOption(writeModeOption);
|
||||||
|
|
||||||
|
|
||||||
QCommandLineOption pythonHomeOption("pythonhome",
|
QCommandLineOption pythonHomeOption("pythonhome",
|
||||||
QObject::tr("PYTHONHOME to use for embedded python interpreter"),
|
QObject::tr("PYTHONHOME to use for embedded python interpreter"),
|
||||||
"PYTHONHOME");
|
"PYTHONHOME");
|
||||||
@ -407,6 +412,8 @@ bool CutterApplication::parseCommandLineOptions()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
opts.fileOpenOptions.script = cmd_parser.value(scriptOption);
|
opts.fileOpenOptions.script = cmd_parser.value(scriptOption);
|
||||||
|
|
||||||
|
opts.fileOpenOptions.writeEnabled = cmd_parser.isSet(writeModeOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd_parser.isSet(pythonHomeOption)) {
|
if (cmd_parser.isSet(pythonHomeOption)) {
|
||||||
|
@ -165,6 +165,9 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options)
|
|||||||
ui->entry_loadOffset->setText(RAddressString(options.binLoadAddr));
|
ui->entry_loadOffset->setText(RAddressString(options.binLoadAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->writeCheckBox->setChecked(options.writeEnabled);
|
||||||
|
|
||||||
|
|
||||||
// TODO: all other options should also be applied to the ui
|
// TODO: all other options should also be applied to the ui
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user