blob: c5c8dff86d40c83d613523accc16015ba8b823ea [file] [log] [blame]
// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Manage product bundles, prepare them for OTAs, and convert them to build
//! archives.
mod build_archive;
mod product_description;
mod transfer_manifest;
use crate::product_description::GenerateProductDescription;
use crate::transfer_manifest::GenerateTransferManifest;
use anyhow::Result;
use argh::FromArgs;
use build_archive::GenerateBuildArchive;
/// Tool for managing product bundles that is specific to fuchsia infrastructure.
#[derive(FromArgs, PartialEq, Debug)]
struct Command {
/// the nested subcommands.
sub: Subcommand,
/// Subcommands for pbtool.
#[derive(FromArgs, PartialEq, Debug)]
enum Subcommand {
/// Generate a build archive.
/// Generate a description of the product bundle with a link to the transfer
/// manifest json file.
/// Generate the transfer manifest which lists how to upload/download the
/// product bundle.
async fn main() -> Result<()> {
let command = argh::from_env::<Command>();
match command.sub {
Subcommand::GenerateBuildArchive(cmd) => cmd.generate(),
Subcommand::GenerateProductDescription(cmd) => cmd.generate(),
Subcommand::GenerateTransferManifest(cmd) => cmd.generate().await,