Add better METAVAR info to some command-line flags.

This commit is contained in:
KtorZ 2024-10-25 10:57:16 +02:00
parent 7c4e044423
commit 8e90a933c6
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
3 changed files with 12 additions and 8 deletions

View File

@ -24,15 +24,16 @@ pub struct Args {
/// For example, `182A` designates an integer of value 42. If you're unsure about the shape of /// For example, `182A` designates an integer of value 42. If you're unsure about the shape of
/// the parameter, look at the schema specified in the project's blueprint (i.e. /// the parameter, look at the schema specified in the project's blueprint (i.e.
/// `plutus.json`), or use the `cbor.serialise` function from the Aiken standard library. /// `plutus.json`), or use the `cbor.serialise` function from the Aiken standard library.
#[clap(value_name = "CBOR")]
parameter: Option<String>, parameter: Option<String>,
/// Optional path to the blueprint file to be used as input. Default to 'plutus.json' when /// Optional path to the blueprint file to be used as input. Default to 'plutus.json' when
/// omitted. /// omitted.
#[clap(short, long = "in", value_parser)] #[clap(short, long = "in", value_parser, value_name = "FILEPATH")]
input: Option<PathBuf>, input: Option<PathBuf>,
/// Output file. Optional, print on stdout when omitted. /// Output file. Optional, print on stdout when omitted.
#[clap(short, long)] #[clap(short, long, value_name = "FILEPATH")]
out: Option<PathBuf>, out: Option<PathBuf>,
/// Name of the validator's module within the project. Optional if there's only one validator. /// Name of the validator's module within the project. Optional if there's only one validator.

View File

@ -30,11 +30,11 @@ pub struct Args {
watch: bool, watch: bool,
/// An initial seed to initialize the pseudo-random generator for property-tests. /// An initial seed to initialize the pseudo-random generator for property-tests.
#[clap(long)] #[clap(long, value_name = "UINT")]
seed: Option<u32>, seed: Option<u32>,
/// Maximum number of successful test run for considering a property-based test valid. /// Maximum number of successful test run for considering a property-based test valid.
#[clap(long, default_value_t = PropertyTest::DEFAULT_MAX_SUCCESS)] #[clap(long, default_value_t = PropertyTest::DEFAULT_MAX_SUCCESS, value_name="UINT")]
max_success: usize, max_success: usize,
/// Only run tests if they match any of these strings. /// Only run tests if they match any of these strings.

View File

@ -1,8 +1,8 @@
use miette::IntoDiagnostic; use miette::IntoDiagnostic;
use owo_colors::{OwoColorize, Stream::Stderr}; use owo_colors::{OwoColorize, Stream::Stderr};
use pallas_primitives::{ use pallas_primitives::{
conway::{Redeemer, TransactionInput, TransactionOutput},
Fragment, Fragment,
conway::{Redeemer, TransactionInput, TransactionOutput},
}; };
use pallas_traverse::{Era, MultiEraTx}; use pallas_traverse::{Era, MultiEraTx};
use std::{fmt, fs, path::PathBuf, process}; use std::{fmt, fs, path::PathBuf, process};
@ -18,6 +18,7 @@ use uplc::{
/// Simulate a transaction by evaluating it's script /// Simulate a transaction by evaluating it's script
pub struct Args { pub struct Args {
/// A file containing cbor hex for a transaction /// A file containing cbor hex for a transaction
#[clap(value_name = "FILEPATH")]
input: PathBuf, input: PathBuf,
/// Toggle whether input is raw cbor or a hex string /// Toggle whether input is raw cbor or a hex string
@ -25,21 +26,23 @@ pub struct Args {
cbor: bool, cbor: bool,
/// A file containing cbor hex for the raw inputs /// A file containing cbor hex for the raw inputs
#[clap(value_name = "FILEPATH")]
raw_inputs: PathBuf, raw_inputs: PathBuf,
/// A file containing cbor hex for the raw outputs /// A file containing cbor hex for the raw outputs
#[clap(value_name = "FILEPATH")]
raw_outputs: PathBuf, raw_outputs: PathBuf,
/// Time between each slot /// Time between each slot
#[clap(short, long, default_value_t = 1000)] #[clap(short, long, default_value_t = 1000, value_name = "MILLISECOND")]
slot_length: u32, slot_length: u32,
/// Time of shelley hardfork /// Time of shelley hardfork
#[clap(long, default_value_t = 1596059091000)] #[clap(long, default_value_t = 1596059091000, value_name = "POSIX")]
zero_time: u64, zero_time: u64,
/// Slot number at the start of the shelley hardfork /// Slot number at the start of the shelley hardfork
#[clap(long, default_value_t = 4492800)] #[clap(long, default_value_t = 4492800, value_name = "SLOT")]
zero_slot: u64, zero_slot: u64,
} }