Skip to content

Commit

Permalink
config import for user icons and colours
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna-f1sh committed Dec 3, 2022
1 parent 61a9134 commit 49ad43d
Show file tree
Hide file tree
Showing 16 changed files with 277 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/homebrew_tap_update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: "!contains(github.ref, '-')" # skip prereleases
with:
formula-name: cyme
formula-path: cyme.rb
formula-path: Formula/cyme.rb
homebrew-tap: tuna-f1sh/homebrew-cyme
download-url: https://github.com/tuna-f1sh/cyme/releases/download/${{ steps.extract-version.outputs.tag-name }}/cyme-v${{ steps.extract-version.outputs.tag-name }}-x86_64-apple-darwin.tar.gz
commit-message: |
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "List system USB buses and devices; a modern and compatiable `lsus
repository = "https://github.com/tuna-f1sh/cyme"
readme = "README.md"
license = "GPL-3.0-or-later"
version = "0.8.5"
version = "0.9.0"
edition = "2021"
keywords = ["usb", "lsusb", "system_profiler", "macos", "libusb"]
categories = ["command-line-utilities"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ If wishing to use only macOS `system_profiler` and not obtain more verbose infor
I also have a Homebrew tap, which will also install a man page and completions:

```
brew tap tuna-f1sh/cyme
brew tap tuna-f1sh/taps
brew install cyme
```

Expand Down
4 changes: 3 additions & 1 deletion doc/_cyme
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ 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: ' \
'-c+[Path to user config file to use for custom icons and colours]:CONFIG: ' \
'--config=[Path to user config file to use for custom icons and colours]:CONFIG: ' \
'-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 All @@ -128,7 +130,7 @@ bus\:"Group into buses with bus info as heading - like a flat tree"))' \
'--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]' \
'*-z[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]' \
'-h[Print help information (use `--help` for more detail)]' \
Expand Down
4 changes: 3 additions & 1 deletion doc/_cyme.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Register-ArgumentCompleter -Native -CommandName 'cyme' -ScriptBlock {
[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('-c', 'c', [CompletionResultType]::ParameterName, 'Path to user config file to use for custom icons and colours')
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'Path to user config file to use for custom icons and colours')
[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 All @@ -57,7 +59,7 @@ Register-ArgumentCompleter -Native -CommandName 'cyme' -ScriptBlock {
[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('-z', 'z', [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')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information (use `--help` for more detail)')
Expand Down
11 changes: 7 additions & 4 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 0.8.5"
.TH cyme 1 "cyme 0.9.0"
.SH NAME
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\-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]
\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]
.SH DESCRIPTION
List system USB buses and devices; a modern and compatiable `lsusb`
.SH OPTIONS
Expand Down Expand Up @@ -254,7 +254,10 @@ Read from json output rather than profiling system \- must use \-\-tree json dum
\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
\fB\-c\fR, \fB\-\-config\fR=\fICONFIG\fR
Path to user config file to use for custom icons and colours
.TP
\fB\-z\fR, \fB\-\-debug\fR=\fIDEBUG\fR
Turn debugging information on. Alternatively can use RUST_LOG env: INFO, DEBUG, TRACE
.TP
\fB\-h\fR, \fB\-\-help\fR
Expand All @@ -263,6 +266,6 @@ Print help information (use `\-h` for a summary)
\fB\-V\fR, \fB\-\-version\fR
Print version information
.SH VERSION
v0.8.5
v0.9.0
.SH AUTHORS
John Whittington <[email protected]>
10 changes: 9 additions & 1 deletion 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 -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"
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 --gen --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -93,6 +93,14 @@ _cyme() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--config)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down
3 changes: 2 additions & 1 deletion doc/cyme.fish
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ complete -c cyme -l endpoint-blocks -d 'Specify the blocks which will be display
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 c -l config -d 'Path to user config file to use for custom icons and colours' -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'
Expand All @@ -25,7 +26,7 @@ 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; 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 -s z -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)'
complete -c cyme -s V -l version -d 'Print version information'
10 changes: 0 additions & 10 deletions doc/cyme_example.json

This file was deleted.

41 changes: 41 additions & 0 deletions doc/cyme_example_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"icons": {
"icons": {
"vid#05ac": "",
"classifier-sub-protocol#15:01:01": "",
"unknown-vendor": "",
"classifier#02": "",
"undefined-classifier": "",
"vid-pid#1d50:6018": "",
"vid-pid-msb#0483:37": "",
"vid#2e8a": ""
},
"tree": null
},
"colours": {
"name": "bright blue",
"serial": "green",
"manufacturer": "blue",
"driver": "cyan",
"string": "blue",
"icon": null,
"location": "magenta",
"path": "cyan",
"number": "cyan",
"speed": "magenta",
"vid": "bright yellow",
"pid": "yellow",
"class_code": "bright yellow",
"sub_code": "yellow",
"protocol": "yellow",
"attributes": "magenta",
"power": "red",
"tree": "bright black",
"tree_bus_start": "bright black",
"tree_bus_terminator": "bright black",
"tree_configuration_terminator": "bright black",
"tree_interface_terminator": "bright black",
"tree_endpoint_in": "yellow",
"tree_endpoint_out": "magenta"
}
}
Loading

0 comments on commit 49ad43d

Please sign in to comment.