-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split find into find and decode #227
Conversation
2180232
to
608f31e
Compare
odxtools/cli/decode.py
Outdated
"", | ||
"Examples:", | ||
" For displaying the service associated with the request 10 01 & decoding it:", | ||
" odxtools decode ./path/to/database.pdx -d 10 01", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" odxtools decode ./path/to/database.pdx -d 10 01", | |
" odxtools decode ./path/to/database.pdx -d '10 01'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, yes, thanks, i fixed it to work with -d 10 01 again. -D is a modifier to additionally decode it, although maybe it might be better to just differentiate between -d 10 01 and -D 10 01 - thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allowing the data to be specified as multiple arguments is a bad idea IMO, see below...
odxtools/cli/decode.py
Outdated
" For more information use:", | ||
" odxtools decode -h", | ||
]), | ||
help="Find & print services by hex-data, or name. Can also decode the request.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that seems to be not correct after this PR anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, yes, thanks, i fixed it to be accurate again
tests/test_cli.py
Outdated
UtilFunctions.run_find_tool(service_names=["headstand"], allow_unknown_bit_lengths=True) | ||
UtilFunctions.run_find_tool( | ||
service_names=["headstand"], allow_unknown_bit_lengths=True, no_details=True) | ||
# UtilFunctions.run_find_tool(service_names="3e00") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid commented-out code if there's not a very good reason for it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, I removed it
608f31e
to
c98ab95
Compare
odxtools/cli/decode.py
Outdated
parser.add_argument( | ||
"-d", | ||
"--data", | ||
nargs="*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd vastly prefer to make this a simple string, because right now specifying positional arguments after -d makes things quite iffy (e.g. odxtools decode -d 01 01 my_file.pdx
will fail while odxtools decode -d "01 01" my_file.pdx
will work just fine if --data
was a simple string parameter).
nargs="*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it
8f70b3f
to
ea8ff17
Compare
okay, looks good to me now. A small thing which I've noticed while playing with it: if the data is specified using an illegal format (e.g. |
…search functionality without data for find
ea8ff17
to
9af6441
Compare
fixed, I also remove all non-hex-chars from the string, to be more fault-tolerant to the input |
ok, thanks! merging. |
Fix issue with find command requiring data, by splitting the decode and find (by service name) functionalities
into separate commands.