Skip to content
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

CLI upgrade for more control and less duplication #691

Merged
merged 13 commits into from
Mar 31, 2025
Merged

Conversation

msooseth
Copy link
Collaborator

@msooseth msooseth commented Mar 20, 2025

Description

We are now using Options.Applicative for CLI. This allows us to have a lot more control, e.g. separate footers for each subcommand. It also allows us to skip having repeated code that was becoming pretty unwieldy. The common commands are now much more visible/reasonable to edit and improve.

I also added some very simple test cases for the CLI, just to make sure I didn't break some basic CLI functionality. We probably should extend this test more for some basic checks to make sure new options work.

Notes:

  • solver in UnitTestOptions was completely unused (oops!). Removed.
  • I am using as little copy-paste as possible, but some options are special, and only appear in some subcommands. These are duplicated, though their parser is factored out
  • I updated the authors to include all of us (I don't care about the order, so I put myself last. If you feel like you should be earlier in the list, please feel free to rearrange)
  • The functionAbi f function is actually not very user-friendly. When I give a signature of --sig "stuff" it gives an internalError, because it's missing the (). It's now a little bit better, but it should be rewritten to return an Either and give better feedback to the user.
  • Updated build.yml to run cli-test
  • I set default-language everywhere in the cabal file. This seems to be needed now, with the new cli-test depending on hevm. Weird, but otherwise cabal check complains. This will be needed anyway in the future when we upgrade to newer cabal.

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

@msooseth msooseth force-pushed the improve-cli2 branch 2 times, most recently from e531b70 to d79e6bc Compare March 24, 2025 18:33
Update

Cleaner code

Making progress

Fixing parsing

Fixing up options

Update

More sane

Better header/footer

Much cleaner

Fixing address

Cleaner parsing

Factor out

Cleaner

Fixing build

Fixing capitalization

Updating to fix assertions parsing

Improve text

Cleanup
@msooseth msooseth changed the title [DRAFT] Do not review -- CLI improvement CLI improvement Mar 25, 2025
@msooseth msooseth changed the title CLI improvement CLI upgrade for more control and less duplication Mar 25, 2025
Fixing cli tests
@msooseth msooseth marked this pull request as ready for review March 26, 2025 11:00
@msooseth msooseth requested a review from blishko March 26, 2025 11:00
@msooseth msooseth force-pushed the improve-cli2 branch 2 times, most recently from c970f6a to 1e54ddf Compare March 26, 2025 11:44
Fixing errors in cabal file

Update authors, too

Much cleaner test code

Cleaner

Update

Run tests, update name
Copy link
Collaborator

@blishko blishko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty cool!

I have not spotted any problem. I will try to play with the CLI as well :)

Copy link
Collaborator

@blishko blishko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Can you check if these new package dependencies should really be dependencies for the library target?

@msooseth msooseth merged commit a6a02a6 into main Mar 31, 2025
9 checks passed
@msooseth msooseth deleted the improve-cli2 branch March 31, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants