@@ -26,9 +26,9 @@ mod platform {
2626    pub  use  crate :: pslinux:: * ; 
2727} 
2828
29+ /// ps - report process status 
2930#[ derive( Parser ) ]  
30- #[ command( name = "ps" ) ]  
31- #[ command( about = "Report process status" ,  version = "1.0" ) ]  
31+ #[ command( author,  version,  about,  long_about) ]  
3232struct  Args  { 
3333    /// List all processes 
3434#[ arg( short = 'A' ,  long) ]  
@@ -39,30 +39,30 @@ struct Args {
3939    all2 :  bool , 
4040
4141    /// List all processes associated with terminals 
42- #[ arg( short = 'a' ,  long ) ]  
42+ #[ arg( short = 'a' ) ]  
4343    terminal_processes :  bool , 
4444
4545    /// Exclude session leaders 
46- #[ arg( short = 'd' ,  long ) ]  
46+ #[ arg( short = 'd' ) ]  
4747    exclude_session_leaders :  bool , 
4848
4949    /// Full output format (-f) 
50- #[ arg( short = 'f' ,  long) ]  
50+ #[ arg( short = 'f' ,  long =  "full" ) ]  
5151    full_format :  bool , 
5252
5353    /// Long output format (-l) 
54- #[ arg( short = 'l' ,  long) ]  
54+ #[ arg( short = 'l' ,  long =  "long" ) ]  
5555    long_format :  bool , 
5656
5757    /// Custom output format (-o) 
58- #[ arg( short = 'o' ,  long ,   value_parser = clap:: builder:: NonEmptyStringValueParser :: new( ) ) ]  
58+ #[ arg( short = 'o' ,  value_parser = clap:: builder:: NonEmptyStringValueParser :: new( ) ) ]  
5959    output_format :  Option < String > , 
6060} 
6161
6262// Parse the -o format option into a list of fields 
6363fn  parse_output_format < ' a > ( 
6464    format :  & ' a  str , 
65-     posix_fields :  & ' a  HashMap < & ' a  str ,  ( & ' a  str ,   & ' a   str ) > , 
65+     posix_fields :  & ' a  HashMap < & ' a  str ,  & ' a  str > , 
6666)  -> Vec < & ' a  str >  { 
6767    format
6868        . split ( |c| c == ' '  || c == ',' ) 
@@ -78,23 +78,23 @@ fn parse_output_format<'a>(
7878} 
7979
8080// Lookup table for POSIX-compliant output fields 
81- fn  posix_field_map ( )  -> HashMap < & ' static  str ,  ( & ' static  str ,   & ' static   str ) >  { 
81+ fn  posix_field_map ( )  -> HashMap < & ' static  str ,  & ' static  str >  { 
8282    HashMap :: from ( [ 
83-         ( "ruser" ,  ( "uid" ,   " RUSER") ) , 
84-         ( "user" ,  ( "uid" ,   " USER") ) , 
85-         ( "rgroup" ,  ( "gid" ,   " RGROUP") ) , 
86-         ( "group" ,  ( "gid" ,   " GROUP") ) , 
87-         ( "pid" ,  ( "pid" ,   " PID") ) , 
88-         ( "ppid" ,  ( "ppid" ,   " PPID") ) , 
89-         ( "pgid" ,  ( "pgid" ,   " PGID") ) , 
90-         ( "pcpu" ,  ( "pcpu" ,   " %CPU") ) , 
91-         ( "vsz" ,  ( "vsz" ,   " VSZ") ) , 
92-         ( "nice" ,  ( "nice" ,   " NI") ) , 
93-         ( "etime" ,  ( "etime" ,   " ELAPSED") ) , 
94-         ( "time" ,  ( "time" ,   " TIME") ) , 
95-         ( "tty" ,  ( "tty" ,   " TTY") ) , 
96-         ( "comm" ,  ( "comm" ,   " COMMAND") ) , 
97-         ( "args" ,  ( "args" ,   " COMMAND") ) , 
83+         ( "ruser" ,  " RUSER") , 
84+         ( "user" ,  " USER") , 
85+         ( "rgroup" ,  " RGROUP") , 
86+         ( "group" ,  " GROUP") , 
87+         ( "pid" ,  " PID") , 
88+         ( "ppid" ,  " PPID") , 
89+         ( "pgid" ,  " PGID") , 
90+         ( "pcpu" ,  " %CPU") , 
91+         ( "vsz" ,  " VSZ") , 
92+         ( "nice" ,  " NI") , 
93+         ( "etime" ,  " ELAPSED") , 
94+         ( "time" ,  " TIME") , 
95+         ( "tty" ,  " TTY") , 
96+         ( "comm" ,  " COMMAND") , 
97+         ( "args" ,  " COMMAND") , 
9898    ] ) 
9999} 
100100
@@ -148,7 +148,7 @@ fn main() {
148148
149149    // Print the header 
150150    for  field in  & output_fields { 
151-         let  header = posix_fields. get ( * field) . unwrap_or ( & ( & field,   & field ) ) . 1 ; 
151+         let  header = posix_fields. get ( * field) . unwrap_or ( & field) ; 
152152        print ! ( "{:<10} " ,  header) ; 
153153    } 
154154    println ! ( ) ; 
0 commit comments