Add documentation and rename a few things

This commit is contained in:
Ian Manske
2025-03-08 18:56:38 -08:00
parent 22a7ec5125
commit e8c3694050
3 changed files with 199 additions and 67 deletions

View File

@ -1,6 +1,6 @@
use nu_cmd_base::input_handler::{operate, CmdArgument};
use nu_engine::command_prelude::*;
use nu_protocol::{engine::StateWorkingSet, FilesizeFormat, FilesizeUnit};
use nu_protocol::{engine::StateWorkingSet, FilesizeFormatter, FilesizeUnit};
struct Arguments {
unit: FilesizeUnit,
@ -128,8 +128,9 @@ fn format_value_impl(val: &Value, arg: &Arguments, span: Span) -> Value {
let value_span = val.span();
match val {
Value::Filesize { val, .. } => Value::string(
FilesizeFormat::new()
FilesizeFormatter::new()
.unit(arg.unit)
.precision(None)
.format(*val)
.to_string(),
span,