bump dependencies

This commit is contained in:
Aiden McClelland
2022-03-08 16:25:07 -07:00
parent b4d19d71e0
commit f2126d09f0
8 changed files with 62 additions and 62 deletions

71
Cargo.lock generated
View File

@@ -2,15 +2,6 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 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]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.40" version = "1.0.40"
@@ -72,17 +63,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.33.3" version = "3.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123"
dependencies = [ dependencies = [
"ansi_term",
"atty", "atty",
"bitflags", "bitflags",
"indexmap",
"os_str_bytes",
"strsim", "strsim",
"termcolor",
"textwrap", "textwrap",
"unicode-width",
"vec_map",
] ]
[[package]] [[package]]
@@ -446,9 +437,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.3.4" version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]] [[package]]
name = "mime" name = "mime"
@@ -554,6 +545,15 @@ dependencies = [
"vcpkg", "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]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.11.1" version = "0.11.1"
@@ -919,9 +919,9 @@ dependencies = [
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.8.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
@@ -949,14 +949,20 @@ dependencies = [
] ]
[[package]] [[package]]
name = "textwrap" name = "termcolor"
version = "0.11.0" version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [ 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]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.24" version = "1.0.24"
@@ -1097,12 +1103,6 @@ dependencies = [
"tinyvec", "tinyvec",
] ]
[[package]]
name = "unicode-width"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.1" version = "0.2.1"
@@ -1127,12 +1127,6 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "want" name = "want"
version = "0.3.0" version = "0.3.0"
@@ -1243,6 +1237,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 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]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"

View File

