Tweak cli args
This commit is contained in:
parent
b6b3485a0a
commit
feff1e219f
|
@ -24,16 +24,16 @@ use tectonic_bundles::detect_bundle;
|
|||
#[derive(Debug, Parser)]
|
||||
pub struct CompileOptions {
|
||||
/// The file to process, or "-" to process the standard input stream
|
||||
#[arg(name = "input", value_hint = clap::ValueHint::FilePath)]
|
||||
#[arg(value_hint = clap::ValueHint::FilePath)]
|
||||
input: String,
|
||||
|
||||
/// The name of the "format" file used to initialize the TeX engine
|
||||
#[arg(long, short, name = "path", default_value = "latex")]
|
||||
format: String,
|
||||
|
||||
/// Use this directory or Zip-format bundle file to find resource files instead of the default
|
||||
#[arg(long, short, name = "file_path")]
|
||||
bundle: Option<PathBuf>,
|
||||
/// Use this URL or path to find resource files instead of the default
|
||||
#[arg(long, short)]
|
||||
bundle: Option<String>,
|
||||
|
||||
/// Use only resource files cached locally
|
||||
#[arg(short = 'C', long)]
|
||||
|
@ -86,10 +86,6 @@ pub struct CompileOptions {
|
|||
/// Unstable options. Pass -Zhelp to show a list
|
||||
#[arg(name = "option", short = 'Z')]
|
||||
unstable: Vec<UnstableArg>,
|
||||
|
||||
/// Use this URL to find resource files instead of the default
|
||||
#[arg(long, short, name = "url", overrides_with = "url", global(true))]
|
||||
web_bundle: Option<String>,
|
||||
}
|
||||
|
||||
// TODO: deprecate v1 interface and move this to v2cli/commands
|
||||
|
|
|
@ -43,11 +43,11 @@ struct CliOptions {
|
|||
use_v2: bool,
|
||||
|
||||
/// How much chatter to print when running
|
||||
#[arg(long = "chatter", short, name = "level", default_value = "default")]
|
||||
#[arg(long = "chatter", short, default_value = "default")]
|
||||
chatter_level: ChatterLevel,
|
||||
|
||||
/// Enable/disable colorful log output
|
||||
#[arg(long = "color", name = "when", default_value = "auto")]
|
||||
#[arg(long = "color", default_value = "auto")]
|
||||
cli_color: CliColor,
|
||||
|
||||
#[command(flatten)]
|
||||
|
|
|
@ -44,18 +44,18 @@ pub struct BuildCommand {
|
|||
target: Option<String>,
|
||||
|
||||
/// Use this URL to find resource files instead of the default
|
||||
#[arg(long, short, name = "url", overrides_with = "url", global(true))]
|
||||
web_bundle: Option<String>,
|
||||
#[arg(long, short)]
|
||||
bundle: Option<String>,
|
||||
}
|
||||
|
||||
impl TectonicCommand for BuildCommand {
|
||||
fn customize(&self, _cc: &mut CommandCustomizations) {}
|
||||
|
||||
fn execute(self, config: PersistentConfig, status: &mut dyn StatusBackend) -> Result<i32> {
|
||||
// `--web-bundle` is not actually used for `-X build`,
|
||||
// so inform the user instead of ignoring silently.
|
||||
if let Some(url) = &self.web_bundle {
|
||||
tt_note!(status, "--web-bundle {} ignored", url);
|
||||
// `--bundle` is not used for `-X build`,
|
||||
// tell the user instead of ignoring silently.
|
||||
if let Some(url) = &self.bundle {
|
||||
tt_note!(status, "--bundle {} ignored", url);
|
||||
tt_note!(status, "using workspace bundle configuration");
|
||||
}
|
||||
let ws = Workspace::open_from_environment()?;
|
||||
|
|
|
@ -57,7 +57,7 @@ pub struct BundleCreateCommand {
|
|||
|
||||
/// Build directory for this bundle.
|
||||
/// Will be removed.
|
||||
#[arg(short, long)]
|
||||
#[arg(long)]
|
||||
pub build_dir: PathBuf,
|
||||
|
||||
/// What kind of bundle should we produce?
|
||||
|
|
|
@ -13,8 +13,8 @@ use crate::v2cli::{CommandCustomizations, TectonicCommand};
|
|||
#[derive(Debug, Eq, PartialEq, Parser)]
|
||||
pub struct InitCommand {
|
||||
/// Use this URL to find resource files instead of the default
|
||||
#[arg(long, short, name = "url", overrides_with = "url", global(true))]
|
||||
web_bundle: Option<String>,
|
||||
#[arg(long, short)]
|
||||
bundle: Option<String>,
|
||||
}
|
||||
|
||||
impl TectonicCommand for InitCommand {
|
||||
|
@ -45,8 +45,8 @@ pub struct NewCommand {
|
|||
path: PathBuf,
|
||||
|
||||
/// Use this URL to find resource files instead of the default
|
||||
#[arg(long, short, name = "url", overrides_with = "url", global(true))]
|
||||
web_bundle: Option<String>,
|
||||
#[arg(long, short)]
|
||||
bundle: Option<String>,
|
||||
}
|
||||
|
||||
impl TectonicCommand for NewCommand {
|
||||
|
|
|
@ -37,25 +37,13 @@ mod commands;
|
|||
|
||||
struct V2CliOptions {
|
||||
/// How much chatter to print when running
|
||||
#[arg(long = "chatter", short, name = "level", default_value = "default")]
|
||||
#[arg(long = "chatter", short, default_value = "default")]
|
||||
chatter_level: ChatterLevel,
|
||||
|
||||
/// Control colorization of output
|
||||
#[arg(long = "color", name = "when", default_value = "auto")]
|
||||
#[arg(long = "color", default_value = "auto")]
|
||||
cli_color: crate::CliColor,
|
||||
|
||||
/// Use this URL to find resource files instead of the default
|
||||
// TODO add URL validation
|
||||
#[arg(
|
||||
long,
|
||||
short,
|
||||
name = "url",
|
||||
overrides_with = "url",
|
||||
// This is inherited by some subcommands
|
||||
global(true)
|
||||
)]
|
||||
web_bundle: Option<String>,
|
||||
|
||||
/// The command to run
|
||||
#[command(subcommand)]
|
||||
command: Commands,
|
||||
|
|
Loading…
Reference in New Issue