xref: /cloud-hypervisor/vhost_user_net/src/main.rs (revision 3f8cd52ffd74627242cb7e8ea1c2bdedadf6741a)
1 // Copyright 2019 Intel Corporation. All Rights Reserved.
2 //
3 // Portions Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 //
5 // Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
6 //
7 // SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause)
8 
9 use clap::{Arg, Command};
10 use vhost_user_net::start_net_backend;
11 
12 fn main() {
13     env_logger::init();
14 
15     let cmd_arguments = Command::new("vhost-user-net backend")
16         .version(env!("CARGO_PKG_VERSION"))
17         .author(env!("CARGO_PKG_AUTHORS"))
18         .about("Launch a vhost-user-net backend.")
19         .arg_required_else_help(true)
20         .arg(
21             Arg::new("net-backend")
22                 .long("net-backend")
23                 .help(vhost_user_net::SYNTAX)
24                 .num_args(1)
25                 .required(true),
26         )
27         .get_matches();
28 
29     let backend_command = cmd_arguments.get_one::<String>("net-backend").unwrap();
30     start_net_backend(backend_command);
31 }
32