driver_tools/subcommands/test_node/
mod.rs

1// Copyright 2022 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5pub mod args;
6
7mod subcommands;
8
9use anyhow::{Context, Result};
10use args::{TestNodeCommand, TestNodeSubcommand};
11use fidl_fuchsia_driver_development as fdd;
12
13pub async fn test_node(
14    cmd: &TestNodeCommand,
15    driver_development_proxy: fdd::ManagerProxy,
16) -> Result<()> {
17    match cmd.subcommand {
18        TestNodeSubcommand::Add(ref subcmd) => {
19            subcommands::add::add_test_node(subcmd, driver_development_proxy)
20                .await
21                .context("Add subcommand failed")?;
22        }
23        TestNodeSubcommand::Remove(ref subcmd) => {
24            subcommands::remove::remove_test_node(subcmd, driver_development_proxy)
25                .await
26                .context("Remove subcommand failed")?;
27        }
28    };
29    Ok(())
30}