Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna-f1sh committed Dec 4, 2022
1 parent bbfc82e commit d80003b
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 27 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ The name comes from the technical term for the type of blossom on a Apple tree:

## Demo

[![asciicast](https://asciinema.org/a/542308.svg)](https://asciinema.org/a/542308)
[![asciicast](https://asciinema.org/a/IwYyZMrGMbXL4g15qDIaUViyM.svg)](https://asciinema.org/a/IwYyZMrGMbXL4g15qDIaUViyM)

## Feature Ideas

* Fully decode device class based base class on tables at [USB-IF](https://www.usb.org/defined-class-codes).
* Support 'auto', 'always', 'never' or icon, colours, utf-8 etc.
* Print format for width constrained devices? Can remove blocks with args but maybe there is a different format to consider.
* More examples for lib usage.

# Install

Expand Down
5 changes: 3 additions & 2 deletions doc/_cyme
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ 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: ' \
'-c+[Path to user config file to use for custom icons, colours and default settings]:CONFIG: ' \
'--config=[Path to user config file to use for custom icons, colours and default settings]:CONFIG: ' \
'--hide-serials=[Hide serial numbers]:HIDE_SERIALS:((hide\:"Hide with '\''*'\'' char"
scramble\:"Hide by replacing random char"))' \
'--mask-serials=[Mask serial numbers with '\''*'\'' or random chars]:MASK_SERIALS:((hide\:"Hide with '\''*'\'' char"
scramble\:"Mask by randomising existing chars"
replace\:"Mask by replacing length with random chars"))' \
'-l[Attempt to maintain compatibility with lsusb output]' \
'--lsusb[Attempt to maintain compatibility with lsusb output]' \
'-t[Dump USB device hierarchy as a tree]' \
Expand Down
2 changes: 1 addition & 1 deletion doc/_cyme.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Register-ArgumentCompleter -Native -CommandName 'cyme' -ScriptBlock {
[CompletionResult]::new('--from-json', 'from-json', [CompletionResultType]::ParameterName, 'Read from json output rather than profiling system - must use --tree json dump')
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Path to user config file to use for custom icons, colours and default settings')
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'Path to user config file to use for custom icons, colours and default settings')
[CompletionResult]::new('--hide-serials', 'hide-serials', [CompletionResultType]::ParameterName, 'Hide serial numbers')
[CompletionResult]::new('--mask-serials', 'mask-serials', [CompletionResultType]::ParameterName, 'Mask serial numbers with ''*'' or random chars')
[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')
Expand Down
Binary file modified doc/cli-tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions doc/cyme.1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH cyme 1 "cyme 1.0.1"
.TH cyme 1 "cyme 1.0.2"
.SH NAME
cyme \- List system USB buses and devices; a modern and compatible `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\-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\-\-config\fR] [\fB\-z\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\-\-config\fR] [\fB\-z\fR|\fB\-\-debug\fR]... [\fB\-\-mask\-serials\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR]
.SH DESCRIPTION
List system USB buses and devices; a modern and compatible `lsusb`
.SH OPTIONS
Expand Down Expand Up @@ -260,12 +260,27 @@ Path to user config file to use for custom icons, colours and default settings
\fB\-z\fR, \fB\-\-debug\fR=\fIDEBUG\fR
Turn debugging information on. Alternatively can use RUST_LOG env: INFO, DEBUG, TRACE
.TP
\fB\-\-mask\-serials\fR=\fIMASK_SERIALS\fR
Mask serial numbers with \*(Aq*\*(Aq or random chars
.br

.br
\fIPossible values:\fR
.RS 14
.IP \(bu 2
hide: Hide with \*(Aq*\*(Aq char
.IP \(bu 2
scramble: Mask by randomising existing chars
.IP \(bu 2
replace: Mask by replacing length with random chars
.RE
.TP
\fB\-h\fR, \fB\-\-help\fR
Print help information (use `\-h` for a summary)
.TP
\fB\-V\fR, \fB\-\-version\fR
Print version information
.SH VERSION
v1.0.1
v1.0.2
.SH AUTHORS
John Whittington <[email protected]>
6 changes: 3 additions & 3 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 -m -F -c -z -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 --config --debug --hide-serials --gen --help --version"
opts="-l -t -d -s -D -v -b -m -F -c -z -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 --config --debug --mask-serials --gen --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -101,8 +101,8 @@ _cyme() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--hide-serials)
COMPREPLY=($(compgen -W "hide scramble" -- "${cur}"))
--mask-serials)
COMPREPLY=($(compgen -W "hide scramble replace" -- "${cur}"))
return 0
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion doc/cyme.fish
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ complete -c cyme -l sort-devices -d 'Sort devices by value' -r -f -a "{branch-po
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 c -l config -d 'Path to user config file to use for custom icons, colours and default settings' -r
complete -c cyme -l hide-serials -d 'Hide serial numbers' -r -f -a "{hide Hide with \'*\' char,scramble Hide by replacing random char}"
complete -c cyme -l mask-serials -d 'Mask serial numbers with \'*\' or random chars' -r -f -a "{hide Hide with \'*\' char,scramble Mask by randomising existing chars,replace Mask by replacing length with random chars}"
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'
Expand Down
30 changes: 15 additions & 15 deletions doc/cyme_example_config.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"icons": {
"user": {
"unknown-vendor": "",
"vid#2e8a": "",
"undefined-classifier": "",
"classifier#02": "",
"vid-pid#1d50:6018": "",
"vid-pid-msb#0483:37": "",
"classifier-sub-protocol#15:01:01": "",
"classifier#02": "",
"undefined-classifier": "",
"vid#2e8a": "",
"vid#05ac": "",
"unknown-vendor": "",
"vid-pid#1d50:6018": ""
"vid#05ac": ""
},
"tree": {
"tree-edge": "├──",
"tree-line": "",
"tree-configuration-terminator": "",
"endpoint_out": "",
"tree-bus-start": "",
"tree-interface-terminator": "",
"endpoint_in": "",
"tree-device-terminator": "",
"tree-corner": "└──",
"tree-bus-start": "",
"tree-blank": " ",
"tree-interface-terminator": ""
"tree-corner": "└──",
"tree-line": "",
"tree-edge": "├──",
"tree-device-terminator": "",
"endpoint_out": "",
"tree-configuration-terminator": ""
}
},
"colours": {
Expand Down Expand Up @@ -86,5 +86,5 @@
"usage-type",
"max-packet-size"
],
"hide-serials": null
"mask-serials": null
}
2 changes: 1 addition & 1 deletion src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ pub enum MaskSerial {
Hide,
/// Mask by randomising existing chars
Scramble,
/// Hide by replacing length of random chars
/// Mask by replacing length with random chars
Replace,
}

Expand Down

0 comments on commit d80003b

Please sign in to comment.