diff options
author | Canop <cano.petrole@gmail.com> | 2020-03-30 22:22:51 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-03-30 22:22:51 +0200 |
commit | 8015fa9ab19539ccb33e2bf69aee58c9827f9128 (patch) | |
tree | 50995bad0333cf6e1c86b8d657ab22ea7e2e0f42 | |
parent | 452dd38cc22aa66f11c2377eaafca521871d1184 (diff) |
moved files around
refactored, added a few mods into a less flat source structure.
-rw-r--r-- | Cargo.lock | 172 | ||||
-rw-r--r-- | src/app/app.rs (renamed from src/app.rs) | 20 | ||||
-rw-r--r-- | src/app/cmd_result.rs | 43 | ||||
-rw-r--r-- | src/app/context.rs (renamed from src/app_context.rs) | 0 | ||||
-rw-r--r-- | src/app/mod.rs | 12 | ||||
-rw-r--r-- | src/app/state.rs | 51 | ||||
-rw-r--r-- | src/app_state.rs | 87 | ||||
-rw-r--r-- | src/browser/browser_state.rs (renamed from src/browser_states.rs) | 17 | ||||
-rw-r--r-- | src/browser/browser_verbs.rs (renamed from src/browser_verbs.rs) | 12 | ||||
-rw-r--r-- | src/browser/mod.rs | 7 | ||||
-rw-r--r-- | src/cli.rs | 10 | ||||
-rw-r--r-- | src/command/action.rs | 51 | ||||
-rw-r--r-- | src/command/command.rs (renamed from src/commands.rs) | 128 | ||||
-rw-r--r-- | src/command/mod.rs | 12 | ||||
-rw-r--r-- | src/command/parsing.rs (renamed from src/command_parsing.rs) | 11 | ||||
-rw-r--r-- | src/command/parts.rs | 81 | ||||
-rw-r--r-- | src/conf.rs | 4 | ||||
-rw-r--r-- | src/displayable_tree.rs | 4 | ||||
-rw-r--r-- | src/external.rs | 42 | ||||
-rw-r--r-- | src/flat_tree.rs | 2 | ||||
-rw-r--r-- | src/git/ignore.rs (renamed from src/git_ignore.rs) | 0 | ||||
-rw-r--r-- | src/git/mod.rs (renamed from src/git.rs) | 22 | ||||
-rw-r--r-- | src/git/status.rs (renamed from src/git_status.rs) | 0 | ||||
-rw-r--r-- | src/git/status_computer.rs (renamed from src/git_status_computer.rs) | 4 | ||||
-rw-r--r-- | src/git/status_display.rs (renamed from src/git_status_display.rs) | 6 | ||||
-rw-r--r-- | src/help/help_content.rs (renamed from src/help_content.rs) | 2 | ||||
-rw-r--r-- | src/help/help_state.rs (renamed from src/help_states.rs) | 13 | ||||
-rw-r--r-- | src/help/help_verbs.rs (renamed from src/help_verbs.rs) | 32 | ||||
-rw-r--r-- | src/help/mod.rs | 9 | ||||
-rw-r--r-- | src/lib.rs | 23 | ||||
-rw-r--r-- | src/main.rs | 1 | ||||
-rw-r--r-- | src/pattern/fuzzy_patterns.rs (renamed from src/fuzzy_patterns.rs) | 7 | ||||
-rw-r--r-- | src/pattern/matched_string.rs (renamed from src/matched_string.rs) | 4 | ||||
-rw-r--r-- | src/pattern/mod.rs | 20 | ||||
-rw-r--r-- | src/pattern/pattern.rs (renamed from src/patterns.rs) | 16 | ||||
-rw-r--r-- | src/pattern/regex_patterns.rs (renamed from src/regex_patterns.rs) | 21 | ||||
-rw-r--r-- | src/screens.rs | 6 | ||||
-rw-r--r-- | src/shell_install/mod.rs | 4 | ||||
-rw-r--r-- | src/skin/mad_skin.rs (renamed from src/mad_skin.rs) | 4 | ||||
-rw-r--r-- | src/skin/mod.rs | 14 | ||||
-rw-r--r-- | src/skin/skin.rs (renamed from src/skin.rs) | 25 | ||||
-rw-r--r-- | src/skin/skin_conf.rs (renamed from src/skin_conf.rs) | 5 | ||||
-rw-r--r-- | src/tree_build/bid.rs | 6 | ||||
-rw-r--r-- | src/tree_build/bline.rs | 4 | ||||
-rw-r--r-- | src/tree_build/builder.rs | 8 | ||||
-rw-r--r-- | src/tree_options.rs | 6 | ||||
-rw-r--r-- | src/verb_invocation.rs | 1 | ||||
-rw-r--r-- | src/verbs.rs | 6 |
48 files changed, 609 insertions, 426 deletions
@@ -97,7 +97,7 @@ version = "0.13.5" dependencies = [ "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "crossterm 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "custom_error 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -132,6 +132,11 @@ dependencies = [ ] [[package]] +name = "bumpalo" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "byteorder" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -198,31 +203,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "criterion" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion-plot 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xoshiro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "oorandom 11.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion-plot" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -442,16 +447,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "getrandom" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "git2" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -529,6 +524,14 @@ dependencies = [ ] [[package]] +name = "js-sys" +version = "0.3.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -693,6 +696,11 @@ dependencies = [ ] [[package]] +name = "oorandom" +version = "11.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "open" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -738,6 +746,17 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "plotters" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "proc-macro2" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -767,14 +786,6 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "rand_os" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -788,35 +799,18 @@ dependencies = [ ] [[package]] -name = "rand_os" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_xoshiro" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "rayon" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon-core" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1161,7 +1155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.2.9" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1170,9 +1164,62 @@ dependencies = [ ] [[package]] -name = "wasi" -version = "0.7.0" +name = "wasm-bindgen" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (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.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (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.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "web-sys" +version = "0.3.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "winapi" @@ -1234,6 +1281,7 @@ dependencies = [ "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "5850aeee1552f495dd0250014cf64b82b7c8879a89d83b33bbdace2cc4f63182" "checksum bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8d6c2c5b58ab920a4f5aeaaca34b4488074e8cc7596af94e6f8c6ff247c60245" +"checksum bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" "checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c" @@ -1242,8 +1290,8 @@ dependencies = [ "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120" -"checksum criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "938703e165481c8d612ea3479ac8342e5615185db37765162e762ec3523e2fc6" -"checksum criterion-plot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eccdc6ce8bbe352ca89025bee672aa6d24f4eb8c53e3a8b5d1bc58011da072a2" +"checksum criterion 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc755679c12bda8e5523a71e4d654b6bf2e14bd838dfc48cde6559a05caf7d1" +"checksum criterion-plot 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a01e15e0ea58e8234f96146b1f91fa9d0e4dd7a38da93ff7a75d42c0b9d3a545" "checksum crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2d818a4990769aac0c7ff1360e233ef3a41adcb009ebb2036bf6915eb0f6b23c" "checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa" "checksum crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca" @@ -1267,7 +1315,6 @@ dependencies = [ "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" "checksum git2 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77519ef7c5beee314d0804d4534f01e0f9e8d9acdee2b7a48627e590b27e0ec4" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" "checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120" @@ -1278,6 +1325,7 @@ dependencies = [ "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum jobserver 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "67b06c1b455f1cf4269a8cfc320ab930a810e2375a42af5075eb8a8b36405ce0" +"checksum js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy-regex 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "03d91276c62198fd9dd1be0d8a4ed647d0a51d5d6a0679dc324dd0b499d024ff" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" @@ -1297,22 +1345,21 @@ dependencies = [ "checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72" +"checksum oorandom 11.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebcec7c9c2a95cacc7cd0ecb89d8a8454eca13906f6deb55258ffff0adeb9405" "checksum open 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c283bf0114efea9e42f1a60edea9859e8c47528eae09d01df4b29c1e489cc48" "checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" "checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" "checksum pathdiff 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a3bf70094d203e07844da868b634207e71bfab254fe713171fae9a6e751ccf31" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +"checksum plotters 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "4e3bb8da247d27ae212529352020f3e5ee16e83c0c258061d27b08ab92675eeb" "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -"checksum rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a788ae3edb696cfcba1c19bfd388cc4b8c21f8a408432b199c072825084da58a" -"checksum rand_xoshiro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e18c91676f670f6f0312764c759405f13afb98d5d73819840cf72a518487bff" -"checksum rayon 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "43739f8831493b276363637423d3622d4bd6394ab6f0a9c4a552e208aeb7fddd" -"checksum rayon-core 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8bf17de6f23b05473c437eb958b9c850bfc8af0961fe17b4cc92d5a627b4791" +"checksum rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098" +"checksum rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" @@ -1356,8 +1403,13 @@ dependencies = [ "checksum users 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c72f4267aea0c3ec6d07eaabea6ead7c5ddacfafc5e22bcf8d186706851fb4cf" "checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" -"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" +"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +"checksum wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" +"checksum wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" +"checksum wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" +"checksum wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" +"checksum wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" +"checksum web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/src/app.rs b/src/app/app.rs index d514277..0dbd6c9 100644 --- a/src/app.rs +++ b/src/app/app.rs @@ -10,15 +10,15 @@ use { crate::{ - app_context::AppContext, - app_state::{AppState, AppStateCmdResult}, - browser_states::BrowserState, - command_parsing::parse_command_sequence, - commands::Command, + browser::BrowserState, + command::{ + Command, + parse_command_sequence, + }, errors::ProgramError, external::Launchable, file_sizes, - git_status_computer, + git, io::WriteCleanup, screens::Screen, skin::Skin, @@ -33,6 +33,11 @@ use { }, minimad::Composite, std::io::Write, + super::{ + AppContext, + AppState, + AppStateCmdResult, + }, termimad::EventSource, }; @@ -96,7 +101,6 @@ impl App { Ok(()) } - /// apply a command, and returns a command, which may be the same (modified or not) /// or a new one. /// This normally mutates self @@ -270,5 +274,5 @@ impl Drop for App { /// command. fn clear_caches() { file_sizes::clear_cache(); - git_status_computer::clear_cache(); + git::clear_status_computer_cache(); } diff --git a/src/app/cmd_result.rs b/src/app/cmd_result.rs new file mode 100644 index 0000000..3952bfa --- /dev/null +++ b/src/app/cmd_result.rs @@ -0,0 +1,43 @@ +use { + crate::{ + browser::BrowserState, + command::Command, + errors::TreeBuildError, + external::Launchable, + }, + super::*, +}; + +/// Result of applying a command to a state +pub enum AppStateCmdResult { + Quit, + Keep, + Launch(Box<Launchable>), + DisplayError(String), + NewState(Box<dyn AppState>, Command), + PopStateAndReapply, // the state asks the command be executed on a previous state + PopState, + RefreshState { clear_cache: bool }, +} + +impl AppStateCmdResult { + pub fn verb_not_found(text: &str) -> AppStateCmdResult { + AppStateCmdResult::DisplayError(format!("verb not found: {:?}", &text)) + } + pub fn from_optional_state( + os: Result<Option<BrowserState>, TreeBuildError>, + cmd: Command, + ) -> AppStateCmdResult { + match os { + Ok(Some(os)) => AppStateCmdResult::NewState(Box::new(os), cmd), + Ok(None) => AppStateCmdResult::Keep, + Err(e) => AppStateCmdResult::DisplayError(e.to_string()), + } + } +} + +impl From<Launchable> for AppStateCmdResult { + fn from(launchable: Launchable) -> Self { + AppStateCmdResult::Launch(Box::new(launchable)) + } +} diff --git a/src/app_context.rs b/src/app/context.rs index 7ccc7a9..7ccc7a9 100644 --- a/src/app_context.rs +++ b/src/app/context.rs diff --git a/src/app/mod.rs b/src/app/mod.rs new file mode 100644 index 0000000..b18ce34 --- /dev/null +++ b/src/app/mod.rs @@ -0,0 +1,12 @@ + +mod app; +mod context; +mod state; +mod cmd_result; + +pub use { + app::App, + context::AppContext, + cmd_result::AppStateCmdResult, + state::AppState, +}; diff --git a/src/app/state.rs b/src/app/state.rs new file mode 100644 index 0000000..f68e92a --- /dev/null +++ b/src/app/state.rs @@ -0,0 +1,51 @@ +use { + crate::{ + command::Command, + errors::ProgramError, + screens::Screen, + task_sync::Dam, + }, + std::io::Write, + super::*, +}; + +/// a whole application state, stackable to allow reverting +/// to a previous one +pub trait AppState { + fn apply( + &mut self, + cmd: &mut Command, + screen: &mut Screen, + con: &AppContext, + ) -> Result<AppStateCmdResult, ProgramError>; + + fn can_execute(&self, verb_index: usize, con: &AppContext) -> bool; + + fn refresh(&mut self, screen: &Screen, con: &AppContext) -> Command; + + fn do_pending_task(&mut self, screen: &mut Screen, dam: &mut Dam); + + fn has_pending_task(&self) -> bool; + + fn display( + &mut self, + w: &mut dyn Write, + screen: &Screen, + con: &AppContext, + ) -> Result<(), ProgramError>; + + fn write_flags( + &self, + w: &mut dyn Write, + screen: &mut Screen, + con: &AppContext, + ) -> Result<(), ProgramError>; + + fn write_status( + &self, + w: &mut dyn Write, + cmd: &Command, + screen: &Screen, + con: &AppContext, + ) -> Result<(), ProgramError>; +} diff --git a/src/app_state.rs b/src/app_state.rs deleted file mode 100644 index 1d8b1b2..0000000 --- a/src/app_state.rs +++ /dev/null @@ -1,87 +0,0 @@ -use { - crate::{ - app_context::AppContext, - browser_states::BrowserState, - commands::Command, - errors::{ProgramError, TreeBuildError}, - external::Launchable, - screens::Screen, - task_sync::Dam, - }, - std::io::Write, -}; - -/// Result of applying a command to a state -pub enum AppStateCmdResult { - Quit, - Keep, - Launch(Box<Launchable>), - DisplayError(String), - NewState(Box<dyn AppState>, Command), - PopStateAndReapply, // the state asks the command be executed on a previous state - PopState, - RefreshState { clear_cache: bool }, -} - -impl AppStateCmdResult { - pub fn verb_not_found(text: &str) -> AppStateCmdResult { - AppStateCmdResult::DisplayError(format!("verb not found: {:?}", &text)) - } - pub fn from_optional_state( - os: Result<Option<BrowserState>, TreeBuildError>, - cmd: Command, - ) -> AppStateCmdResult { < |