diff --git a/Cargo.lock b/Cargo.lock index a74ecc0b4..779c03156 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,12 +75,12 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.7" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -270,7 +270,7 @@ dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -346,7 +346,7 @@ dependencies = [ "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1917,7 +1917,7 @@ dependencies = [ "adhoc_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "async-trait 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "battery 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "byte-unit 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1959,7 +1959,7 @@ dependencies = [ "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty-hex 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "prettyprint 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "prettytable-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "ptree 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1970,7 +1970,7 @@ dependencies = [ "rustyline 5.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde-hjson 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde_ini 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1983,9 +1983,9 @@ dependencies = [ "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "toml-query 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2334,7 +2334,7 @@ dependencies = [ [[package]] name = "pretty_env_logger" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2372,7 +2372,7 @@ dependencies = [ "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2383,6 +2383,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ptree" version = "0.2.1" @@ -2424,6 +2432,14 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quote" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.4.6" @@ -2788,7 +2804,7 @@ dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8parse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2894,10 +2910,10 @@ dependencies = [ [[package]] name = "serde-hjson" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3079,6 +3095,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synstructure" version = "0.10.2" @@ -3187,7 +3213,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3368,7 +3394,7 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3384,7 +3410,7 @@ dependencies = [ "is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "toml-query_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3447,7 +3473,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-width" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -3757,7 +3783,7 @@ dependencies = [ "checksum app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" -"checksum async-trait 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "fe9bad189e61411cfbcc8822b4a2b1534983ee24295fc8460d6be53da1afad74" +"checksum async-trait 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "1c8373d24fa19a33892630018cd64600ac82b778d812075a11f99b49dfd0058b" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" "checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" @@ -3991,14 +4017,16 @@ dependencies = [ "checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" "checksum pretty-hex 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "119929a2a3b731bb3d888f7a1b5dc3c1db28b6c134def5d99f7e16e2da16b8f7" "checksum pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427" -"checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" +"checksum pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "717ee476b1690853d222af4634056d830b5197ffd747726a9a1eee6da9f49074" "checksum prettyprint 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f32f02328f651d5283173c7a9b2ef354b079fa535706547dde16d61ae23ecded" "checksum prettytable-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0fd04b170004fa2daccf418a7f8253aaf033c27760b5f225889024cf66d7ac2e" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" "checksum ptree 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0a3be00b19ee7bd33238c1c523a7ab4df697345f6b36f90827a7860ea938d4" "checksum publicsuffix 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5afecba86dcf1e4fd610246f89899d1924fe12e1e89f555eb7c7f710f3c5ad1d" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" @@ -4051,7 +4079,7 @@ dependencies = [ "checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" "checksum serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5626ac617da2f2d9c48af5515a21d5a480dbd151e01bb1c355e26a3e68113" "checksum serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0b833c5ad67d52ced5f5938b2980f32a9c1c5ef047f0b4fb3127e7a423c76153" -"checksum serde-hjson 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4640cf3168e40c00c874ff1ad436c0f18c37edec101d5d897a4396f617abce29" +"checksum serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8" "checksum serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a663f873dedc4eac1a559d4c6bc0d0b2c34dc5ac4702e105014b8281489e44f" "checksum serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45af0182ff64abaeea290235eb67da3825a576c5d53e642c4d5b652e12e6effc" "checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c" @@ -4074,6 +4102,7 @@ dependencies = [ "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum subprocess 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "28fc0f40f0c0da73339d347aa7d6d2b90341a95683a47722bc4eebed71ff3c00" "checksum syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ee06ea4b620ab59a2267c6b48be16244a3389f8bfa0986bdd15c35b890b00af3" +"checksum syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "158521e6f544e7e3dcfc370ac180794aa38cb34a1b1e07609376d4adcf429b93" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum syntect 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e80b8831c5a543192ffc3727f01cf0e57579c6ac15558e3048bfb5708892167b" "checksum sysinfo 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ee7d12b854e48e680bf4b10856a7867e843845158fa8226e6c2f6cc38539cb01" @@ -4100,7 +4129,7 @@ dependencies = [ "checksum tokio-threadpool 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "90ca01319dea1e376a001e8dc192d42ebde6dd532532a5bad988ac37db365b19" "checksum tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f2106812d500ed25a4f38235b9cae8f78a09edf43203e16e59c3b769a342a60e" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" -"checksum toml 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b8c96d7873fa7ef8bdeb3a9cda3ac48389b4154f32b9803b4bc26220b677b039" +"checksum toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c7aabe75941d914b72bf3e5d3932ed92ce0664d49d8432305a8b547c37227724" "checksum toml-query 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "654d5afba116c445bb5fb6812e7c3177d90d143427af73f12956f33e18a1cedb" "checksum toml-query_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c99ca245ec273c7e75c8ee58f47b882d0146f3c2c8495158082c6671e8b5335" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" @@ -4110,7 +4139,7 @@ dependencies = [ "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" "checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" diff --git a/Cargo.toml b/Cargo.toml index b657d606d..deea8a365 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,15 +31,15 @@ prettyprint = "0.7.0" futures-preview = { version = "=0.3.0-alpha.18", features = ["compat", "io-compat"] } futures-sink-preview = "=0.3.0-alpha.18" futures-async-stream = "0.1.0-alpha.1" -async-trait = "0.1.7" +async-trait = "0.1.10" futures_codec = "0.2.5" term = "0.5.2" bytes = "0.4.12" log = "0.4.8" -pretty_env_logger = "0.3.0" +pretty_env_logger = "0.3.1" serde = { version = "1.0.98", features = ["derive"] } serde_json = "1.0.40" -serde-hjson = "0.9.0" +serde-hjson = "0.9.1" serde_yaml = "0.8" serde_bytes = "0.11.2" getset = "0.0.7" @@ -48,7 +48,7 @@ logos-derive = "0.10.0-rc2" language-reporting = "0.3.1" app_dirs = "1.2.1" csv = "1.1" -toml = "0.5.1" +toml = "0.5.3" toml-query = "0.9.2" clap = "2.33.0" enum_derive = "0.1.7" @@ -59,7 +59,6 @@ dirs = "2.0.2" glob = "0.3.0" ctrlc = "3.1.3" ptree = "0.2" -clipboard = "0.5" reqwest = "0.9" roxmltree = "0.7.0" nom5_locate = "0.1.1" @@ -72,7 +71,6 @@ mime = "0.3.13" regex = "1.2.1" pretty-hex = "0.1.0" neso = "0.5.0" -rawkey = "0.1.2" crossterm = "0.10.2" tempfile = "3.1.0" image = "0.22.1" @@ -85,7 +83,9 @@ heim = "0.0.6" which = "2.0.1" battery = "0.7.4" textwrap = {version = "0.11.0", features = ["term_size"]} -unicode-width = "0.1.5" +unicode-width = "0.1.6" +rawkey = {version = "0.1.2", optional = true } +clipboard = {version = "0.5", optional = true } [dev-dependencies] pretty_assertions = "0.6.1" diff --git a/src/cli.rs b/src/cli.rs index 357ee6fb0..28fef9556 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -184,7 +184,6 @@ pub async fn cli() -> Result<(), Box> { whole_stream_command(SkipWhile), per_item_command(Enter), whole_stream_command(Exit), - whole_stream_command(Clip), whole_stream_command(Autoview), per_item_command(Cpy), whole_stream_command(Date), @@ -196,6 +195,13 @@ pub async fn cli() -> Result<(), Box> { whole_stream_command(Version), whole_stream_command(Which), ]); + + #[cfg(feature = "clipboard")] + { + context.add_commands(vec![whole_stream_command( + crate::commands::clip::clipboard::Clip, + )]); + } } let _ = load_plugins(&mut context); diff --git a/src/commands.rs b/src/commands.rs index 1591747f8..19995ab7a 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -57,9 +57,8 @@ crate mod which_; crate use autoview::Autoview; crate use cd::CD; -crate use clip::Clip; crate use command::{ - per_item_command, whole_stream_command, Command, CommandArgs, PerItemCommand, RawCommandArgs, + per_item_command, whole_stream_command, Command, PerItemCommand, RawCommandArgs, UnevaluatedCallInfo, WholeStreamCommand, }; crate use config::Config; diff --git a/src/commands/clip.rs b/src/commands/clip.rs index f9fbd8d11..535c8f745 100644 --- a/src/commands/clip.rs +++ b/src/commands/clip.rs @@ -1,77 +1,81 @@ -use crate::commands::{CommandArgs, WholeStreamCommand}; -use crate::context::CommandRegistry; -use crate::errors::{labelled, ShellError}; -use crate::prelude::*; -use clipboard::{ClipboardContext, ClipboardProvider}; -use futures::stream::StreamExt; -use futures_async_stream::async_stream_block; +#[cfg(feature = "clipboard")] +pub mod clipboard { + use crate::commands::WholeStreamCommand; + use crate::context::CommandRegistry; + use crate::errors::ShellError; + use crate::prelude::*; + use futures::stream::StreamExt; + use futures_async_stream::async_stream_block; -pub struct Clip; + use clipboard::{ClipboardContext, ClipboardProvider}; -#[derive(Deserialize)] -pub struct ClipArgs {} + pub struct Clip; -impl WholeStreamCommand for Clip { - fn name(&self) -> &str { - "clip" - } - fn run( - &self, - args: CommandArgs, - registry: &CommandRegistry, - ) -> Result { - args.process(registry, clip)?.run() - } + #[derive(Deserialize)] + pub struct ClipArgs {} - fn signature(&self) -> Signature { - Signature::build("clip") - } -} + impl WholeStreamCommand for Clip { + fn name(&self) -> &str { + "clip" + } + fn run( + &self, + args: CommandArgs, + registry: &CommandRegistry, + ) -> Result { + args.process(registry, clip)?.run() + } -pub fn clip( - ClipArgs {}: ClipArgs, - RunnableContext { input, name, .. }: RunnableContext, -) -> Result { - let stream = async_stream_block! { - let values: Vec> = input.values.collect().await; - - inner_clip(values, name).await; - }; - - let stream: BoxStream<'static, ReturnValue> = stream.boxed(); - - Ok(OutputStream::from(stream)) -} - -async fn inner_clip(input: Vec>, name: Span) -> OutputStream { - let mut clip_context: ClipboardContext = ClipboardProvider::new().unwrap(); - let mut new_copy_data = String::new(); - - if input.len() > 0 { - let mut first = true; - for i in input.iter() { - if !first { - new_copy_data.push_str("\n"); - } else { - first = false; - } - - let s = i.as_string().map_err(labelled( - name, - "Given non-string data", - "expected strings from pipeline", - )); - - let string: String = match s { - Ok(string) => string, - Err(err) => return OutputStream::one(Err(err)), - }; - - new_copy_data.push_str(&string); + fn signature(&self) -> Signature { + Signature::build("clip") } } - clip_context.set_contents(new_copy_data).unwrap(); + pub fn clip( + ClipArgs {}: ClipArgs, + RunnableContext { input, name, .. }: RunnableContext, + ) -> Result { + let stream = async_stream_block! { + let values: Vec> = input.values.collect().await; - OutputStream::empty() + inner_clip(values, name).await; + }; + + let stream: BoxStream<'static, ReturnValue> = stream.boxed(); + + Ok(OutputStream::from(stream)) + } + + async fn inner_clip(input: Vec>, name: Span) -> OutputStream { + let mut clip_context: ClipboardContext = ClipboardProvider::new().unwrap(); + let mut new_copy_data = String::new(); + + if input.len() > 0 { + let mut first = true; + for i in input.iter() { + if !first { + new_copy_data.push_str("\n"); + } else { + first = false; + } + + let string: String = match i.as_string() { + Ok(string) => string, + Err(_) => { + return OutputStream::one(Err(ShellError::labeled_error( + "Given non-string data", + "expected strings from pipeline", + name, + ))) + } + }; + + new_copy_data.push_str(&string); + } + } + + clip_context.set_contents(new_copy_data).unwrap(); + + OutputStream::empty() + } } diff --git a/src/commands/command.rs b/src/commands/command.rs index 76a13e407..904a1f03b 100644 --- a/src/commands/command.rs +++ b/src/commands/command.rs @@ -102,9 +102,6 @@ pub struct CommandArgs { pub host: Arc>, pub shell_manager: ShellManager, pub call_info: UnevaluatedCallInfo, - // pub host: Arc>, - // pub shell_manager: ShellManager, - // pub call_info: CallInfo, pub input: InputStream, } diff --git a/src/errors.rs b/src/errors.rs index 359b472ab..15d2e4500 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -40,15 +40,15 @@ pub enum ArgumentError { MissingValueForName(String), } -pub fn labelled( - span: impl Into, - heading: &'a str, - span_message: &'a str, -) -> impl FnOnce(ShellError) -> ShellError + 'a { - let span = span.into(); +// pub fn labelled( +// span: impl Into, +// heading: &'a str, +// span_message: &'a str, +// ) -> impl FnOnce(ShellError) -> ShellError + 'a { +// let span = span.into(); - move |_| ShellError::labeled_error(heading, span_message, span) -} +// move |_| ShellError::labeled_error(heading, span_message, span) +// } #[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Serialize, Deserialize)] pub struct ShellError { diff --git a/src/plugins/binaryview.rs b/src/plugins/binaryview.rs index 070de6819..5668fa869 100644 --- a/src/plugins/binaryview.rs +++ b/src/plugins/binaryview.rs @@ -49,8 +49,16 @@ fn view_binary( if b.len() > 3 { match (b[0], b[1], b[2]) { (0x4e, 0x45, 0x53) => { - view_contents_interactive(b, source, lores_mode)?; - return Ok(()); + #[cfg(feature = "rawkey")] + { + view_contents_interactive(b, source, lores_mode)?; + return Ok(()); + } + #[cfg(not(feature = "rawkey"))] + { + println!("Interactive binary viewing currently requires the 'rawkey' feature"); + return Ok(()); + } } _ => {} } @@ -339,6 +347,7 @@ pub fn view_contents( Ok(()) } +#[cfg(feature = "rawkey")] pub fn view_contents_interactive( buffer: &[u8], source: Option<&SpanSource>, diff --git a/src/plugins/textview.rs b/src/plugins/textview.rs index b5899ac19..5a9a011df 100644 --- a/src/plugins/textview.rs +++ b/src/plugins/textview.rs @@ -6,7 +6,6 @@ use nu::{ serve_plugin, CallInfo, Plugin, Primitive, ShellError, Signature, SourceMap, SpanSource, Tagged, Value, }; -use rawkey::RawKey; use syntect::easy::HighlightLines; use syntect::highlighting::{Style, ThemeSet}; @@ -14,7 +13,6 @@ use syntect::parsing::SyntaxSet; use std::io::Write; use std::path::Path; -use std::{thread, time::Duration}; enum DrawCommand { DrawString(Style, String), @@ -126,35 +124,22 @@ fn paint_textview( fn scroll_view_lines_if_needed(draw_commands: Vec, use_color_buffer: bool) { let mut starting_row = 0; - let rawkey = RawKey::new(); - if let Ok(_raw) = RawScreen::into_raw_mode() { let cursor = cursor(); let _ = cursor.hide(); let input = crossterm::input(); - let use_rawkey; - let mut sync_stdin = None; + #[allow(unused)] + let mut sync_stdin: Option; - #[cfg(target_os = "linux")] + #[cfg(feature = "rawkey")] { - // if we're in Linux but not X11, we need to avoid using rawkey for now - if std::env::var("DISPLAY").is_err() { - use_rawkey = false; - } else { - use_rawkey = true; - } - } - - #[cfg(not(target_os = "linux"))] - { - use_rawkey = true - } - - if use_rawkey { let _ = input.read_async(); - } else { + } + + #[cfg(not(feature = "rawkey"))] + { sync_stdin = Some(input.read_sync()); } @@ -167,7 +152,12 @@ fn scroll_view_lines_if_needed(draw_commands: Vec, use_color_buffer // Only scroll if needed if max_bottom_line > height as usize { loop { - if use_rawkey { + #[cfg(feature = "rawkey")] + { + use std::{thread, time::Duration}; + + let rawkey = rawkey::RawKey::new(); + if rawkey.is_pressed(rawkey::KeyCode::Escape) { break; } @@ -204,7 +194,10 @@ fn scroll_view_lines_if_needed(draw_commands: Vec, use_color_buffer paint_textview(&draw_commands, starting_row, use_color_buffer); } thread::sleep(Duration::from_millis(50)); - } else { + } + + #[cfg(not(feature = "rawkey"))] + { use crossterm::{InputEvent, KeyEvent}; if let Some(ref mut sync_stdin) = sync_stdin {