@@ -269,7 +269,10 @@ fn build_app(name: LitStr, opt: &mut Options, params: &mut [ParamType]) -> Token
return None; return None;
} }
let name = arg.name.clone().unwrap(); 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 help = arg.help.clone().into_iter();
let short = arg.short.clone().into_iter(); let short = arg.short.clone().into_iter();
let long = arg.long.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! { 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); 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 required = LitBool::new(subcommand_required, Span::call_site());
let alias = &opt.common().aliases; let alias = &opt.common().aliases;
quote! { quote! {
pub fn build_app() -> ::rpc_toolkit::command_helpers::prelude::App<'static, 'static> { pub fn build_app() -> ::rpc_toolkit::command_helpers::prelude::Command<'static> {
let mut app = ::rpc_toolkit::command_helpers::prelude::App::new(#name); let mut app = ::rpc_toolkit::command_helpers::prelude::Command::new(#name);
#( #(
app = app.about(#about); 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()); app = app.subcommand(#subcommand::build_app());
)* )*
if #required { if #required {
app = app.setting(::rpc_toolkit::command_helpers::prelude::AppSettings::SubcommandRequired); app = app.subcommand_required(true);
} }
app app
} }
@@ -889,7 +892,7 @@ fn cli_handler(
_ctx: GenericContext, _ctx: GenericContext,
_parent_data: #parent_data_ty, _parent_data: #parent_data_ty,
_rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>, _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>, method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
_parent_params: ParentParams, _parent_params: ParentParams,
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> { ) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
@@ -915,7 +918,7 @@ fn cli_handler(
ctx: GenericContext, ctx: GenericContext,
parent_data: #parent_data_ty, parent_data: #parent_data_ty,
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>, 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>, method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
parent_params: ParentParams, parent_params: ParentParams,
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> { ) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
@@ -986,7 +989,7 @@ fn cli_handler(
ctx: GenericContext, ctx: GenericContext,
parent_data: #parent_data_ty, parent_data: #parent_data_ty,
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>, 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>, _method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
parent_params: ParentParams parent_params: ParentParams
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> { ) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
@@ -1028,7 +1031,7 @@ fn cli_handler(
ctx: GenericContext, ctx: GenericContext,
parent_data: #parent_data_ty, parent_data: #parent_data_ty,
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>, 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>, _method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
parent_params: ParentParams parent_params: ParentParams
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> { ) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
@@ -1163,7 +1166,7 @@ fn cli_handler(
ctx: GenericContext, ctx: GenericContext,
parent_data: #parent_data_ty, parent_data: #parent_data_ty,
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>, 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>, method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
parent_params: ParentParams, parent_params: ParentParams,
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> { ) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {

View File

@@ -86,7 +86,7 @@ pub struct ArgOptions {
help: Option<LitStr>, help: Option<LitStr>,
name: Option<Ident>, name: Option<Ident>,
rename: Option<LitStr>, rename: Option<LitStr>,
short: Option<LitStr>, short: Option<LitChar>,
long: Option<LitStr>, long: Option<LitStr>,
parse: Option<Path>, parse: Option<Path>,
default: Option<LitStr>, default: Option<LitStr>,

View File

@@ -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")); return Err(Error::new(p.span(), "`rename` must be assigned to"));
} }
NestedMeta::Meta(Meta::NameValue(nv)) if nv.path.is_ident("short") => { NestedMeta::Meta(Meta::NameValue(nv)) if nv.path.is_ident("short") => {
if let Lit::Str(short) = nv.lit { if let Lit::Char(short) = nv.lit {
if short.value().len() != 1 {
return Err(Error::new(
short.span(),
"`short` value must be 1 character",
));
}
if opt.short.is_some() { if opt.short.is_some() {
return Err(Error::new(short.span(), "duplicate argument `short`")); return Err(Error::new(short.span(), "duplicate argument `short`"));
} }

View File

@@ -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(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(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 /// - `#[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 /// - note: `arg` is the type of the argument
/// - `#[arg(stdin)]` -> Parse the argument from stdin when using the CLI /// - `#[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(count)]` -> Treat argument as flag, count occurrences
/// - `#[arg(multiple)]` -> Allow the arg to be specified multiple times. Collect the args after parsing. /// - `#[arg(multiple)]` -> Allow the arg to be specified multiple times. Collect the args after parsing.
#[proc_macro_attribute] #[proc_macro_attribute]

View File

@@ -10,7 +10,7 @@ cbor = ["serde_cbor"]
default = ["cbor"] default = ["cbor"]
[dependencies] [dependencies]
clap = "2.33.3" clap = "3.1.6"
futures = "0.3.15" futures = "0.3.15"
hyper = { version = "0.14.5", features = [ hyper = { version = "0.14.5", features = [
"server", "server",

View File

@@ -15,7 +15,7 @@ pub mod prelude {
pub use std::borrow::Cow; pub use std::borrow::Cow;
pub use std::marker::PhantomData; 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::request::Parts as RequestParts;
pub use hyper::http::response::Parts as ResponseParts; pub use hyper::http::response::Parts as ResponseParts;
pub use serde::{Deserialize, Serialize}; 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>( pub fn default_arg_parser<T: FromStr<Err = E>, E: Display>(
arg: &str, arg: &str,
_: &ArgMatches<'_>, _: &ArgMatches,
) -> Result<T, RpcError> { ) -> Result<T, RpcError> {
arg.parse().map_err(|e| RpcError { arg.parse().map_err(|e| RpcError {
data: Some(format!("{}", e).into()), 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>( pub fn default_stdin_parser<T: FromStr<Err = E>, E: Display>(
stdin: &mut Stdin, stdin: &mut Stdin,
_: &ArgMatches<'_>, _: &ArgMatches,
) -> Result<T, RpcError> { ) -> Result<T, RpcError> {
let mut s = String::new(); let mut s = String::new();
stdin.read_line(&mut s).map_err(|e| RpcError { 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) println!("{}", t)
} }

View File

@@ -51,9 +51,9 @@ async fn dothething<
E: Display, E: Display,
>( >(
#[context] _ctx: AppState, #[context] _ctx: AppState,
#[arg(short = "a")] arg1: Option<String>, #[arg(short = 'a')] arg1: Option<String>,
#[arg(short = "b")] val: String, #[arg(short = 'b')] val: String,
#[arg(short = "c", help = "I am the flag `c`!")] arg3: bool, #[arg(short = 'c', help = "I am the flag `c`!")] arg3: bool,
#[arg(stdin)] structured: U, #[arg(stdin)] structured: U,
) -> Result<(Option<String>, String, bool, U), RpcError> { ) -> Result<(Option<String>, String, bool, U), RpcError> {
Ok((arg1, val, arg3, structured)) Ok((arg1, val, arg3, structured))