File tree 2 files changed +5
-6
lines changed
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 5
5
6
6
use crate :: picker:: { sysinfo, systemstat} ;
7
7
use bytesize:: ByteSize ;
8
- use clap:: ArgMatches ;
9
8
use systemstat:: Platform ;
10
9
11
- pub ( crate ) fn header ( arg : & ArgMatches ) -> String {
10
+ pub ( crate ) fn header ( scale_summary_mem : Option < & String > ) -> String {
12
11
format ! (
13
12
"top - {time} {uptime}, {user}, {load_average}\n \
14
13
{task}\n \
@@ -20,7 +19,7 @@ pub(crate) fn header(arg: &ArgMatches) -> String {
20
19
load_average = load_average( ) ,
21
20
task = task( ) ,
22
21
cpu = cpu( ) ,
23
- memory = memory( arg ) ,
22
+ memory = memory( scale_summary_mem ) ,
24
23
)
25
24
}
26
25
@@ -331,9 +330,9 @@ fn cpu() -> String {
331
330
todo ( )
332
331
}
333
332
334
- fn memory ( arg : & ArgMatches ) -> String {
333
+ fn memory ( scale_summary_mem : Option < & String > ) -> String {
335
334
let binding = sysinfo ( ) . read ( ) . unwrap ( ) ;
336
- let ( unit, unit_name) = match arg . get_one :: < String > ( "scale-summary-mem" ) {
335
+ let ( unit, unit_name) = match scale_summary_mem {
337
336
Some ( scale) => match scale. as_str ( ) {
338
337
"k" => ( bytesize:: KIB , "KiB" ) ,
339
338
"m" => ( bytesize:: MIB , "MiB" ) ,
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
99
99
table
100
100
} ;
101
101
102
- println ! ( "{}" , header( & matches) ) ;
102
+ println ! ( "{}" , header( matches. get_one :: < String > ( "scale-summary-mem" ) ) ) ;
103
103
println ! ( "\n " ) ;
104
104
105
105
let cutter = {
You can’t perform that action at this time.
0 commit comments