-
Notifications
You must be signed in to change notification settings - Fork 20
cmd: migrate from getopt to argp #73
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
Conversation
ab2ead5 to
29b192a
Compare
|
@amboar I don't have an AST2600 system on-hand to test the coprocessor stuff. Could you please test if the command still works as before? |
9acb55b to
cb6c555
Compare
Looks like the argument processing is a bit off: It should instead look like: |
Found the issue. That was a leftover when I made the subcommand stuff easier 😄 New commit pushed where the argument processing for |
afd6f36 to
7338760
Compare
|
Currently: 🙂 I suspect there's a stray two arguments being passed to |
I'll migrate all commands and then implement a generic struct for the access stuff that's being used in like every command. That should make it easier I'd say instead of fiddling with argc and argv shit again like it has been done before. |
e08ed15 to
ea17f51
Compare
|
All commands now use I will work on resolving these inconsistencies and aim to make the implementation more generic. For readers and contributors, I’d appreciate your feedback on the documentation for the commands! Some commands are based on guesses regarding their functionality, so it would be helpful to ensure the documentation is accurate. |
|
@sinuscosinustan something I have been idly considering for a while is to require a keyword like or maybe even with the bridge name: What do you think? This might help where there are other positional arguments, such as in the case of the For the record, I plan to tag a release of culvert immediately prior to merging your changes. I think it's reasonable that we can break the command line behaviour a bit subsequent to the tag, in the process of cleaning up the implementation. Thanks again for your effort here. I'm honestly not sure how you've motivated yourself through it, because I was certainly struggling to motivate myself 😅 |
I was thinking about a generic set of options like
Awesome! At least some breakage possible 😄
Holiday, a lot of caffeine and suffering from the broken parsing 😂 |
Sorry for the delay; after a quick look I think I prefer the |
Sounds good! I've tried to take a look into implementing my approach but for some reason argp doesn't want me to use the
If you have a small prototype of how it should look like I'd be happy to implement it! In the meanwhile I'll rework the |
|
@amboar I have pushed a new proposal with the |
|
@sinuscosinustan so you've motivated me to do something I've been meaning to get to for a while: convert the commands to use autodata. Can you please take a look at #77 ? Regarding your |
I like the autodata idea. That's definitely an improvement and will make it easier for implementation, although subcommand handling might still be a bit funky (but easier).
I have looked into argp children in a playground project, but for some reason the input struct from the state is not being passed into the children's parser (and the children approach does not allow things like
We can definitely use the reference instance and combine the subcommand stuff with autodata which will reduce the overall code complexity. |
The option `-i` will be dropped and replaced with the common connection struct that's being parsed after the `via` word. Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline stays the same, only the internals were reworked to use argp and the common connection struct, at least for the host UART. Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline stays the same, only the internals were reworked to use argp and the common connection struct. Also, the memory parsing is now a global cmd function. Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline has been changed to match with the new `via` parser. As this command is specific to the `debug-uart` bridge, both the driver and the interface are required. Skipping the driver is not easily posible, unfortunately. Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline stays the same, only the internals were reworked to use argp. Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline stays the same, only the internals were reworked to use argp. Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline stays the same, only the internals were reworked to use argp. Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline stays the same, only the internals were reworked to use argp and the common connection struct. Signed-off-by: Tan Siewert <tan@siewert.io>
The order of the cmdline has been changed and reworked to use argp and the common connection struct. Now, the region is the first argument instead of the second. Before: culvert otp read conf After: culert otp conf read Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline has been slightly changed, and the the internals were reworked to use argp and the common connection struct. The SFC to be used is now provided via `--sfc` instead. Before: culvert sfc fmc read 0x0 32 After: culvert sfc -s fmc read 0x0 32 Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline has been slightly changed, and the the internals were reworked to use argp and the common connection struct. The region to be read from is now provided via the `--type` option. Before: culvert read ram 0x0 32 After: culvert read -t ram 0x0 32 Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline has been slightly changed, and the the internals were reworked to use argp and the common connection struct. The region writing to is now provided via the `--type` option. Before: culvert write ram 0x0 32 After: culvert write -t ram 0x0 32 Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline stays the same, only the internals were reworked to use argp and the common connection struct. Signed-off-by: Tan Siewert <tan@siewert.io>
cmdline stays the same, only the internals were reworked to use argp and the common connection struct. Signed-off-by: Tan Siewert <tan@siewert.io>
3034911 to
11a724a
Compare
cmdline stays the same, only the internals were reworked to use argp and the common connection struct. Signed-off-by: Tan Siewert <tan@siewert.io>
Apply emacs formatting using the active editorconfig that's in the root of the project. Signed-off-by: Tan Siewert <tan@siewert.io>
Signed-off-by: Tan Siewert <tan@siewert.io>
`meson-asdf` was deprecated and the account `devcontainers-contrib` has been re-allocated last month. Signed-off-by: Tan Siewert <tan@siewert.io>
Commit 7db29d2 added the devcontainer manifests that are used in IDEs like Visual Studio Code. Unfortunately, VSC creates user configs in the workspace (project in this case). Subprojects are being pulled by meson in the `subprojects` directory and should not be checked in Git. Signed-off-by: Tan Siewert <tan@siewert.io>
11a724a to
b9a499e
Compare
|
I did a build with ASAN enabled and oops 🙈 Building from `culvert probe` on AST2500
`culvert probe` on AST2520 (unsupported platform)
|
|
I can take a look at those ASAN issues |
|
@amboar Do you think it'd be feasible to ask people on Discord to test this branch to find out if there are bugs / regressions? So far I've been using the branch for two weeks now and haven't triggered any issues on AST2500 and 2600 systems. I couldn't test |
|
🚢 what an effort! |
Reopened because of fail in #71 / #70
The argument handling is quite hard to make it good when using
getoptwith help and usage messages. Theargplibrary is a better choice for this task.Note: cleanup of dirty code or unwanted redundancies will be done from time to time in this PR. If you notice anything that bothers you, please add a comment directly. Thanks!
Checklist:
host_initandast_ahb_accessfor standardised flags