Skip to content

Commit

Permalink
icon example generate and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna-f1sh committed Dec 3, 2022
1 parent dc5de4e commit 61a9134
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 35 deletions.
10 changes: 8 additions & 2 deletions doc/_cyme
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ port-path\:"syspath style port path to bus, applicable to Linux only"))' \
number\:"Number of config, bConfigurationValue; value to set to enable to configuration"
num-interfaces\:"Interfaces available for this configuruation"
attributes\:"Attributes of configuration, bmAttributes"
icon-attributes\:"Icon representation of bmAttributes"
max-power\:"Maximum current consumption in mA"))' \
'*--interface-blocks=[Specify the blocks which will be displayed for each interface and in what order]:INTERFACE_BLOCKS:((name\:"Name from string descriptor"
number\:"Interface number"
Expand All @@ -107,21 +108,26 @@ device-number\:"Sort by bus device number"
no-sort\:"No sorting; whatever order it was parsed"))' \
'--group-devices=[Group devices by value when listing]:GROUP_DEVICES:((no-group\:"No grouping"
bus\:"Group into buses with bus info as heading - like a flat tree"))' \
'--from-json=[Read from json output rather than profiling system - must use --tree json dump]:FROM_JSON: ' \
'-l[Attempt to maintain compatibility with lsusb output]' \
'--lsusb[Attempt to maintain compatibility with lsusb output]' \
'-t[Dump USB device hierarchy as a tree]' \
'--tree[Dump USB device hierarchy as a tree]' \
'*-v[Verbosity level: 1 prints device configurations; 2 prints interfaces; 3 prints interface endpoints; 4 prints everything and all blocks]' \
'*--verbose[Verbosity level: 1 prints device configurations; 2 prints interfaces; 3 prints interface endpoints; 4 prints everything and all blocks]' \
'-m[Print more blocks by default at each verbosity]' \
'--more[Print more blocks by default at each verbosity]' \
'--sort-buses[Sort devices by bus number]' \
'--hide-buses[Hide empty buses; those with no devices]' \
'--hide-hubs[Hide empty hubs; those with no devices]' \
'--decimal[Show base16 values as base10 decimal instead]' \
'--no-padding[Disable padding to align blocks]' \
'--no-colour[Disable coloured output, can also use NO_COLOR environment variable]' \
'--ascii[Disables icons and utf-8 charactors]' \
'--headings[Show block headings]' \
'--json[Output as json format after sorting, filters and tree settings are applied]' \
'--force-libusb[Force libusb mode on macOS rather than using system_profiler output]' \
'--json[Output as json format after sorting, filters and tree settings are applied; without -tree will be flattened dump of devices]' \
'-F[Force libusb profiler on macOS rather than using/combining system_profiler output]' \
'--force-libusb[Force libusb profiler on macOS rather than using/combining system_profiler output]' \
'*-c[Turn debugging information on. Alternatively can use RUST_LOG env: INFO, DEBUG, TRACE]' \
'*--debug[Turn debugging information on. Alternatively can use RUST_LOG env: INFO, DEBUG, TRACE]' \
'--gen[Generate cli completions and man page]' \
Expand Down
9 changes: 7 additions & 2 deletions doc/_cyme.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,26 @@ Register-ArgumentCompleter -Native -CommandName 'cyme' -ScriptBlock {
[CompletionResult]::new('--endpoint-blocks', 'endpoint-blocks', [CompletionResultType]::ParameterName, 'Specify the blocks which will be displayed for each endpoint and in what order')
[CompletionResult]::new('--sort-devices', 'sort-devices', [CompletionResultType]::ParameterName, 'Sort devices by value')
[CompletionResult]::new('--group-devices', 'group-devices', [CompletionResultType]::ParameterName, 'Group devices by value when listing')
[CompletionResult]::new('--from-json', 'from-json', [CompletionResultType]::ParameterName, 'Read from json output rather than profiling system - must use --tree json dump')
[CompletionResult]::new('-l', 'l', [CompletionResultType]::ParameterName, 'Attempt to maintain compatibility with lsusb output')
[CompletionResult]::new('--lsusb', 'lsusb', [CompletionResultType]::ParameterName, 'Attempt to maintain compatibility with lsusb output')
[CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Dump USB device hierarchy as a tree')
[CompletionResult]::new('--tree', 'tree', [CompletionResultType]::ParameterName, 'Dump USB device hierarchy as a tree')
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Verbosity level: 1 prints device configurations; 2 prints interfaces; 3 prints interface endpoints; 4 prints everything and all blocks')
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Verbosity level: 1 prints device configurations; 2 prints interfaces; 3 prints interface endpoints; 4 prints everything and all blocks')
[CompletionResult]::new('-m', 'm', [CompletionResultType]::ParameterName, 'Print more blocks by default at each verbosity')
[CompletionResult]::new('--more', 'more', [CompletionResultType]::ParameterName, 'Print more blocks by default at each verbosity')
[CompletionResult]::new('--sort-buses', 'sort-buses', [CompletionResultType]::ParameterName, 'Sort devices by bus number')
[CompletionResult]::new('--hide-buses', 'hide-buses', [CompletionResultType]::ParameterName, 'Hide empty buses; those with no devices')
[CompletionResult]::new('--hide-hubs', 'hide-hubs', [CompletionResultType]::ParameterName, 'Hide empty hubs; those with no devices')
[CompletionResult]::new('--decimal', 'decimal', [CompletionResultType]::ParameterName, 'Show base16 values as base10 decimal instead')
[CompletionResult]::new('--no-padding', 'no-padding', [CompletionResultType]::ParameterName, 'Disable padding to align blocks')
[CompletionResult]::new('--no-colour', 'no-colour', [CompletionResultType]::ParameterName, 'Disable coloured output, can also use NO_COLOR environment variable')
[CompletionResult]::new('--ascii', 'ascii', [CompletionResultType]::ParameterName, 'Disables icons and utf-8 charactors')
[CompletionResult]::new('--headings', 'headings', [CompletionResultType]::ParameterName, 'Show block headings')
[CompletionResult]::new('--json', 'json', [CompletionResultType]::ParameterName, 'Output as json format after sorting, filters and tree settings are applied')
[CompletionResult]::new('--force-libusb', 'force-libusb', [CompletionResultType]::ParameterName, 'Force libusb mode on macOS rather than using system_profiler output')
[CompletionResult]::new('--json', 'json', [CompletionResultType]::ParameterName, 'Output as json format after sorting, filters and tree settings are applied; without -tree will be flattened dump of devices')
[CompletionResult]::new('-F', 'F', [CompletionResultType]::ParameterName, 'Force libusb profiler on macOS rather than using/combining system_profiler output')
[CompletionResult]::new('--force-libusb', 'force-libusb', [CompletionResultType]::ParameterName, 'Force libusb profiler on macOS rather than using/combining system_profiler output')
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Turn debugging information on. Alternatively can use RUST_LOG env: INFO, DEBUG, TRACE')
[CompletionResult]::new('--debug', 'debug', [CompletionResultType]::ParameterName, 'Turn debugging information on. Alternatively can use RUST_LOG env: INFO, DEBUG, TRACE')
[CompletionResult]::new('--gen', 'gen', [CompletionResultType]::ParameterName, 'Generate cli completions and man page')
Expand Down
27 changes: 19 additions & 8 deletions doc/cyme.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH cyme 1 "cyme 0.7.8"
.TH cyme 1 "cyme 0.8.5"
.SH NAME
cyme \- List system USB buses and devices; a modern `lsusb` that attempts to maintain compatibility with, but also add new features
cyme \- List system USB buses and devices; a modern and compatiable `lsusb`
.SH SYNOPSIS
\fBcyme\fR [\fB\-l\fR|\fB\-\-lsusb\fR] [\fB\-t\fR|\fB\-\-tree\fR] [\fB\-d\fR|\fB\-\-vidpid\fR] [\fB\-s\fR|\fB\-\-show\fR] [\fB\-D\fR|\fB\-\-device\fR] [\fB\-\-filter\-name\fR] [\fB\-\-filter\-serial\fR] [\fB\-v\fR|\fB\-\-verbose\fR]... [\fB\-b\fR|\fB\-\-blocks\fR] [\fB\-\-bus\-blocks\fR] [\fB\-\-config\-blocks\fR] [\fB\-\-interface\-blocks\fR] [\fB\-\-endpoint\-blocks\fR] [\fB\-\-sort\-devices\fR] [\fB\-\-sort\-buses\fR] [\fB\-\-group\-devices\fR] [\fB\-\-hide\-buses\fR] [\fB\-\-hide\-hubs\fR] [\fB\-\-decimal\fR] [\fB\-\-no\-padding\fR] [\fB\-\-no\-colour\fR] [\fB\-\-headings\fR] [\fB\-\-json\fR] [\fB\-\-force\-libusb\fR] [\fB\-c\fR|\fB\-\-debug\fR]... [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR]
\fBcyme\fR [\fB\-l\fR|\fB\-\-lsusb\fR] [\fB\-t\fR|\fB\-\-tree\fR] [\fB\-d\fR|\fB\-\-vidpid\fR] [\fB\-s\fR|\fB\-\-show\fR] [\fB\-D\fR|\fB\-\-device\fR] [\fB\-\-filter\-name\fR] [\fB\-\-filter\-serial\fR] [\fB\-v\fR|\fB\-\-verbose\fR]... [\fB\-b\fR|\fB\-\-blocks\fR] [\fB\-\-bus\-blocks\fR] [\fB\-\-config\-blocks\fR] [\fB\-\-interface\-blocks\fR] [\fB\-\-endpoint\-blocks\fR] [\fB\-m\fR|\fB\-\-more\fR] [\fB\-\-sort\-devices\fR] [\fB\-\-sort\-buses\fR] [\fB\-\-group\-devices\fR] [\fB\-\-hide\-buses\fR] [\fB\-\-hide\-hubs\fR] [\fB\-\-decimal\fR] [\fB\-\-no\-padding\fR] [\fB\-\-no\-colour\fR] [\fB\-\-ascii\fR] [\fB\-\-headings\fR] [\fB\-\-json\fR] [\fB\-\-from\-json\fR] [\fB\-F\fR|\fB\-\-force\-libusb\fR] [\fB\-c\fR|\fB\-\-debug\fR]... [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR]
.SH DESCRIPTION
List system USB buses and devices; a modern `lsusb` that attempts to maintain compatibility with, but also add new features
List system USB buses and devices; a modern and compatiable `lsusb`
.SH OPTIONS
.TP
\fB\-l\fR, \fB\-\-lsusb\fR=\fILSUSB\fR
Expand Down Expand Up @@ -131,6 +131,8 @@ num\-interfaces: Interfaces available for this configuruation
.IP \(bu 2
attributes: Attributes of configuration, bmAttributes
.IP \(bu 2
icon\-attributes: Icon representation of bmAttributes
.IP \(bu 2
max\-power: Maximum current consumption in mA
.RE
.TP
Expand Down Expand Up @@ -188,6 +190,9 @@ max\-packet\-size: Maximum packet size in bytes endpoint can send/recieve
interval: Interval for polling endpoint data transfers. Value in frame counts. Ignored for Bulk & Control Endpoints. Isochronous must equal 1 and field may range from 1 to 255 for interrupt endpoints
.RE
.TP
\fB\-m\fR, \fB\-\-more\fR=\fIMORE\fR
Print more blocks by default at each verbosity
.TP
\fB\-\-sort\-devices\fR=\fISORT_DEVICES\fR
Sort devices by value
.br
Expand Down Expand Up @@ -234,14 +239,20 @@ Disable padding to align blocks
\fB\-\-no\-colour\fR=\fINO_COLOUR\fR
Disable coloured output, can also use NO_COLOR environment variable
.TP
\fB\-\-ascii\fR=\fIASCII\fR
Disables icons and utf\-8 charactors
.TP
\fB\-\-headings\fR=\fIHEADINGS\fR
Show block headings
.TP
\fB\-\-json\fR=\fIJSON\fR
Output as json format after sorting, filters and tree settings are applied
Output as json format after sorting, filters and tree settings are applied; without \-tree will be flattened dump of devices
.TP
\fB\-\-from\-json\fR=\fIFROM_JSON\fR
Read from json output rather than profiling system \- must use \-\-tree json dump
.TP
\fB\-\-force\-libusb\fR=\fIFORCE_LIBUSB\fR
Force libusb mode on macOS rather than using system_profiler output
\fB\-F\fR, \fB\-\-force\-libusb\fR=\fIFORCE_LIBUSB\fR
Force libusb profiler on macOS rather than using/combining system_profiler output
.TP
\fB\-c\fR, \fB\-\-debug\fR=\fIDEBUG\fR
Turn debugging information on. Alternatively can use RUST_LOG env: INFO, DEBUG, TRACE
Expand All @@ -252,6 +263,6 @@ Print help information (use `\-h` for a summary)
\fB\-V\fR, \fB\-\-version\fR
Print version information
.SH VERSION
v0.7.8
v0.8.5
.SH AUTHORS
John Whittington <[email protected]>
8 changes: 6 additions & 2 deletions doc/cyme.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ _cyme() {

case "${cmd}" in
cyme)
opts="-l -t -d -s -D -v -b -c -h -V --lsusb --tree --vidpid --show --device --filter-name --filter-serial --verbose --blocks --bus-blocks --config-blocks --interface-blocks --endpoint-blocks --sort-devices --sort-buses --group-devices --hide-buses --hide-hubs --decimal --no-padding --no-colour --headings --json --force-libusb --debug --gen --help --version"
opts="-l -t -d -s -D -v -b -m -F -c -h -V --lsusb --tree --vidpid --show --device --filter-name --filter-serial --verbose --blocks --bus-blocks --config-blocks --interface-blocks --endpoint-blocks --more --sort-devices --sort-buses --group-devices --hide-buses --hide-hubs --decimal --no-padding --no-colour --ascii --headings --json --from-json --force-libusb --debug --gen --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -70,7 +70,7 @@ _cyme() {
return 0
;;
--config-blocks)
COMPREPLY=($(compgen -W "name number num-interfaces attributes max-power" -- "${cur}"))
COMPREPLY=($(compgen -W "name number num-interfaces attributes icon-attributes max-power" -- "${cur}"))
return 0
;;
--interface-blocks)
Expand All @@ -89,6 +89,10 @@ _cyme() {
COMPREPLY=($(compgen -W "no-group bus" -- "${cur}"))
return 0
;;
--from-json)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down
9 changes: 6 additions & 3 deletions doc/cyme.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ complete -c cyme -l filter-name -d 'Filter on string contained in name' -r
complete -c cyme -l filter-serial -d 'Filter on string contained in serial' -r
complete -c cyme -s b -l blocks -d 'Specify the blocks which will be displayed for each device and in what order' -r -f -a "{bus-number Number of bus device is attached,device-number Bus issued device number,branch-position Position of device in parent branch,port-path Linux style port path,sys-path Linux udev reported syspath,driver Linux udev reported driver loaded for device,icon Icon based on VID/PID,vendor-id Unique vendor identifier - purchased from USB IF,product-id Vendor unique product identifier,name The device name as reported in descriptor or using usb_ids if None,manufacturer The device manufacturer as provided in descriptor or using usb_ids if None,product-name The device product name as reported by usb_ids vidpid lookup,vendor-name The device vendor name as reported by usb_ids vid lookup,serial Device serial string as reported by descriptor,speed Advertised device capable speed,tree-positions Position along all branches back to trunk device,bus-power macOS system_profiler only - actually bus current in mA not power!,bus-power-used macOS system_profiler only - actually bus current used in mA not power!,extra-current-used macOS system_profiler only - actually bus current used in mA not power!,bcd-device The device version,bcd-usb The supported USB version,class-code Class of interface provided by USB IF - only available when using libusb,sub-class Sub-class of interface provided by USB IF - only available when using libusb,protocol Prototol code for interface provided by USB IF - only available when using libusb}"
complete -c cyme -l bus-blocks -d 'Specify the blocks which will be displayed for each bus and in what order' -r -f -a "{bus-number System bus number identifier,icon Icon based on VID/PID,name Bus name from descriptor or usb_ids,host-controller Host Controller on macOS\, vendor put here when using libusb,pci-vendor Understood to be vendor ID - it is when using libusb,pci-device Understood to be product ID - it is when using libusb,pci-revision Revsision of hardware,port-path syspath style port path to bus\, applicable to Linux only}"
complete -c cyme -l config-blocks -d 'Specify the blocks which will be displayed for each configuration and in what order' -r -f -a "{name Name from string descriptor,number Number of config\, bConfigurationValue; value to set to enable to configuration,num-interfaces Interfaces available for this configuruation,attributes Attributes of configuration\, bmAttributes,max-power Maximum current consumption in mA}"
complete -c cyme -l config-blocks -d 'Specify the blocks which will be displayed for each configuration and in what order' -r -f -a "{name Name from string descriptor,number Number of config\, bConfigurationValue; value to set to enable to configuration,num-interfaces Interfaces available for this configuruation,attributes Attributes of configuration\, bmAttributes,icon-attributes Icon representation of bmAttributes,max-power Maximum current consumption in mA}"
complete -c cyme -l interface-blocks -d 'Specify the blocks which will be displayed for each interface and in what order' -r -f -a "{name Name from string descriptor,number Interface number,port-path Interface port path\, applicable to Linux,class-code Class of interface provided by USB IF,sub-class Sub-class of interface provided by USB IF,protocol Prototol code for interface provided by USB IF,alt-setting Interfaces can have the same number but an alternate settings defined here,driver Driver obtained from udev on Linux only,sys-path syspath obtained from udev on Linux only,num-endpoints An interface can have many endpoints,icon Icon based on ClassCode/SubCode/Protocol}"
complete -c cyme -l endpoint-blocks -d 'Specify the blocks which will be displayed for each endpoint and in what order' -r -f -a "{number Endpoint number on interface,direction Direction of data into endpoint,transfer-type Type of data transfer endpoint accepts,sync-type Synchronisation type (Iso mode),usage-type Usage type (Iso mode),max-packet-size Maximum packet size in bytes endpoint can send/recieve,interval Interval for polling endpoint data transfers. Value in frame counts. Ignored for Bulk & Control Endpoints. Isochronous must equal 1 and field may range from 1 to 255 for interrupt endpoints}"
complete -c cyme -l sort-devices -d 'Sort devices by value' -r -f -a "{branch-position Sort by position in parent branch,device-number Sort by bus device number,no-sort No sorting; whatever order it was parsed}"
complete -c cyme -l group-devices -d 'Group devices by value when listing' -r -f -a "{no-group No grouping,bus Group into buses with bus info as heading - like a flat tree}"
complete -c cyme -l from-json -d 'Read from json output rather than profiling system - must use --tree json dump' -r
complete -c cyme -s l -l lsusb -d 'Attempt to maintain compatibility with lsusb output'
complete -c cyme -s t -l tree -d 'Dump USB device hierarchy as a tree'
complete -c cyme -s v -l verbose -d 'Verbosity level: 1 prints device configurations; 2 prints interfaces; 3 prints interface endpoints; 4 prints everything and all blocks'
complete -c cyme -s m -l more -d 'Print more blocks by default at each verbosity'
complete -c cyme -l sort-buses -d 'Sort devices by bus number'
complete -c cyme -l hide-buses -d 'Hide empty buses; those with no devices'
complete -c cyme -l hide-hubs -d 'Hide empty hubs; those with no devices'
complete -c cyme -l decimal -d 'Show base16 values as base10 decimal instead'
complete -c cyme -l no-padding -d 'Disable padding to align blocks'
complete -c cyme -l no-colour -d 'Disable coloured output, can also use NO_COLOR environment variable'
complete -c cyme -l ascii -d 'Disables icons and utf-8 charactors'
complete -c cyme -l headings -d 'Show block headings'
complete -c cyme -l json -d 'Output as json format after sorting, filters and tree settings are applied'
complete -c cyme -l force-libusb -d 'Force libusb mode on macOS rather than using system_profiler output'
complete -c cyme -l json -d 'Output as json format after sorting, filters and tree settings are applied; without -tree will be flattened dump of devices'
complete -c cyme -s F -l force-libusb -d 'Force libusb profiler on macOS rather than using/combining system_profiler output'
complete -c cyme -s c -l debug -d 'Turn debugging information on. Alternatively can use RUST_LOG env: INFO, DEBUG, TRACE'
complete -c cyme -l gen -d 'Generate cli completions and man page'
complete -c cyme -s h -l help -d 'Print help information (use `--help` for more detail)'
Expand Down
10 changes: 10 additions & 0 deletions doc/cyme_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"classifier#02": "",
"vid-pid-msb#0483:37": "",
"vid#2e8a": "",
"undefined-classifier": "",
"unknown-vendor": "",
"vid#05ac": "",
"vid-pid#1d50:6018": "",
"classifier-sub-protocol#15:01:01": ""
}
Loading

0 comments on commit 61a9134

Please sign in to comment.