vhost-device/vhost-device-scmi/src/args.rs
Manos Pitsidianakis 5624abb31f scmi: move CLI arg types to lib submodule
Currently, the main CLI struct type is defined in src/main.rs thus
inaccessible when using the crate as a library. Move it to its own
module under src/args.rs

This will be useful in the followup commit that will use src/args.rs
directly to generate manual pages using clap_mangen from the xtask crate
in this workspace.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2025-04-15 14:25:32 +05:30

33 lines
997 B
Rust

// SPDX-FileCopyrightText: Red Hat, Inc.
// SPDX-License-Identifier: Apache-2.0
// Based on implementation of other devices here, Copyright by Linaro Ltd.
//! An arguments type for the binary interface of this library.
use std::path::PathBuf;
use clap::Parser;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
pub struct ScmiArgs {
// Location of vhost-user Unix domain socket.
// Required, unless one of the --help options is used.
#[clap(
short,
long,
default_value_if(
"help_devices",
clap::builder::ArgPredicate::IsPresent,
"PathBuf::new()"
),
help = "vhost-user socket to use"
)]
pub socket_path: PathBuf,
// Specification of SCMI devices to create.
#[clap(short, long, help = "Devices to expose")]
#[arg(num_args(1..))]
pub device: Vec<String>,
#[clap(long, exclusive = true, help = "Print help on available devices")]
pub help_devices: bool,
}