mirror of
https://github.com/Start9Labs/rpc-toolkit.git
synced 2026-03-26 02:11:56 +00:00
bump dependencies
This commit is contained in:
71
Cargo.lock
generated
71
Cargo.lock
generated
@@ -2,15 +2,6 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.40"
|
||||
@@ -72,17 +63,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
version = "3.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
|
||||
checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"indexmap",
|
||||
"os_str_bytes",
|
||||
"strsim",
|
||||
"termcolor",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -446,9 +437,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.3.4"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
||||
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
@@ -554,6 +545,15 @@ dependencies = [
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.1"
|
||||
@@ -919,9 +919,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
@@ -949,14 +949,20 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
name = "termcolor"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
|
||||
dependencies = [
|
||||
"unicode-width",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.24"
|
||||
@@ -1097,12 +1103,6 @@ dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
@@ -1127,12 +1127,6 @@ version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "want"
|
||||
version = "0.3.0"
|
||||
@@ -1243,6 +1237,15 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
|
||||
@@ -269,7 +269,10 @@ fn build_app(name: LitStr, opt: &mut Options, params: &mut [ParamType]) -> Token
|
||||
return None;
|
||||
}
|
||||
let name = arg.name.clone().unwrap();
|
||||
let name_str = arg.rename.clone().unwrap_or_else(|| LitStr::new(&name.to_string(), name.span()));
|
||||
let name_str = arg
|
||||
.rename
|
||||
.clone()
|
||||
.unwrap_or_else(|| LitStr::new(&name.to_string(), name.span()));
|
||||
let help = arg.help.clone().into_iter();
|
||||
let short = arg.short.clone().into_iter();
|
||||
let long = arg.long.clone().into_iter();
|
||||
@@ -315,7 +318,7 @@ fn build_app(name: LitStr, opt: &mut Options, params: &mut [ParamType]) -> Token
|
||||
};
|
||||
Some(quote! {
|
||||
{
|
||||
let mut arg = ::rpc_toolkit::command_helpers::prelude::Arg::with_name(#name_str);
|
||||
let mut arg = ::rpc_toolkit::command_helpers::prelude::Arg::new(#name_str);
|
||||
#(
|
||||
arg = arg.help(#help);
|
||||
)*
|
||||
@@ -338,8 +341,8 @@ fn build_app(name: LitStr, opt: &mut Options, params: &mut [ParamType]) -> Token
|
||||
let required = LitBool::new(subcommand_required, Span::call_site());
|
||||
let alias = &opt.common().aliases;
|
||||
quote! {
|
||||
pub fn build_app() -> ::rpc_toolkit::command_helpers::prelude::App<'static, 'static> {
|
||||
let mut app = ::rpc_toolkit::command_helpers::prelude::App::new(#name);
|
||||
pub fn build_app() -> ::rpc_toolkit::command_helpers::prelude::Command<'static> {
|
||||
let mut app = ::rpc_toolkit::command_helpers::prelude::Command::new(#name);
|
||||
#(
|
||||
app = app.about(#about);
|
||||
)*
|
||||
@@ -353,7 +356,7 @@ fn build_app(name: LitStr, opt: &mut Options, params: &mut [ParamType]) -> Token
|
||||
app = app.subcommand(#subcommand::build_app());
|
||||
)*
|
||||
if #required {
|
||||
app = app.setting(::rpc_toolkit::command_helpers::prelude::AppSettings::SubcommandRequired);
|
||||
app = app.subcommand_required(true);
|
||||
}
|
||||
app
|
||||
}
|
||||
@@ -889,7 +892,7 @@ fn cli_handler(
|
||||
_ctx: GenericContext,
|
||||
_parent_data: #parent_data_ty,
|
||||
_rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>,
|
||||
_matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches<'_>,
|
||||
_matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches,
|
||||
method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
|
||||
_parent_params: ParentParams,
|
||||
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
|
||||
@@ -915,7 +918,7 @@ fn cli_handler(
|
||||
ctx: GenericContext,
|
||||
parent_data: #parent_data_ty,
|
||||
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>,
|
||||
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches<'_>,
|
||||
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches,
|
||||
method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
|
||||
parent_params: ParentParams,
|
||||
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
|
||||
@@ -986,7 +989,7 @@ fn cli_handler(
|
||||
ctx: GenericContext,
|
||||
parent_data: #parent_data_ty,
|
||||
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>,
|
||||
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches<'_>,
|
||||
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches,
|
||||
_method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
|
||||
parent_params: ParentParams
|
||||
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
|
||||
@@ -1028,7 +1031,7 @@ fn cli_handler(
|
||||
ctx: GenericContext,
|
||||
parent_data: #parent_data_ty,
|
||||
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>,
|
||||
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches<'_>,
|
||||
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches,
|
||||
_method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
|
||||
parent_params: ParentParams
|
||||
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
|
||||
@@ -1163,7 +1166,7 @@ fn cli_handler(
|
||||
ctx: GenericContext,
|
||||
parent_data: #parent_data_ty,
|
||||
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>,
|
||||
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches<'_>,
|
||||
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches,
|
||||
method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
|
||||
parent_params: ParentParams,
|
||||
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
|
||||
|
||||
@@ -86,7 +86,7 @@ pub struct ArgOptions {
|
||||
help: Option<LitStr>,
|
||||
name: Option<Ident>,
|
||||
rename: Option<LitStr>,
|
||||
short: Option<LitStr>,
|
||||
short: Option<LitChar>,
|
||||
long: Option<LitStr>,
|
||||
parse: Option<Path>,
|
||||
default: Option<LitStr>,
|
||||
|
||||
@@ -728,13 +728,7 @@ pub fn parse_arg_attr(attr: Attribute, arg: PatType) -> Result<ArgOptions> {
|
||||
return Err(Error::new(p.span(), "`rename` must be assigned to"));
|
||||
}
|
||||
NestedMeta::Meta(Meta::NameValue(nv)) if nv.path.is_ident("short") => {
|
||||
if let Lit::Str(short) = nv.lit {
|
||||
if short.value().len() != 1 {
|
||||
return Err(Error::new(
|
||||
short.span(),
|
||||
"`short` value must be 1 character",
|
||||
));
|
||||
}
|
||||
if let Lit::Char(short) = nv.lit {
|
||||
if opt.short.is_some() {
|
||||
return Err(Error::new(short.span(), "duplicate argument `short`"));
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ pub fn command(args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
/// - `#[arg(short = "a")]` -> Set the "short" representation of the arg to `-a` on the CLI
|
||||
/// - `#[arg(long = "arg")]` -> Set the "long" representation of the arg to `--arg` on the CLI
|
||||
/// - `#[arg(parse(custom_parse_fn))]` -> Use the function `custom_parse_fn` to parse the arg from the CLI
|
||||
/// - `custom_parse_fn :: Into<RpcError> err => (&str, &ArgMatches<'_>) -> Result<arg, err>`
|
||||
/// - `custom_parse_fn :: Into<RpcError> err => (&str, &ArgMatches) -> Result<arg, err>`
|
||||
/// - note: `arg` is the type of the argument
|
||||
/// - `#[arg(stdin)]` -> Parse the argument from stdin when using the CLI
|
||||
/// - `custom_parse_fn :: Into<RpcError> err => (&[u8], &ArgMatches<'_>) -> Result<arg, err>`
|
||||
/// - `custom_parse_fn :: Into<RpcError> err => (&[u8], &ArgMatches) -> Result<arg, err>`
|
||||
/// - `#[arg(count)]` -> Treat argument as flag, count occurrences
|
||||
/// - `#[arg(multiple)]` -> Allow the arg to be specified multiple times. Collect the args after parsing.
|
||||
#[proc_macro_attribute]
|
||||
|
||||
@@ -10,7 +10,7 @@ cbor = ["serde_cbor"]
|
||||
default = ["cbor"]
|
||||
|
||||
[dependencies]
|
||||
clap = "2.33.3"
|
||||
clap = "3.1.6"
|
||||
futures = "0.3.15"
|
||||
hyper = { version = "0.14.5", features = [
|
||||
"server",
|
||||
|
||||
@@ -15,7 +15,7 @@ pub mod prelude {
|
||||
pub use std::borrow::Cow;
|
||||
pub use std::marker::PhantomData;
|
||||
|
||||
pub use clap::{App, AppSettings, Arg, ArgMatches};
|
||||
pub use clap::{AppSettings, Arg, ArgMatches, Command};
|
||||
pub use hyper::http::request::Parts as RequestParts;
|
||||
pub use hyper::http::response::Parts as ResponseParts;
|
||||
pub use serde::{Deserialize, Serialize};
|
||||
@@ -96,7 +96,7 @@ pub async fn call_remote<Ctx: Context, Params: Serialize, Res: for<'de> Deserial
|
||||
|
||||
pub fn default_arg_parser<T: FromStr<Err = E>, E: Display>(
|
||||
arg: &str,
|
||||
_: &ArgMatches<'_>,
|
||||
_: &ArgMatches,
|
||||
) -> Result<T, RpcError> {
|
||||
arg.parse().map_err(|e| RpcError {
|
||||
data: Some(format!("{}", e).into()),
|
||||
@@ -106,7 +106,7 @@ pub fn default_arg_parser<T: FromStr<Err = E>, E: Display>(
|
||||
|
||||
pub fn default_stdin_parser<T: FromStr<Err = E>, E: Display>(
|
||||
stdin: &mut Stdin,
|
||||
_: &ArgMatches<'_>,
|
||||
_: &ArgMatches,
|
||||
) -> Result<T, RpcError> {
|
||||
let mut s = String::new();
|
||||
stdin.read_line(&mut s).map_err(|e| RpcError {
|
||||
@@ -125,6 +125,6 @@ pub fn default_stdin_parser<T: FromStr<Err = E>, E: Display>(
|
||||
})
|
||||
}
|
||||
|
||||
pub fn default_display<T: Display>(t: T, _: &ArgMatches<'_>) {
|
||||
pub fn default_display<T: Display>(t: T, _: &ArgMatches) {
|
||||
println!("{}", t)
|
||||
}
|
||||
|
||||
@@ -51,9 +51,9 @@ async fn dothething<
|
||||
E: Display,
|
||||
>(
|
||||
#[context] _ctx: AppState,
|
||||
#[arg(short = "a")] arg1: Option<String>,
|
||||
#[arg(short = "b")] val: String,
|
||||
#[arg(short = "c", help = "I am the flag `c`!")] arg3: bool,
|
||||
#[arg(short = 'a')] arg1: Option<String>,
|
||||
#[arg(short = 'b')] val: String,
|
||||
#[arg(short = 'c', help = "I am the flag `c`!")] arg3: bool,
|
||||
#[arg(stdin)] structured: U,
|
||||
) -> Result<(Option<String>, String, bool, U), RpcError> {
|
||||
Ok((arg1, val, arg3, structured))
|
||||
|
||||
Reference in New Issue
Block a user