nushell/crates/nu-command/src/lib.rs

64 lines
1 KiB
Rust
Raw Normal View History

mod bytes;
mod charting;
2021-10-11 01:56:19 +00:00
mod conversions;
2021-10-31 06:54:51 +00:00
mod date;
mod debug;
2021-09-02 22:58:15 +00:00
mod default_context;
2021-09-29 18:17:51 +00:00
mod env;
2021-10-09 13:10:10 +00:00
mod example_test;
2021-09-29 18:17:51 +00:00
mod experimental;
mod filesystem;
mod filters;
2021-10-01 05:11:49 +00:00
mod formats;
mod generators;
mod hash;
2023-06-14 21:12:55 +00:00
mod help;
2021-10-21 14:52:26 +00:00
mod math;
mod misc;
mod network;
mod path;
mod platform;
Progress bar Implementation (#7661) # Description _(Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience.)_ I implemented the status bar we talk about yesterday. The idea was inspired by the progress bar of `wget`. I decided to go for the second suggestion by `@Reilly` > 2. add an Option<usize> or whatever to RawStream (and ListStream?) for situations where you do know the length ahead of time For now only works with the command `save` but after the approve of this PR we can see how we can implement it on commands like `cp` and `mv` When using `fetch` nushell will check if there is any `content-length` attribute in the request header. If so, then `fetch` will send it through the new `Option` variable in the `RawStream` to the `save`. If we know the total size we show the progress bar ![nu_pb01](https://user-images.githubusercontent.com/38369407/210298647-07ee55ea-e751-41b1-a84d-f72ec1f6e9e5.jpg) but if we don't then we just show the stats like: data already saved, bytes per second, and time lapse. ![nu_pb02](https://user-images.githubusercontent.com/38369407/210298698-1ef65f51-40cc-4481-83de-309cbd1049cb.jpg) ![nu_pb03](https://user-images.githubusercontent.com/38369407/210298701-eef2ef13-9206-4a98-8202-e4fe5531d79d.jpg) Please let me know If I need to make any changes and I will be happy to do it. # User-Facing Changes A new flag (`--progress` `-p`) was added to the `save` command Examples: ```nu fetch https://github.com/torvalds/linux/archive/refs/heads/master.zip | save --progress -f main.zip fetch https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-desktop-amd64.iso | save --progress -f main.zip open main.zip --raw | save --progress main.copy ``` # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass - I am getting some errors and its weird because the errors are showing up in files i haven't touch. Is this normal? # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. Co-authored-by: Reilly Wood <reilly.wood@icloud.com>
2023-01-11 01:57:48 +00:00
mod progress_bar;
mod random;
mod removed;
2021-11-26 08:00:57 +00:00
mod shells;
mod sort_utils;
2021-10-24 23:58:18 +00:00
mod strings;
2021-09-29 18:17:51 +00:00
mod system;
mod viewers;
2021-09-02 22:58:15 +00:00
pub use bytes::*;
pub use charting::*;
2021-10-11 01:56:19 +00:00
pub use conversions::*;
2021-10-31 06:54:51 +00:00
pub use date::*;
pub use debug::*;
2021-09-29 18:17:51 +00:00
pub use default_context::*;
pub use env::*;
2021-12-19 07:46:13 +00:00
#[cfg(test)]
2021-10-09 13:10:10 +00:00
pub use example_test::test_examples;
2021-09-29 18:17:51 +00:00
pub use experimental::*;
pub use filesystem::*;
pub use filters::*;
2021-10-01 05:11:49 +00:00
pub use formats::*;
pub use generators::*;
pub use hash::*;
2023-06-14 21:12:55 +00:00
pub use help::*;
2021-10-21 14:52:26 +00:00
pub use math::*;
pub use misc::*;
pub use network::*;
pub use path::*;
pub use platform::*;
pub use random::*;
pub use removed::*;
2021-11-26 08:00:57 +00:00
pub use shells::*;
pub use sort_utils::*;
2021-10-24 23:58:18 +00:00
pub use strings::*;
2021-09-29 18:17:51 +00:00
pub use system::*;
pub use viewers::*;
#[cfg(feature = "sqlite")]
mod database;
#[cfg(feature = "sqlite")]
pub use database::*;