difftreelog
build upgrade dependencies
in: master
13 files changed
cmds/jrsonnet/Cargo.tomldiffbeforeafterboth--- a/cmds/jrsonnet/Cargo.toml
+++ b/cmds/jrsonnet/Cargo.toml
@@ -28,5 +28,5 @@
mimallocator = { version = "0.1.3", optional = true }
thiserror = "1.0"
-clap = { version = "3.2", features = ["derive"] }
-clap_complete = { version = "3.2" }
+clap = { version = "4.0", features = ["derive"] }
+clap_complete = { version = "4.0" }
cmds/jrsonnet/src/main.rsdiffbeforeafterboth--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -3,7 +3,7 @@
io::{Read, Write},
};
-use clap::{AppSettings, IntoApp, Parser};
+use clap::{CommandFactory, Parser};
use clap_complete::Shell;
use jrsonnet_cli::{ConfigureState, GeneralOpts, ManifestOpts, OutputOpts};
use jrsonnet_evaluator::{error::LocError, State};
@@ -42,10 +42,7 @@
}
#[derive(Parser)]
-#[clap(
- global_setting = AppSettings::DeriveDisplayOrder,
- args_conflicts_with_subcommands = true,
-)]
+#[clap(args_conflicts_with_subcommands = true, disable_version_flag = true)]
struct Opts {
#[clap(subcommand)]
sub: Option<SubOpts>,
crates/jrsonnet-cli/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-cli/Cargo.toml
+++ b/crates/jrsonnet-cli/Cargo.toml
@@ -21,4 +21,4 @@
jrsonnet-gcmodule = { version = "0.3.4" }
jrsonnet-stdlib = { path = "../../crates/jrsonnet-stdlib", version = "0.4.2" }
-clap = { version = "3.2", features = ["derive"] }
+clap = { version = "4.0", features = ["derive"] }
crates/jrsonnet-cli/src/lib.rsdiffbeforeafterboth--- a/crates/jrsonnet-cli/src/lib.rs
+++ b/crates/jrsonnet-cli/src/lib.rs
@@ -44,7 +44,7 @@
/// Any not found `imported` file will be searched in these.
/// This can also be specified via `JSONNET_PATH` variable,
/// which should contain a colon-separated (semicolon-separated on Windows) list of directories.
- #[clap(long, short = 'J', multiple_occurrences = true)]
+ #[clap(long, short = 'J')]
jpath: Vec<PathBuf>,
}
impl ConfigureState for MiscOpts {
crates/jrsonnet-cli/src/manifest.rsdiffbeforeafterboth1use std::{path::PathBuf, str::FromStr};23use clap::Parser;4use jrsonnet_evaluator::{error::Result, ManifestFormat, State};56use crate::ConfigureState;78pub enum ManifestFormatName {9 /// Expect string as output, and write them directly10 String,11 Json,12 Yaml,13}1415impl FromStr for ManifestFormatName {16 type Err = &'static str;17 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {18 Ok(match s {19 "string" => ManifestFormatName::String,20 "json" => ManifestFormatName::Json,21 "yaml" => ManifestFormatName::Yaml,22 _ => return Err("no such format"),23 })24 }25}2627#[derive(Parser)]28#[clap(next_help_heading = "MANIFESTIFICATION OUTPUT")]29pub struct ManifestOpts {30 /// Output format, wraps resulting value to corresponding std.manifest call.31 #[clap(long, short = 'f', default_value = "json", possible_values = &["json", "yaml"])]32 format: ManifestFormatName,33 /// Expect plain string as output.34 /// Mutually exclusive with `--format`35 #[clap(long, short = 'S', conflicts_with = "format")]36 string: bool,37 /// Write output as YAML stream, can be used with --format json/yaml38 #[clap(long, short = 'y')]39 yaml_stream: bool,40 /// Number of spaces to pad output manifest with.41 /// `0` for hard tabs, `-1` for single line output [default: 3 for json, 2 for yaml]42 #[clap(long)]43 line_padding: Option<usize>,44 /// Preserve order in object manifestification45 #[cfg(feature = "exp-preserve-order")]46 #[clap(long)]47 exp_preserve_order: bool,48}49impl ConfigureState for ManifestOpts {50 type Guards = ();51 fn configure(&self, s: &State) -> Result<()> {52 if self.string {53 s.set_manifest_format(ManifestFormat::String);54 } else {55 #[cfg(feature = "exp-preserve-order")]56 let preserve_order = self.exp_preserve_order;57 match self.format {58 ManifestFormatName::String => s.set_manifest_format(ManifestFormat::String),59 ManifestFormatName::Json => s.set_manifest_format(ManifestFormat::Json {60 padding: self.line_padding.unwrap_or(3),61 #[cfg(feature = "exp-preserve-order")]62 preserve_order,63 }),64 ManifestFormatName::Yaml => s.set_manifest_format(ManifestFormat::Yaml {65 padding: self.line_padding.unwrap_or(2),66 #[cfg(feature = "exp-preserve-order")]67 preserve_order,68 }),69 }70 }71 if self.yaml_stream {72 s.set_manifest_format(ManifestFormat::YamlStream(Box::new(s.manifest_format())))73 }74 Ok(())75 }76}7778#[derive(Parser)]79pub struct OutputOpts {80 /// Write to the output file rather than stdout81 #[clap(long, short = 'o')]82 pub output_file: Option<PathBuf>,83 /// Automatically creates all parent directories for files84 #[clap(long, short = 'c')]85 pub create_output_dirs: bool,86 /// Write multiple files to the directory, list files on stdout87 #[clap(long, short = 'm')]88 pub multi: Option<PathBuf>,89}1use std::{path::PathBuf, str::FromStr};23use clap::{Parser, ValueEnum};4use jrsonnet_evaluator::{error::Result, ManifestFormat, State};56use crate::ConfigureState;78#[derive(Clone, ValueEnum)]9pub enum ManifestFormatName {10 /// Expect string as output, and write them directly11 String,12 Json,13 Yaml,14}1516impl FromStr for ManifestFormatName {17 type Err = &'static str;18 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {19 Ok(match s {20 "string" => ManifestFormatName::String,21 "json" => ManifestFormatName::Json,22 "yaml" => ManifestFormatName::Yaml,23 _ => return Err("no such format"),24 })25 }26}2728#[derive(Parser)]29#[clap(next_help_heading = "MANIFESTIFICATION OUTPUT")]30pub struct ManifestOpts {31 /// Output format, wraps resulting value to corresponding std.manifest call.32 #[clap(long, short = 'f', default_value = "json")]33 format: ManifestFormatName,34 /// Expect plain string as output.35 /// Mutually exclusive with `--format`36 #[clap(long, short = 'S', conflicts_with = "format")]37 string: bool,38 /// Write output as YAML stream, can be used with --format json/yaml39 #[clap(long, short = 'y')]40 yaml_stream: bool,41 /// Number of spaces to pad output manifest with.42 /// `0` for hard tabs, `-1` for single line output [default: 3 for json, 2 for yaml]43 #[clap(long)]44 line_padding: Option<usize>,45 /// Preserve order in object manifestification46 #[cfg(feature = "exp-preserve-order")]47 #[clap(long)]48 exp_preserve_order: bool,49}50impl ConfigureState for ManifestOpts {51 type Guards = ();52 fn configure(&self, s: &State) -> Result<()> {53 if self.string {54 s.set_manifest_format(ManifestFormat::String);55 } else {56 #[cfg(feature = "exp-preserve-order")]57 let preserve_order = self.exp_preserve_order;58 match self.format {59 ManifestFormatName::String => s.set_manifest_format(ManifestFormat::String),60 ManifestFormatName::Json => s.set_manifest_format(ManifestFormat::Json {61 padding: self.line_padding.unwrap_or(3),62 #[cfg(feature = "exp-preserve-order")]63 preserve_order,64 }),65 ManifestFormatName::Yaml => s.set_manifest_format(ManifestFormat::Yaml {66 padding: self.line_padding.unwrap_or(2),67 #[cfg(feature = "exp-preserve-order")]68 preserve_order,69 }),70 }71 }72 if self.yaml_stream {73 s.set_manifest_format(ManifestFormat::YamlStream(Box::new(s.manifest_format())))74 }75 Ok(())76 }77}7879#[derive(Parser)]80pub struct OutputOpts {81 /// Write to the output file rather than stdout82 #[clap(long, short = 'o')]83 pub output_file: Option<PathBuf>,84 /// Automatically creates all parent directories for files85 #[clap(long, short = 'c')]86 pub create_output_dirs: bool,87 /// Write multiple files to the directory, list files on stdout88 #[clap(long, short = 'm')]89 pub multi: Option<PathBuf>,90}crates/jrsonnet-cli/src/stdlib.rsdiffbeforeafterboth--- a/crates/jrsonnet-cli/src/stdlib.rs
+++ b/crates/jrsonnet-cli/src/stdlib.rs
@@ -69,40 +69,19 @@
/// to use top level arguments whenever it's possible.
/// If [=data] is not set then it will be read from `name` env variable.
/// Can be accessed from code via `std.extVar("name")`.
- #[clap(
- long,
- short = 'V',
- name = "name[=var data]",
- number_of_values = 1,
- multiple_occurrences = true
- )]
+ #[clap(long, short = 'V', name = "name[=var data]", number_of_values = 1)]
ext_str: Vec<ExtStr>,
/// Read string external variable from file.
/// See also `--ext-str`
- #[clap(
- long,
- name = "name=var path",
- number_of_values = 1,
- multiple_occurrences = true
- )]
+ #[clap(long, name = "name=var path", number_of_values = 1)]
ext_str_file: Vec<ExtFile>,
/// Add external variable from code.
/// See also `--ext-str`
- #[clap(
- long,
- name = "name[=var source]",
- number_of_values = 1,
- multiple_occurrences = true
- )]
+ #[clap(long, name = "name[=var source]", number_of_values = 1)]
ext_code: Vec<ExtStr>,
/// Read string external variable from file.
/// See also `--ext-str`
- #[clap(
- long,
- name = "name=var code path",
- number_of_values = 1,
- multiple_occurrences = true
- )]
+ #[clap(long, name = "name=var code path", number_of_values = 1)]
ext_code_file: Vec<ExtFile>,
}
impl ConfigureState for StdOpts {
crates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth--- a/crates/jrsonnet-cli/src/tla.rs
+++ b/crates/jrsonnet-cli/src/tla.rs
@@ -10,40 +10,19 @@
/// Top level arguments will be passed to function before manifestification stage.
/// This is preferred to ExtVars method.
/// If [=data] is not set then it will be read from `name` env variable.
- #[clap(
- long,
- short = 'A',
- name = "name[=tla data]",
- number_of_values = 1,
- multiple_occurrences = true
- )]
+ #[clap(long, short = 'A', name = "name[=tla data]", number_of_values = 1)]
tla_str: Vec<ExtStr>,
/// Read top level argument string from file.
/// See also `--tla-str`
- #[clap(
- long,
- name = "name=tla path",
- number_of_values = 1,
- multiple_occurrences = true
- )]
+ #[clap(long, name = "name=tla path", number_of_values = 1)]
tla_str_file: Vec<ExtFile>,
/// Add top level argument from code.
/// See also `--tla-str`
- #[clap(
- long,
- name = "name[=tla source]",
- number_of_values = 1,
- multiple_occurrences = true
- )]
+ #[clap(long, name = "name[=tla source]", number_of_values = 1)]
tla_code: Vec<ExtStr>,
/// Read top level argument code from file.
/// See also `--tla-str`
- #[clap(
- long,
- name = "name=tla code path",
- number_of_values = 1,
- multiple_occurrences = true
- )]
+ #[clap(long, name = "name=tla code path", number_of_values = 1)]
tla_code_file: Vec<ExtFile>,
}
impl ConfigureState for TLAOpts {
crates/jrsonnet-cli/src/trace.rsdiffbeforeafterboth--- a/crates/jrsonnet-cli/src/trace.rs
+++ b/crates/jrsonnet-cli/src/trace.rs
@@ -1,6 +1,4 @@
-use std::str::FromStr;
-
-use clap::Parser;
+use clap::{Parser, ValueEnum};
use jrsonnet_evaluator::{
error::Result,
trace::{CompactFormat, ExplainingFormat, PathResolver},
@@ -9,31 +7,19 @@
use crate::ConfigureState;
-#[derive(PartialEq, Eq)]
+#[derive(PartialEq, Eq, ValueEnum, Clone)]
pub enum TraceFormatName {
+ /// Only show `filename:line:column`
Compact,
+ /// Display source code with attached trace annotations
Explaining,
-}
-
-impl FromStr for TraceFormatName {
- type Err = &'static str;
- fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
- Ok(match s {
- "compact" => TraceFormatName::Compact,
- "explaining" => TraceFormatName::Explaining,
- _ => return Err("no such format"),
- })
- }
}
#[derive(Parser)]
#[clap(next_help_heading = "STACK TRACE VISUAL")]
pub struct TraceOpts {
/// Format of stack traces' display in console.
- /// `compact` format only shows `filename:line:column`s
- /// while `explaining` displays source code with attached trace annotations
- /// thus being more verbose.
- #[clap(long, possible_values = &["compact", "explaining"])]
+ #[clap(long)]
trace_format: Option<TraceFormatName>,
/// Amount of stack trace elements to be displayed.
/// If set to `0` then full stack trace will be displayed.
crates/jrsonnet-evaluator/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-evaluator/Cargo.toml
+++ b/crates/jrsonnet-evaluator/Cargo.toml
@@ -31,7 +31,7 @@
jrsonnet-gcmodule = { version = "0.3.4" }
pathdiff = "0.2.1"
-hashbrown = "0.12.1"
+hashbrown = "0.12.3"
static_assertions = "1.1"
rustc-hash = "1.1"
crates/jrsonnet-interner/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-interner/Cargo.toml
+++ b/crates/jrsonnet-interner/Cargo.toml
@@ -22,4 +22,4 @@
structdump = { version = "0.2.0", optional = true }
rustc-hash = "1.1"
-hashbrown = { version = "0.12.1", features = ["inline-more"] }
+hashbrown = { version = "0.12.3", features = ["inline-more"] }
crates/jrsonnet-parser/src/expr.rsdiffbeforeafterboth--- a/crates/jrsonnet-parser/src/expr.rs
+++ b/crates/jrsonnet-parser/src/expr.rs
@@ -190,6 +190,7 @@
}
}
+#[cfg_attr(feature = "structdump", derive(Codegen))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, Trace)]
pub enum DestructRest {
crates/jrsonnet-stdlib/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-stdlib/Cargo.toml
+++ b/crates/jrsonnet-stdlib/Cargo.toml
@@ -30,7 +30,7 @@
# std.md5
md5 = "0.7.0"
# std.base64
-base64 = "0.13.0"
+base64 = "0.13.1"
# std.parseJson
serde_json = "1.0"
# std.parseYaml, custom library fork is used for C++/golang compatibility
crates/jrsonnet-types/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-types/Cargo.toml
+++ b/crates/jrsonnet-types/Cargo.toml
@@ -9,4 +9,4 @@
[dependencies]
jrsonnet-gcmodule = { version = "0.3.4" }
-peg = "0.8.0"
+peg = "0.8.1"