mirror of
https://github.com/audacity/linuxdeploy.git
synced 2026-04-17 08:32:53 -05:00
Add support for input plugins
This commit is contained in:
@@ -42,6 +42,7 @@ int main(int argc, char** argv) {
|
||||
args::ValueFlag<std::string> customAppRunPath(parser, "AppRun path", "Path to custom AppRun script (linuxdeploy will not create a symlink but copy this file instead)", {"custom-apprun"});
|
||||
|
||||
args::Flag listPlugins(parser, "", "Search for plugins, print them to stdout and exit", {"list-plugins"});
|
||||
args::ValueFlagList<std::string> inputPlugins(parser, "name", "Input plugins to run (check whether they are available with --list-plugins)", {'p', "plugin"});
|
||||
args::ValueFlagList<std::string> outputPlugins(parser, "name", "Output plugins to run (check whether they are available with --list-plugins)", {'o', "output"});
|
||||
|
||||
try {
|
||||
@@ -210,6 +211,34 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (inputPlugins) {
|
||||
for (const auto& pluginName : inputPlugins.Get()) {
|
||||
auto it = foundPlugins.find(std::string(pluginName));
|
||||
|
||||
if (it == foundPlugins.end()) {
|
||||
ldLog() << LD_ERROR << "Could not find plugin:" << pluginName;
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto plugin = it->second;
|
||||
|
||||
if (plugin->pluginType() != linuxdeploy::plugin::INPUT_TYPE) {
|
||||
ldLog() << LD_ERROR << "Plugin" << pluginName << "has wrong type:" << plugin->pluginType() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ldLog() << std::endl << "-- Running input plugin:" << pluginName << "--" << std::endl;
|
||||
|
||||
auto retcode = plugin->run(appDir.path());
|
||||
|
||||
if (retcode != 0) {
|
||||
ldLog() << LD_ERROR << "Failed to run plugin:" << pluginName << std::endl;
|
||||
ldLog() << LD_DEBUG << "Exited with return code:" << retcode << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// search for desktop file and deploy it to AppDir root
|
||||
{
|
||||
ldLog() << std::endl << "-- Deploying files into AppDir root directory --" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user