Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af09ff0d authored by Mark Wheatley's avatar Mark Wheatley Committed by Gerrit Code Review
Browse files

Merge "Migrate pdl from structopt to clap 3"

parents 72c040f5 cbaacae9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ rust_defaults {
        "libquote",
        "libserde",
        "libserde_json",
        "libstructopt",
        "libclap",
        "libsyn",
        "libtempfile",
    ],
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ proc-macro2 = "*"
quote = "*"
serde = { version = "*", features = ["default", "derive", "serde_derive", "std"] }
serde_json = "*"
structopt = "*"
clap = { version = "*", features = ["derive"] }
syn = "*"

[dev-dependencies]
+6 −6
Original line number Diff line number Diff line
//! PDL parser and linter.

use clap::Parser;
use codespan_reporting::term::{self, termcolor};
use structopt::StructOpt;

mod ast;
mod backends;
@@ -30,20 +30,20 @@ impl std::str::FromStr for OutputFormat {
    }
}

#[derive(Debug, StructOpt)]
#[structopt(name = "pdl-parser", about = "Packet Description Language parser tool.")]
#[derive(Parser, Debug)]
#[clap(name = "pdl-parser", about = "Packet Description Language parser tool.")]
struct Opt {
    /// Print tool version and exit.
    #[structopt(short, long = "--version")]
    #[clap(short, long = "--version")]
    version: bool,

    /// Generate output in this format ("json" or "rust"). The output
    /// will be printed on stdout in both cases.
    #[structopt(short, long = "--output-format", name = "FORMAT", default_value = "JSON")]
    #[clap(short, long = "--output-format", name = "FORMAT", default_value = "JSON")]
    output_format: OutputFormat,

    /// Input file.
    #[structopt(name = "FILE")]
    #[clap(name = "FILE")]
    input_file: String,
}