mirror of
https://github.com/nushell/nushell
synced 2025-01-08 11:18:58 +00:00
82ac590412
# 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>
70 lines
1.1 KiB
Rust
70 lines
1.1 KiB
Rust
mod bits;
|
|
mod bytes;
|
|
mod charting;
|
|
mod conversions;
|
|
mod core_commands;
|
|
mod date;
|
|
mod default_context;
|
|
mod deprecated;
|
|
mod env;
|
|
mod example_test;
|
|
mod experimental;
|
|
mod filesystem;
|
|
mod filters;
|
|
mod formats;
|
|
mod generators;
|
|
mod hash;
|
|
mod input_handler;
|
|
mod math;
|
|
mod misc;
|
|
mod network;
|
|
mod path;
|
|
mod platform;
|
|
mod progress_bar;
|
|
mod random;
|
|
mod shells;
|
|
mod sort_utils;
|
|
mod strings;
|
|
mod system;
|
|
mod viewers;
|
|
|
|
pub use bits::*;
|
|
pub use bytes::*;
|
|
pub use charting::*;
|
|
pub use conversions::*;
|
|
pub use core_commands::*;
|
|
pub use date::*;
|
|
pub use default_context::*;
|
|
pub use deprecated::*;
|
|
pub use env::*;
|
|
#[cfg(test)]
|
|
pub use example_test::test_examples;
|
|
pub use experimental::*;
|
|
pub use filesystem::*;
|
|
pub use filters::*;
|
|
pub use formats::*;
|
|
pub use generators::*;
|
|
pub use hash::*;
|
|
pub use math::*;
|
|
pub use misc::*;
|
|
pub use network::*;
|
|
pub use path::*;
|
|
pub use platform::*;
|
|
pub use random::*;
|
|
pub use shells::*;
|
|
pub use sort_utils::*;
|
|
pub use strings::*;
|
|
pub use system::*;
|
|
pub use viewers::*;
|
|
|
|
#[cfg(feature = "dataframe")]
|
|
mod dataframe;
|
|
|
|
#[cfg(feature = "dataframe")]
|
|
pub use dataframe::*;
|
|
|
|
#[cfg(feature = "sqlite")]
|
|
mod database;
|
|
|
|
#[cfg(feature = "sqlite")]
|
|
pub use database::*;
|