driver_tools/subcommands/dump/
args.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
5use argh::{ArgsInfo, FromArgs};
6
7#[derive(ArgsInfo, FromArgs, Debug, PartialEq)]
8#[argh(
9    subcommand,
10    name = "dump",
11    description = "Dump device tree",
12    example = "To dump the device tree:
13
14    $ driver dump\n",
15    example = "To dump the subtree of the device tree under a node:
16
17    $ driver dump my-node-name\n",
18    error_code(1, "Failed to connect to the driver development service"),
19    example = "To graph device tree:
20
21    $ driver dump --graph | dot -Tpng | display"
22)]
23pub struct DumpCommand {
24    /// the device name to dump. All devices with this name will have their subtree printed. If
25    /// this is not supplied then the entire device tree will be dumped.
26    #[argh(positional)]
27    pub device: Option<String>,
28
29    /// output device graph in dot language so that it may be viewed
30    #[argh(switch, short = 'g', long = "graph")]
31    pub graph: bool,
32
33    /// if this exists, the user will be prompted for a component to select.
34    #[argh(switch, short = 's', long = "select")]
35    pub select: bool,
36}