diff --git a/Cargo.lock b/Cargo.lock index 1e501dc4b4..63566d51fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -154,6 +154,48 @@ dependencies = [ "futures-core", ] +[[package]] +name = "async-executor" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f47c78ea98277cb1f5e6f60ba4fc762f5eafe9f6511bc2f7dfd8b75c225650" +dependencies = [ + "async-io", + "futures-lite", + "multitask", + "parking 1.0.6", + "scoped-tls 1.0.0", + "waker-fn", +] + +[[package]] +name = "async-io" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae22a338d28c75b53702b66f77979062cb29675db376d99e451af4fa79dedb3" +dependencies = [ + "cfg-if", + "concurrent-queue", + "futures-lite", + "libc", + "once_cell", + "parking 2.0.0", + "polling", + "socket2", + "vec-arena", + "wepoll-sys-stjepang", + "winapi 0.3.9", +] + +[[package]] +name = "async-mutex" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e85981fc34e84cdff3fc2c9219189752633fdc538a06df8b5ac45b68a4f3a9" +dependencies = [ + "event-listener", +] + [[package]] name = "async-recursion" version = "0.3.1" @@ -167,16 +209,21 @@ dependencies = [ [[package]] name = "async-std" -version = "1.6.2" +version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d68a33ebc8b57800847d00787307f84a562224a14db069b0acefe4c2abbf5d" +checksum = "46c8da367da62b8ff2313c406c9ac091c1b31d67a165becdd2de380d846260f7" dependencies = [ "async-attributes", + "async-executor", + "async-io", + "async-mutex", "async-task", + "blocking 0.5.2", "crossbeam-utils 0.7.2", "futures-channel", "futures-core", "futures-io", + "futures-lite", "kv-log-macro", "log 0.4.11", "memchr", @@ -185,7 +232,6 @@ dependencies = [ "pin-project-lite", "pin-utils", "slab 0.4.2", - "smol", "wasm-bindgen-futures 0.4.17", ] @@ -197,9 +243,9 @@ checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" [[package]] name = "async-trait" -version = "0.1.36" +version = "0.1.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92" +checksum = "6e1a4a2f97ce50c9d0282c1468816208588441492b40d813b2e0419c22c05e7f" dependencies = [ "proc-macro2", "quote", @@ -446,7 +492,20 @@ dependencies = [ "atomic-waker", "futures-lite", "once_cell", - "parking", + "parking 1.0.6", + "waker-fn", +] + +[[package]] +name = "blocking" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5800d29218fea137b0880387e5948694a23c93fcdde157006966693a865c7c" +dependencies = [ + "async-channel", + "atomic-waker", + "futures-lite", + "once_cell", "waker-fn", ] @@ -572,9 +631,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" +checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381" dependencies = [ "jobserver", ] @@ -615,9 +674,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.2" +version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10040cdf04294b565d9e0319955430099ec3813a64c952b86a41200ad714ae48" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ "ansi_term 0.11.0", "atty", @@ -991,9 +1050,9 @@ dependencies = [ [[package]] name = "curl" -version = "0.4.31" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9447ad28eee2a5cfb031c329d46bef77487244fff6a724b378885b8691a35f78" +checksum = "78baca05127a115136a9898e266988fc49ca7ea2c839f60fc6e1fc9df1599168" dependencies = [ "curl-sys", "libc", @@ -1006,9 +1065,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.34+curl-7.71.1" +version = "0.4.36+curl-7.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4eff0be6985b7e709f64b5a541f700e9ad1407190a29f4884319eb663ed1d6" +checksum = "68cad94adeb0c16558429c3c34a607acc9ea58e09a7b66310aabc9788fc5d721" dependencies = [ "cc", "libc", @@ -1419,9 +1478,9 @@ checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" [[package]] name = "flate2" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e" +checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" dependencies = [ "cfg-if", "crc32fast", @@ -1571,15 +1630,15 @@ checksum = "f4914ae450db1921a56c91bde97a27846287d062087d4a652efc09bb3a01ebda" [[package]] name = "futures-lite" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe71459749b2e8e66fb95df721b22fa08661ad384a0c5b519e11d3893b4692a" +checksum = "97999970129b808f0ccba93211201d431fcc12d7e1ffae03a61b5cedd1a7ced2" dependencies = [ "fastrand", "futures-core", "futures-io", "memchr", - "parking", + "parking 2.0.0", "pin-project-lite", "waker-fn", ] @@ -1765,9 +1824,9 @@ checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" [[package]] name = "git2" -version = "0.13.8" +version = "0.13.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ac22e49b7d886b6802c66662b12609452248b1bc9e87d6d83ecea3db96f557" +checksum = "83a18853c521bcf553a4e3c05ad21f3ad89c1a78a0485adc97829a4c88066a36" dependencies = [ "bitflags", "libc", @@ -2415,9 +2474,9 @@ checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10" [[package]] name = "libgit2-sys" -version = "0.12.9+1.0.1" +version = "0.12.11+1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b33bf3d9d4c45b48ae1ea7c334be69994624dc0a69f833d5d9f7605f24b552b" +checksum = "1f4755167bef8a2959fe4eedeece2ba0f8eb9923b209d46139031f1281d569a2" dependencies = [ "cc", "libc", @@ -2450,9 +2509,9 @@ dependencies = [ [[package]] name = "libssh2-sys" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eafa907407504b0e683786d4aba47acf250f114d37357d56608333fd167dd0fc" +checksum = "ca46220853ba1c512fc82826d0834d87b06bcd3c2a42241b7de72f3d2fe17056" dependencies = [ "cc", "libc", @@ -2464,9 +2523,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.0.25" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" +checksum = "af67924b8dd885cccea261866c8ce5b74d239d272e154053ff927dae839f5ae9" dependencies = [ "cc", "libc", @@ -2781,6 +2840,17 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "multitask" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c09c35271e7dcdb5f709779111f2c8e8ab8e06c1b587c1c6a9e179d865aaa5b4" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", +] + [[package]] name = "native-tls" version = "0.2.4" @@ -3594,9 +3664,9 @@ checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" [[package]] name = "once_cell" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" [[package]] name = "onig" @@ -3695,6 +3765,12 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6cb300f271742d4a2a66c01b6b2fa0c83dfebd2e0bf11addb879a3547b4ed87c" +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + [[package]] name = "parking_lot" version = "0.9.0" @@ -3931,10 +4007,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b18befed8bc2b61abc79a457295e7e838417326da1586050b919414073977f19" [[package]] -name = "ppv-lite86" -version = "0.2.8" +name = "polling" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" +checksum = "9e09dffb745feffca5be3dea51c02b7b368c4597ab0219a82acaf9799ab3e0d1" +dependencies = [ + "cfg-if", + "libc", + "wepoll-sys-stjepang", + "winapi 0.3.9", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" [[package]] name = "pretty" @@ -5058,7 +5146,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "620cbb3c6e34da57d3a248cda0cd01cd5848164dc062e764e65d06fe3ea7aed5" dependencies = [ "async-task", - "blocking", + "blocking 0.4.7", "concurrent-queue", "fastrand", "futures-io", @@ -5161,9 +5249,9 @@ dependencies = [ [[package]] name = "syntect" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b57a45fdcf4891bc79f635be5c559210a4cfa464891f969724944c713282eedb" +checksum = "4e3978df05b5850c839a6b352d3c35ce0478944a4be689be826b53cf75363e88" dependencies = [ "bincode", "bitflags", @@ -5320,9 +5408,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" +checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" [[package]] name = "tokio" @@ -5824,6 +5912,12 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" +[[package]] +name = "vec-arena" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17dfb54bf57c9043f4616cb03dab30eff012cc26631b797d8354b916708db919" + [[package]] name = "vec_map" version = "0.8.2" diff --git a/crates/nu-cli/src/cli.rs b/crates/nu-cli/src/cli.rs index 263e464ef8..5971b70bff 100644 --- a/crates/nu-cli/src/cli.rs +++ b/crates/nu-cli/src/cli.rs @@ -261,6 +261,7 @@ pub fn create_default_context( whole_stream_command(Save), whole_stream_command(Touch), whole_stream_command(Cpy), + whole_stream_command(Date), whole_stream_command(DateNow), whole_stream_command(DateUTC), whole_stream_command(DateFormat), diff --git a/crates/nu-cli/src/commands.rs b/crates/nu-cli/src/commands.rs index 046fa6e625..52e651ce94 100644 --- a/crates/nu-cli/src/commands.rs +++ b/crates/nu-cli/src/commands.rs @@ -147,7 +147,7 @@ pub(crate) use config::{ }; pub(crate) use count::Count; pub(crate) use cp::Cpy; -pub(crate) use date::{DateFormat, DateNow, DateUTC}; +pub(crate) use date::{Date, DateFormat, DateNow, DateUTC}; pub(crate) use debug::Debug; pub(crate) use default::Default; pub(crate) use do_::Do; diff --git a/crates/nu-cli/src/commands/config/set.rs b/crates/nu-cli/src/commands/config/set.rs index 76bcd2dc6c..10f936cad2 100644 --- a/crates/nu-cli/src/commands/config/set.rs +++ b/crates/nu-cli/src/commands/config/set.rs @@ -39,8 +39,8 @@ impl WholeStreamCommand for SubCommand { fn examples(&self) -> Vec { vec![Example { - description: "Set completion_mode to circular", - example: "config set [completion_mode circular]", + description: "Set nonzero_exit_errors to true", + example: "config set nonzero_exit_errors $true", result: None, }] } diff --git a/crates/nu-cli/src/commands/date/command.rs b/crates/nu-cli/src/commands/date/command.rs new file mode 100644 index 0000000000..3867fd2729 --- /dev/null +++ b/crates/nu-cli/src/commands/date/command.rs @@ -0,0 +1,46 @@ +use crate::commands::WholeStreamCommand; +use crate::prelude::*; +use nu_errors::ShellError; +use nu_protocol::{ReturnSuccess, Signature, UntaggedValue}; + +pub struct Command; + +#[async_trait] +impl WholeStreamCommand for Command { + fn name(&self) -> &str { + "date" + } + + fn signature(&self) -> Signature { + Signature::build("date") + } + + fn usage(&self) -> &str { + "Work with dates." + } + + async fn run( + &self, + _args: CommandArgs, + registry: &CommandRegistry, + ) -> Result { + let registry = registry.clone(); + + Ok(OutputStream::one(ReturnSuccess::value( + UntaggedValue::string(crate::commands::help::get_help(&Command, ®istry)) + .into_value(Tag::unknown()), + ))) + } +} + +#[cfg(test)] +mod tests { + use super::Command; + + #[test] + fn examples_work_as_expected() { + use crate::examples::test as test_examples; + + test_examples(Command {}) + } +} diff --git a/crates/nu-cli/src/commands/date/mod.rs b/crates/nu-cli/src/commands/date/mod.rs index 6fcffd68ec..45f77ce7f6 100644 --- a/crates/nu-cli/src/commands/date/mod.rs +++ b/crates/nu-cli/src/commands/date/mod.rs @@ -1,9 +1,11 @@ +pub mod command; pub mod format; pub mod now; pub mod utc; mod utils; +pub use command::Command as Date; pub use format::Date as DateFormat; pub use now::Date as DateNow; pub use utc::Date as DateUTC;