diff --git a/README.md b/README.md index 9a170419..a011398c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/doc/_cyme b/doc/_cyme index cd77e89e..c345d71f 100644 --- a/doc/_cyme +++ b/doc/_cyme @@ -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]' \ diff --git a/doc/_cyme.ps1 b/doc/_cyme.ps1 index 5fc7c616..b7946947 100644 --- a/doc/_cyme.ps1 +++ b/doc/_cyme.ps1 @@ -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') diff --git a/doc/cli-tree.png b/doc/cli-tree.png index 03ae8d7a..f9223f31 100644 Binary files a/doc/cli-tree.png and b/doc/cli-tree.png differ diff --git a/doc/cyme.1 b/doc/cyme.1 index 10614a5c..a69cae18 100644 --- a/doc/cyme.1 +++ b/doc/cyme.1 @@ -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 @@ -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 diff --git a/doc/cyme.bash b/doc/cyme.bash index d1158a9d..d76c68b7 100644 --- a/doc/cyme.bash +++ b/doc/cyme.bash @@ -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 @@ -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 ;; *) diff --git a/doc/cyme.fish b/doc/cyme.fish index 1c7f43d7..cfc8f724 100644 --- a/doc/cyme.fish +++ b/doc/cyme.fish @@ -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' diff --git a/doc/cyme_example_config.json b/doc/cyme_example_config.json index 6cbb4320..5e435283 100644 --- a/doc/cyme_example_config.json +++ b/doc/cyme_example_config.json @@ -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": { @@ -86,5 +86,5 @@ "usage-type", "max-packet-size" ], - "hide-serials": null + "mask-serials": null } \ No newline at end of file diff --git a/src/display.rs b/src/display.rs index 80ff7c89..dc580e8f 100644 --- a/src/display.rs +++ b/src/display.rs @@ -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, }