From 9e9a67168d8e53afd54d4f68142d76b001833bfc Mon Sep 17 00:00:00 2001 From: Harald Hope Date: Mon, 26 Mar 2018 15:03:15 -0700 Subject: [PATCH] New version, new man page. Bug fixes, feature/output tweaks. Bugs fixed: 1. stray undefined value corrected 2. fixed BSD no pkg server case, now shows correctly that no pkg server files were found, not that the OS is not supported. Features: 1. -t c and m headers cleaned up and simplified 2. man page edits. 3. more standarization of key names for fields, some spelling and upper/lower case corrections. --- inxi | 95 ++++++++++++++++++++++++++++++++------------------ inxi.1 | 16 +++++---- inxi.changelog | 24 +++++++++++++ 3 files changed, 95 insertions(+), 40 deletions(-) diff --git a/inxi b/inxi index a6c0601..eb75c3b 100755 --- a/inxi +++ b/inxi @@ -36,8 +36,8 @@ use POSIX qw(uname strftime ttyname); ## INXI INFO ## my $self_name='inxi'; -my $self_version='2.9.07'; -my $self_date='2018-03-25'; +my $self_version='2.9.08'; +my $self_date='2018-03-26'; my $self_patch='00'; ## END INXI INFO ## @@ -2994,6 +2994,7 @@ sub program_version { if ( $ENV{'KSH_VERSION'} ){ my @temp = split /\s+/, $ENV{'KSH_VERSION'}; if ($temp[2]){ + $temp[2] =~ s/^v//i; # trim off leading v log_data('data',"Program *ksh array: @temp version: $temp[2]") if $b_log; return $temp[2]; } @@ -3323,8 +3324,8 @@ sub get_options{ eval $start if $b_log; my (@args) = @_; $show{'short'} = 1; - my ($b_downloader,$b_no_man,$b_no_man_force,$b_recommends,$b_updater, - $b_version,$b_use_man,$help_type,$self_download, $download_id); + my ($b_downloader,$b_no_man,$b_no_man_force,$b_recommends,$b_updater,$b_version, + $b_use_man,$help_type,$self_download, $download_id); GetOptions ( 'A|audio' => sub { $show{'short'} = 0; @@ -3529,7 +3530,7 @@ sub get_options{ } if ($arg >= 7 ){ $b_downloader = 1 if ! check_program('dig'); - $show{'flag'} = 1; + $show{'cpu-flag'} = 1; $show{'ip'} = 1; $show{'raid-forced'} = 1; $extra = 3; @@ -3694,7 +3695,7 @@ sub get_options{ $help_type = 'standard'; }, 'H|help-full' => sub { $help_type = 'full'; }, - 'hostname' => sub { + 'host|hostname' => sub { $show{'host'} = 1 }, 'indent-min:i' => sub { my ($opt,$arg) = @_; @@ -3721,10 +3722,10 @@ sub get_options{ else { error_handler('bad-arg', $opt, $arg); }}, - 'no-hostname' => sub { + 'no-host|no-hostname' => sub { $show{'host'} = 0 }, 'no-man' => sub { - $b_no_man_force = 1; }, + $b_no_man_force = 0; }, 'no-ssl' => sub { $dl{'no-ssl-opt'}=1 }, 'output-file:s' => sub { @@ -4129,7 +4130,7 @@ sub show_options { ['1', '', '--downloader', "Force $self_name to use [curl|fetch|perl|wget] for downloads." ], ['1', '', '--dmidecode', "Forces use of dmidecode data instead of /sys where relevant (-M)." ], - ['1', '', '--hostname', "Turns on hostname in output." ], + ['1', '', '--host', "Turns on hostname in output." ], ['1', '', '--indent-min', "Takes value 80 or greater. Increases or decreases the point where $self_name autowraps line starters." ], ['1', '', '--limit', "[-1 - x] -1 removes limit. Raise or lower max output limit of IP addresses for -i." ], @@ -4143,7 +4144,7 @@ sub show_options { push @data, @rows; } @rows = ( - ['1', '', '--no-hostname', "Turns off hostname in output. Useful if showing output from + ['1', '', '--no-host', "Turns off hostname in output. Useful if showing output from servers etc." ], ['1', '', '--no-ssl', "Skips SSL certificate checks for all downloader activities (wget/fetch/curl only)." ], @@ -7623,7 +7624,8 @@ sub display_server(){ $server = $ENV{'WAYLAND_DISPLAY'} if (!$server && $ENV{'WAYLAND_DISPLAY'}); if ($extra > 1){ # initial tests, if wayland, it is certainly a compositor - $graphics{'compositor'} = display_compositor(lc($server)); + $server = lc($server) if $server; + $graphics{'compositor'} = display_compositor($server); } if ( $show{'display-data'}){ # X vendor and version detection. @@ -9954,12 +9956,15 @@ sub cpu_processes { $b[2] <=> $a[2] } @ps_aux; # if there's a count limit, for irc, etc, only use that much of the data @rows = splice @rows,0,$count; - $cpu_mem = ' - Memory: MiB / % used' if $extra > 0; + $j = scalar @rows; + # $cpu_mem = ' - Memory: MiB / % used' if $extra > 0; my $throttled = throttled($ps_count,$count,$j); - my @data = ( - {$num++ . "#CPU % used - Command - pid$cpu_mem - top" => "$count$throttled",}, - ); + #my $header = "CPU % used - Command - pid$cpu_mem - top"; + #my $header = "Top $count by CPU"; + my @data = ({ + $num++ . "#CPU top" => "$count$throttled", + },); @processes = (@processes,@data); my $i = 1; foreach (@rows){ @@ -9967,13 +9972,11 @@ sub cpu_processes { $j = scalar @processes; my @row = split /\s+/, $_; my @command = process_starter(scalar @row, $row[10],$row[11]); - @data = ( - { + @data = ({ $num++ . "#" . $i++ => '', $num++ . "#cpu" => $row[2] . '%', $num++ . "#command" => $command[0], - }, - ); + },); @processes = (@processes,@data); if ($command[1]) { $processes[$j]{$num++ . "#started by"} = $command[1]; @@ -10002,12 +10005,14 @@ sub mem_processes { @rows = splice @rows,0,$count; #print Data::Dumper::Dumper \@rows; @processes = main::memory_data_full('process') if !$b_mem; - $cpu_mem = ' - CPU: % used' if $extra > 0; $j = scalar @rows; my $throttled = throttled($ps_count,$count,$j); - @data = ( - {$num++ . "#Memory MiB/% used - Command - pid$cpu_mem - top" => "$count$throttled",}, - ); + #$cpu_mem = ' - CPU: % used' if $extra > 0; + #my $header = "Memory MiB/% used - Command - pid$cpu_mem - top"; + #my $header = "Top $count by Memory"; + @data = ({ + $num++ . "#Memory top" => "$count$throttled", + },); @processes = (@processes,@data); my $i = 1; foreach (@rows){ @@ -10018,13 +10023,11 @@ sub mem_processes { $mem = ($row[5]) ? sprintf( "%.${decimals}f", $row[5]/1024 ) . ' MiB' : 'N/A'; my @command = process_starter(scalar @row, $row[10],$row[11]); $mem .= " (" . $row[3] . "%)"; - @data = ( - { + @data = ({ $num++ . "#" . $i++ => '', $num++ . "#mem" => $mem, $num++ . "#command" => $command[0], - }, - ); + },); @processes = (@processes,@data); if ($command[1]) { $processes[$j]{$num++ . "#started by"} = $command[1]; @@ -10060,7 +10063,7 @@ sub throttled { my ($ps_count,$count,$j) = @_; my $throttled = ''; if ($count > $j){ - $throttled = " (only $j processes)"; + $throttled = " ( $j processes)"; } elsif ($count < $ps_count){ $throttled = " (throttled from $ps_count)"; @@ -10677,7 +10680,7 @@ sub create_output { $mod{'manufacturer'} ||= 'N/A'; $rows[$j]{$num++ . "#manufacturer"} = $mod{'manufacturer'}; $mod{'part-number'} ||= 'N/A'; - $rows[$j]{$num++ . "#part-nu"} = $mod{'part-number'}; + $rows[$j]{$num++ . "#part-no"} = $mod{'part-number'}; } if ($extra > 2 ){ $mod{'serial'} ||= 'N/A'; @@ -11665,6 +11668,27 @@ sub get_repos_bsd { @data = repo_builder($netbsd,'netbsd','^\s*[^#]+$'); @rows = (@rows,@data); } + # BSDs do not default always to having repo files, so show correct error + # mesage in that case + if (!@rows){ + if ($bsd_type eq 'freebsd'){ + $key = repo_builder('missing','freebsd-nf'); + } + elsif ($bsd_type eq 'openbsd'){ + $key = repo_builder('missing','openbsd-nf'); + } + elsif ($bsd_type eq 'netbsd'){ + $key = repo_builder('missing','netbsd-nf'); + } + else { + $key = repo_builder('missing','bsd-nf'); + } + @data = ( + {$num++ . "#Message" => $key}, + [()], + ); + @rows = (@rows,@data); + } eval $start if $b_log; return @rows; } @@ -11676,15 +11700,19 @@ sub repo_builder { 'apk' => 'No active APK repos in', 'apt' => 'No active apt repos in', 'bsd-package' => 'No enabled BSD pkg servers in', + 'bsd-nf' => 'No BSD pkg server files found', 'eopkg' => 'No active eopkg repos found', 'pacman' => 'No active pacman repos in', 'pisi' => 'No active pisi repos found', 'portage' => 'No enabled portage sources in', 'portsnap' => 'No ports servers in', 'freebsd' => 'No FreeBSD update servers in', + 'freebsd-nf' => 'No FreeBSD update server files found', 'freebsd-pkg' => 'No FreeBSD default pkg server in', 'openbsd' => 'No OpenBSD pkg mirrors in', + 'openbsd-nf' => 'No OpenBSD pkg mirror files found', 'netbsd' => 'No NetBSD pkg servers in', + 'netbsd-nf' => 'No NetBSD pkg server files found', 'slackpkg' => 'No active slackpkg repos in', 'slackpkg+' => 'No active slackpkg+ repos in', 'yum' => 'No active yum repos in', @@ -12962,7 +12990,7 @@ sub create_output { if ($extra > 2){ if (!$show{'filter'}){ $rows[0]{$num++ . "#Location"} = $location[1]; - $rows[0]{$num++ . "#Altitude"} = $weather{'elevation'}; + $rows[0]{$num++ . "#altitude"} = $weather{'elevation'}; } } $rows[0]{$num++ . "#Time"} = $weather{'date-time'}; @@ -15660,9 +15688,6 @@ sub generate_info_data { $b_gcc = 1; } $gcc ||= 'N/A'; - if ($extra > 0 && $client{'version'}){ - $client .= ' ' . $client{'version'}; - } if (!$b_irc && $extra > 1 ){ # bsds don't support -f option to get PPID if ($b_display && !$bsd_type){ @@ -15744,7 +15769,11 @@ sub generate_info_data { $data{$data_name}[$index]{$num++ . '#clang'} = $clang_version; } } + $data{$data_name}[$index]{$num++ . '#' . $client_shell} = $client; + if ($extra > 0 && $client{'version'}){ + $data{$data_name}[$index]{$num++ . '#v'} = $client{'version'}; + } if ( $running_in ){ $data{$data_name}[$index]{$num++ . '#running in'} = $running_in; } diff --git a/inxi.1 b/inxi.1 index 71e08a1..70880b6 100644 --- a/inxi.1 +++ b/inxi.1 @@ -1,4 +1,4 @@ -.TH INXI 1 "2018\-03\-25" inxi "inxi manual" +.TH INXI 1 "2018\-03\-26" inxi "inxi manual" .SH NAME inxi \- Command line system information script for console and IRC .SH SYNOPSIS @@ -17,6 +17,7 @@ NUMBER\fR)] \fR[\fB\-x \-OPTION\fR(\fBs\fR)] \fR[\fB\-xx \fR[\fB\-\-version\fR] \fR All options have long form variants. See below. + .SH DESCRIPTION \fBinxi\fR is a command line system information script built for for console and IRC. It is also used for forum technical support, as a debugging tool, @@ -28,6 +29,7 @@ RAM usage, and a wide variety of other useful information. color options applied to IRC use. Script colors can be turned off if desired with \fB\-c 0\fR, or changed using the \fB\-c\fR color options listed in the OPTIONS section below. + .SH PRIVACY AND SECURITY In order to maintain basic privacy and security, inxi filters out automatically on IRC things like your network card mac address, WAN and LAN IP, your \fB/home\fR @@ -37,6 +39,7 @@ Because inxi is often used on forums for support, you can also trigger this filtering with the \fB\-z\fR option (\fB\-Fz\fR, for example). To override the IRC filter, you can use the \fB\-Z\fR option. This can be useful to debug network connection issues online in a private chat, for example. + .SH USING OPTIONS Options can be combined if they do not conflict. Either group the letters together or separate them. @@ -752,7 +755,7 @@ like \fB\-M\fR or \fB\-B\fR. Force inxi to use [curl|fetch|perl|wget] for downloads. .TP -.B \-\-hostname\fR +.B \-\-host\fR Turns on hostname in System line. Overrides inxi config file value (if set): \fBSHOW_HOST='false'\fR @@ -775,7 +778,7 @@ Updates / installs man page with \fB\-U\fR if pinxi or using \fB\-U 3\fR dev bra (Only active if \fB\-U\fR is is not disabled by maintainers). .TP -.B \-\-no\-hostname\fR +.B \-\-no\-host\fR Turns off hostname in System line. Useful, with \fB\-z\fR, for anonymizing your inxi output for posting on forums or IRC. Same as configuration value: @@ -817,13 +820,12 @@ Overrides default internal value and user configuraton value: .SH DEBUGGING OPTIONS .TP .B \-\-dbg [1\-x]\fR -Triggers specific debug actions for testing purposes only. See: +\fBDevelopers only!\fR Triggers specific debug actions for testing purposes only. See +the documentation file for the active debugger options. These change depending on debug +requirements, so there's no point in listing those options here in the man page. \fIhttps://github.com/smxi/inxi/docs/inxi-values.txt\fR -For the active debugger options. These change depending on debug requirements, -so there's no point in listing those options here in the man page. - .TP .B \-\-debug [20\-22]\fR Debugger output generator. diff --git a/inxi.changelog b/inxi.changelog index 5c65c99..f471665 100644 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,27 @@ +===================================================================================== +Version: 2.9.08 +Patch Version: 00 +Script Date: 2018-03-26 +----------------------------------- +Changes: +----------------------------------- + +New version, new man page. Bug fixes, feature/output tweaks. + +Bugs fixed: +1. stray undefined value corrected +2. fixed BSD no pkg server case, now shows correctly that no pkg server files +were found, not that the OS is not supported. + +Features: +1. -t c and m headers cleaned up and simplified +2. man page edits. +3. more standarization of key names for fields, some spelling +and upper/lower case corrections. + +----------------------------------- +-- Harald Hope - Mon, 26 Mar 2018 14:59:11 -0700 + ===================================================================================== Version: 2.9.07 Patch Version: 00