mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 08:11:39 +00:00
Big internal refactor!! Fully adjustable indentation logic, built in, native!
NOTE: none of these changes have any impact on normal inxi -y -1, -y, or -y xx operation, everything will remain exactly the same, this only changes and makes robust -y 1 single key: value pair per line output. 3.1.03 finishes the -y1 introduced in 3.1.02, but makes it a core part of the inxi logic for line printing, not a tacked on afterthought. Because the first draft of this in 3.1.02 was really a hack tacked onto the existing logic, which was not very flexible or robust, and required way too much literal test logic in the black box print_data() subroutine, which is supposed to be a 'dumb' logic, that just does what you give it automatically, I added in key changes that hard code the indentations per key, like so: Now: 34#0#3#key-name Before: 34#key-name Note that anyone using the json or XML output option may need to redo their code a bit to handle these extra 2 values that preface the actual key names. Fixes: 1. In order to make this work, changed a few small things internally, a few key names were slightly altered to make them more clear. Changes: 1. Redo of all internal full key strings, added two new # separated items: xx#x#y#key-name: * xx remains the main 0 padded 2 digit sorter per row/block. * x is a new 0/1 boolean, that shows if the value is a container or not. As currently implemented probably not hugely useful since it won't say when the following items it is a container of ends. Note that the following y value will always be 1 for the item contained by the container, so you can check that way if you want. the next item can also be a container, but it would have either the same indentation level as the previous container or be different. Thus, if a key is a container, it can contain either non containers, or other containers, but that primary container does not end until the indent value equals or is less than the indent value of the first container. If you are a programmer you should be able to figure this out. * y is the indentation level, 0-xx is supported, but in practical terms, only 4 levels are used. For single line output, these set the indentation for that key. * key-name remains the key string ID name. 2. For -y 1 -G will show drivers then indented one more level unloaded, FAILED, and alternate: to make it clear those are a subset of drivers. driver: itself will contain the actual driver. In cases where no driver is loaded, a note will show indented after driver: 3. For -y 1, driver v: versions will be indented 1, and driver will be a container that contains that version key: value pair. Samples: ----------------------------------- inxi -Razy1 RAID: Device-1: g23-home type: zfs status: ONLINE size: 2.69 TiB free: 1.26 TiB allocated: 1.43 TiB Array-1: mirror status: ONLINE size: 1.82 TiB free: 602.00 GiB Components: online: sdb sdc Array-2: mirror status: ONLINE size: 888.00 GiB free: 688.00 GiB Components: online: sdd sde ----------------------------------- sudo inxi -dazy1 Drives: Local Storage: total: 1.98 TiB used: 1.43 TiB (72.2%) ID-1: /dev/sda vendor: Intel model: SSDSC2BW180A4 family: 53x and Pro 1500/2500 Series SSDs size: 167.68 GiB block size: physical: 512 B logical: 512 B sata: 3.0 speed: 6.0 Gb/s serial: <filter> rev: DC32 temp: 37 C scheme: MBR SMART: yes state: enabled health: PASSED on: 291d 17h cycles: 1346 read: 431.94 GiB written: 666.16 GiB Optical-1: /dev/sr0 vendor: HL-DT-ST model: DVDRAM GH20LS10 rev: FL00 dev-links: cdrom,cdrw,dvd,dvdrw Features: speed: 48 multisession: yes audio: yes dvd: yes rw: cd-r,cd-rw,dvd-r,dvd-ram state: running ----------------------------------- inxi -Aazy1 Audio: Device-1: NVIDIA High Definition Audio vendor: Gigabyte driver: snd_hda_intel v: kernel bus ID: 09:00.1 chip ID: 10de:0be3 Device-2: AMD Family 17h HD Audio vendor: Gigabyte driver: snd_hda_intel v: kernel bus ID: 0b:00.3 chip ID: 1022:1457 Device-3: N/A type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 5-1.3.4:5 chip ID: 21b4:0083 serial: <filter> Sound Server: ALSA v: k5.4.0-11.2-liquorix-amd64
This commit is contained in:
parent
46ae081ec6
commit
166c1364d2
151
inxi.changelog
151
inxi.changelog
|
@ -1,3 +1,154 @@
|
|||
=====================================================================================
|
||||
Version: 3.1.03
|
||||
Patch: 00
|
||||
Date: 2020-06-12
|
||||
-----------------------------------
|
||||
Changes:
|
||||
-----------------------------------
|
||||
|
||||
Big internal refactor!! Fully adjustable indentation logic, built in, native!
|
||||
|
||||
NOTE: none of these changes have any impact on normal inxi -y -1, -y, or -y xx
|
||||
operation, everything will remain exactly the same, this only changes and
|
||||
makes robust -y 1 single key: value pair per line output.
|
||||
|
||||
3.1.03 finishes the -y1 introduced in 3.1.02, but makes it a core part of the inxi
|
||||
logic for line printing, not a tacked on afterthought.
|
||||
|
||||
Because the first draft of this in 3.1.02 was really a hack tacked onto the existing
|
||||
logic, which was not very flexible or robust, and required way too much literal test
|
||||
logic in the black box print_data() subroutine, which is supposed to be a 'dumb'
|
||||
logic, that just does what you give it automatically, I added in key changes that
|
||||
hard code the indentations per key, like so:
|
||||
|
||||
Now: 34#0#3#key-name
|
||||
Before: 34#key-name
|
||||
|
||||
Note that anyone using the json or XML output option may need to redo their code
|
||||
a bit to handle these extra 2 values that preface the actual key names.
|
||||
|
||||
Fixes:
|
||||
1. In order to make this work, changed a few small things internally, a few
|
||||
key names were slightly altered to make them more clear.
|
||||
|
||||
Changes:
|
||||
1. Redo of all internal full key strings, added two new # separated items:
|
||||
xx#x#y#key-name:
|
||||
* xx remains the main 0 padded 2 digit sorter per row/block.
|
||||
* x is a new 0/1 boolean, that shows if the value is a container or not. As
|
||||
currently implemented probably not hugely useful since it won't say when
|
||||
the following items it is a container of ends.
|
||||
Note that the following y value will always be 1 for the item contained by
|
||||
the container, so you can check that way if you want. the next item can
|
||||
also be a container, but it would have either the same indentation level
|
||||
as the previous container or be different.
|
||||
Thus, if a key is a container, it can contain either non containers, or
|
||||
other containers, but that primary container does not end until the indent
|
||||
value equals or is less than the indent value of the first container.
|
||||
If you are a programmer you should be able to figure this out.
|
||||
* y is the indentation level, 0-xx is supported, but in practical terms, only
|
||||
4 levels are used. For single line output, these set the indentation for that
|
||||
key.
|
||||
* key-name remains the key string ID name.
|
||||
|
||||
2. For -y 1 -G will show drivers then indented one more level unloaded, FAILED,
|
||||
and alternate: to make it clear those are a subset of drivers. driver: itself
|
||||
will contain the actual driver. In cases where no driver is loaded, a note
|
||||
will show indented after driver:
|
||||
|
||||
3. For -y 1, driver v: versions will be indented 1, and driver will be a container
|
||||
that contains that version key: value pair.
|
||||
|
||||
Samples:
|
||||
-----------------------------------
|
||||
inxi -Razy1
|
||||
RAID:
|
||||
Device-1: g23-home
|
||||
type: zfs
|
||||
status: ONLINE
|
||||
size: 2.69 TiB
|
||||
free: 1.26 TiB
|
||||
allocated: 1.43 TiB
|
||||
Array-1: mirror
|
||||
status: ONLINE
|
||||
size: 1.82 TiB
|
||||
free: 602.00 GiB
|
||||
Components:
|
||||
online: sdb sdc
|
||||
Array-2: mirror
|
||||
status: ONLINE
|
||||
size: 888.00 GiB
|
||||
free: 688.00 GiB
|
||||
Components:
|
||||
online: sdd sde
|
||||
|
||||
-----------------------------------
|
||||
sudo inxi -dazy1
|
||||
Drives:
|
||||
Local Storage:
|
||||
total: 1.98 TiB
|
||||
used: 1.43 TiB (72.2%)
|
||||
ID-1: /dev/sda
|
||||
vendor: Intel
|
||||
model: SSDSC2BW180A4
|
||||
family: 53x and Pro 1500/2500 Series SSDs
|
||||
size: 167.68 GiB
|
||||
block size:
|
||||
physical: 512 B
|
||||
logical: 512 B
|
||||
sata: 3.0
|
||||
speed: 6.0 Gb/s
|
||||
serial: <filter>
|
||||
rev: DC32
|
||||
temp: 37 C
|
||||
scheme: MBR
|
||||
SMART: yes
|
||||
state: enabled
|
||||
health: PASSED
|
||||
on: 291d 17h
|
||||
cycles: 1346
|
||||
read: 431.94 GiB
|
||||
written: 666.16 GiB
|
||||
Optical-1: /dev/sr0
|
||||
vendor: HL-DT-ST
|
||||
model: DVDRAM GH20LS10
|
||||
rev: FL00
|
||||
dev-links: cdrom,cdrw,dvd,dvdrw
|
||||
Features:
|
||||
speed: 48
|
||||
multisession: yes
|
||||
audio: yes
|
||||
dvd: yes
|
||||
rw: cd-r,cd-rw,dvd-r,dvd-ram
|
||||
state: running
|
||||
|
||||
-----------------------------------
|
||||
inxi -Aazy1
|
||||
Audio:
|
||||
Device-1: NVIDIA High Definition Audio
|
||||
vendor: Gigabyte
|
||||
driver: snd_hda_intel
|
||||
v: kernel
|
||||
bus ID: 09:00.1
|
||||
chip ID: 10de:0be3
|
||||
Device-2: AMD Family 17h HD Audio
|
||||
vendor: Gigabyte
|
||||
driver: snd_hda_intel
|
||||
v: kernel
|
||||
bus ID: 0b:00.3
|
||||
chip ID: 1022:1457
|
||||
Device-3: N/A
|
||||
type: USB
|
||||
driver: hid-generic,snd-usb-audio,usbhid
|
||||
bus ID: 5-1.3.4:5
|
||||
chip ID: 21b4:0083
|
||||
serial: <filter>
|
||||
Sound Server: ALSA
|
||||
v: k5.4.0-11.2-liquorix-amd64
|
||||
|
||||
-----------------------------------
|
||||
-- Harald Hope - Fri, 12 Jun 2020 19:02:08 -0700
|
||||
|
||||
=====================================================================================
|
||||
Version: 3.1.02
|
||||
Patch: 00
|
||||
|
|
Loading…
Reference in a new issue