blob: 40160b75a2eb4b191ce0a825e7fb93b38c48b345 [file] [log] [blame]
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "cli_parser.hpp"
#include "dbus_interface.hpp"
#include "hoth_dbus.hpp"
#include "parser.hpp"
#include "payload_update_cli.hpp"
#include "payload_update_common.hpp"
#include <iostream>
int main(int argc, char* argv[])
{
using google::hoth::tools::CLIParser;
using google::hoth::tools::HothDBus;
using google::hoth::tools::payload_update::PayloadUpdateCLI;
auto cli = PayloadUpdateCLI(
std::make_unique<CLIParser>(argc, argv), std::make_unique<HothDBus>());
if (!cli.getOptions())
{
return EXIT_FAILURE;
}
try {
if (!cli.execute())
{
std::cerr << argv[0] << ": Failed to execute command!" << '\n';
return EXIT_FAILURE;
}
}
catch (const std::exception& e)
{
std::cerr << "Failed to execute command: " << e.what()
<< '\n';
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}