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.rsdiffbeforeafterboth--- a/crates/jrsonnet-cli/src/manifest.rs
+++ b/crates/jrsonnet-cli/src/manifest.rs
@@ -1,10 +1,11 @@
use std::{path::PathBuf, str::FromStr};
-use clap::Parser;
+use clap::{Parser, ValueEnum};
use jrsonnet_evaluator::{error::Result, ManifestFormat, State};
use crate::ConfigureState;
+#[derive(Clone, ValueEnum)]
pub enum ManifestFormatName {
/// Expect string as output, and write them directly
String,
@@ -28,7 +29,7 @@
#[clap(next_help_heading = "MANIFESTIFICATION OUTPUT")]
pub struct ManifestOpts {
/// Output format, wraps resulting value to corresponding std.manifest call.
- #[clap(long, short = 'f', default_value = "json", possible_values = &["json", "yaml"])]
+ #[clap(long, short = 'f', default_value = "json")]
format: ManifestFormatName,
/// Expect plain string as output.
/// Mutually exclusive with `--format`
crates/jrsonnet-cli/src/stdlib.rsdiffbeforeafterboth1use std::{fs::read_to_string, str::FromStr};23use clap::Parser;4use jrsonnet_evaluator::{error::Result, tb, trace::PathResolver, State};56use crate::ConfigureState;78#[derive(Clone)]9pub struct ExtStr {10 pub name: String,11 pub value: String,12}1314impl FromStr for ExtStr {15 type Err = &'static str;16 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {17 let out: Vec<_> = s.split('=').collect();18 match out.len() {19 1 => Ok(ExtStr {20 name: out[0].to_owned(),21 value: std::env::var(out[0]).or(Err("missing env var"))?,22 }),23 2 => Ok(ExtStr {24 name: out[0].to_owned(),25 value: out[1].to_owned(),26 }),2728 _ => Err("bad ext-str syntax"),29 }30 }31}3233#[derive(Clone)]34pub struct ExtFile {35 pub name: String,36 pub value: String,37}3839impl FromStr for ExtFile {40 type Err = String;4142 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {43 let out: Vec<&str> = s.split('=').collect();44 if out.len() != 2 {45 return Err("bad ext-file syntax".to_owned());46 }47 let file = read_to_string(out[1]);48 match file {49 Ok(content) => Ok(Self {50 name: out[0].into(),51 value: content,52 }),53 Err(e) => Err(format!("{}", e)),54 }55 }56}5758#[derive(Parser)]59#[clap(next_help_heading = "STANDARD LIBRARY")]60pub struct StdOpts {61 /// Disable standard library.62 /// By default standard library will be available via global `std` variable.63 /// Note that standard library will still be loaded64 /// if chosen manifestification method is not `none`.65 #[clap(long)]66 no_stdlib: bool,67 /// Add string external variable.68 /// External variables are globally available so it is preferred69 /// to use top level arguments whenever it's possible.70 /// If [=data] is not set then it will be read from `name` env variable.71 /// Can be accessed from code via `std.extVar("name")`.72 #[clap(73 long,74 short = 'V',75 name = "name[=var data]",76 number_of_values = 1,77 multiple_occurrences = true78 )]79 ext_str: Vec<ExtStr>,80 /// Read string external variable from file.81 /// See also `--ext-str`82 #[clap(83 long,84 name = "name=var path",85 number_of_values = 1,86 multiple_occurrences = true87 )]88 ext_str_file: Vec<ExtFile>,89 /// Add external variable from code.90 /// See also `--ext-str`91 #[clap(92 long,93 name = "name[=var source]",94 number_of_values = 1,95 multiple_occurrences = true96 )]97 ext_code: Vec<ExtStr>,98 /// Read string external variable from file.99 /// See also `--ext-str`100 #[clap(101 long,102 name = "name=var code path",103 number_of_values = 1,104 multiple_occurrences = true105 )]106 ext_code_file: Vec<ExtFile>,107}108impl ConfigureState for StdOpts {109 type Guards = ();110 fn configure(&self, s: &State) -> Result<()> {111 if self.no_stdlib {112 return Ok(());113 }114 let ctx =115 jrsonnet_stdlib::ContextInitializer::new(s.clone(), PathResolver::new_cwd_fallback());116 for ext in self.ext_str.iter() {117 ctx.add_ext_str((&ext.name as &str).into(), (&ext.value as &str).into());118 }119 for ext in self.ext_str_file.iter() {120 ctx.add_ext_str((&ext.name as &str).into(), (&ext.value as &str).into());121 }122 for ext in self.ext_code.iter() {123 ctx.add_ext_code(&ext.name as &str, &ext.value as &str)?;124 }125 for ext in self.ext_code_file.iter() {126 ctx.add_ext_code(&ext.name as &str, &ext.value as &str)?;127 }128 s.settings_mut().context_initializer = tb!(ctx);129 Ok(())130 }131}1use std::{fs::read_to_string, str::FromStr};23use clap::Parser;4use jrsonnet_evaluator::{error::Result, tb, trace::PathResolver, State};56use crate::ConfigureState;78#[derive(Clone)]9pub struct ExtStr {10 pub name: String,11 pub value: String,12}1314impl FromStr for ExtStr {15 type Err = &'static str;16 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {17 let out: Vec<_> = s.split('=').collect();18 match out.len() {19 1 => Ok(ExtStr {20 name: out[0].to_owned(),21 value: std::env::var(out[0]).or(Err("missing env var"))?,22 }),23 2 => Ok(ExtStr {24 name: out[0].to_owned(),25 value: out[1].to_owned(),26 }),2728 _ => Err("bad ext-str syntax"),29 }30 }31}3233#[derive(Clone)]34pub struct ExtFile {35 pub name: String,36 pub value: String,37}3839impl FromStr for ExtFile {40 type Err = String;4142 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {43 let out: Vec<&str> = s.split('=').collect();44 if out.len() != 2 {45 return Err("bad ext-file syntax".to_owned());46 }47 let file = read_to_string(out[1]);48 match file {49 Ok(content) => Ok(Self {50 name: out[0].into(),51 value: content,52 }),53 Err(e) => Err(format!("{}", e)),54 }55 }56}5758#[derive(Parser)]59#[clap(next_help_heading = "STANDARD LIBRARY")]60pub struct StdOpts {61 /// Disable standard library.62 /// By default standard library will be available via global `std` variable.63 /// Note that standard library will still be loaded64 /// if chosen manifestification method is not `none`.65 #[clap(long)]66 no_stdlib: bool,67 /// Add string external variable.68 /// External variables are globally available so it is preferred69 /// to use top level arguments whenever it's possible.70 /// If [=data] is not set then it will be read from `name` env variable.71 /// Can be accessed from code via `std.extVar("name")`.72 #[clap(long, short = 'V', name = "name[=var data]", number_of_values = 1)]73 ext_str: Vec<ExtStr>,74 /// Read string external variable from file.75 /// See also `--ext-str`76 #[clap(long, name = "name=var path", number_of_values = 1)]77 ext_str_file: Vec<ExtFile>,78 /// Add external variable from code.79 /// See also `--ext-str`80 #[clap(long, name = "name[=var source]", number_of_values = 1)]81 ext_code: Vec<ExtStr>,82 /// Read string external variable from file.83 /// See also `--ext-str`84 #[clap(long, name = "name=var code path", number_of_values = 1)]85 ext_code_file: Vec<ExtFile>,86}87impl ConfigureState for StdOpts {88 type Guards = ();89 fn configure(&self, s: &State) -> Result<()> {90 if self.no_stdlib {91 return Ok(());92 }93 let ctx =94 jrsonnet_stdlib::ContextInitializer::new(s.clone(), PathResolver::new_cwd_fallback());95 for ext in self.ext_str.iter() {96 ctx.add_ext_str((&ext.name as &str).into(), (&ext.value as &str).into());97 }98 for ext in self.ext_str_file.iter() {99 ctx.add_ext_str((&ext.name as &str).into(), (&ext.value as &str).into());100 }101 for ext in self.ext_code.iter() {102 ctx.add_ext_code(&ext.name as &str, &ext.value as &str)?;103 }104 for ext in self.ext_code_file.iter() {105 ctx.add_ext_code(&ext.name as &str, &ext.value as &str)?;106 }107 s.settings_mut().context_initializer = tb!(ctx);108 Ok(())109 }110}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"