mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2025-12-26 14:41:23 +00:00
scmi: revert to previous --help-devices behavior
Commit b37e7e5709 changed how
the --help-deices text output was used inadvertently by including it by
default in the help output. Restore the --help-devices argument and make
it exclusive: you cannot combine it with other arguments. This way,
socket_path does not have to be an Option<PathBuf>.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
This commit is contained in:
parent
4742cf1a28
commit
ddc25ecf34
@ -55,16 +55,27 @@ use vm_memory::{GuestMemoryAtomic, GuestMemoryMmap};
|
||||
type Result<T> = std::result::Result<T, String>;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about, long_about = None, after_help = devices_help())]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
struct ScmiArgs {
|
||||
// Location of vhost-user Unix domain socket.
|
||||
// Required, unless one of the --help options is used.
|
||||
#[clap(short, long, help = "vhost-user socket to use")]
|
||||
#[clap(
|
||||
short,
|
||||
long,
|
||||
default_value_if(
|
||||
"help_devices",
|
||||
clap::builder::ArgPredicate::IsPresent,
|
||||
"PathBuf::new()"
|
||||
),
|
||||
help = "vhost-user socket to use"
|
||||
)]
|
||||
socket_path: PathBuf,
|
||||
// Specification of SCMI devices to create.
|
||||
#[clap(short, long, help = "Devices to expose")]
|
||||
#[arg(num_args(1..))]
|
||||
device: Vec<String>,
|
||||
#[clap(long, exclusive = true, help = "Print help on available devices")]
|
||||
help_devices: bool,
|
||||
}
|
||||
|
||||
pub struct VuScmiConfig {
|
||||
@ -131,6 +142,10 @@ fn print_help(message: &String) {
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
let args = ScmiArgs::parse();
|
||||
if args.help_devices {
|
||||
println!("{}", devices_help());
|
||||
return;
|
||||
}
|
||||
match VuScmiConfig::try_from(args) {
|
||||
Ok(config) => {
|
||||
if let Err(error) = start_backend(config) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user