-
Notifications
You must be signed in to change notification settings - Fork 717
fix(clarity-cli): Make behavior of eval without .clar file less confusing
#6738
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
fix(clarity-cli): Make behavior of eval without .clar file less confusing
#6738
Conversation
…fusing Closes stacks-network#6496. That issue reported that `clarity-eval SPWHATEVER something.clar` hangs forever, but it turns out that that's only half true. What it's in fact doing is waiting for `stdin` input. The Clarity program file name is an optional argument, and if it's not given, the program is read from the standard input instead. In the above example command line, `something.clar` is interpreted as the VM state DB directory instead (which is obviously not the caller's intention). I made three changes: - The usage message now uses the common format where all optional args are wrapped in square brackets and required args are unwrapped: ``` Usage: clarity-cli eval [--costs] [--epoch E] [--clarity_version N] contract-identifier [program.clar] vm-state.db ``` - I also added the info to the help message that without the `program.clar`, things will be read from `stdin`. - And I changed the order of execution so that the contract ID and the VM DBs are handled first, before the program content is loaded. That way, if the user passes a `something.clar` but (incorrectly) leaves off one of the required args, it immediately causes an error, instead of waiting for the program from `stdin` and *then* erroring. I also fixed the VSCode launch settings for clarity-cli.
8eb8bd8 to
4dd4ed0
Compare
|
(I know history rewrites and force pushes are discouraged, but since the original branch brought some weird commits along and I had only just opened this PR, I assume that was still fine) |
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (75.96%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #6738 +/- ##
===========================================
+ Coverage 70.62% 75.96% +5.34%
===========================================
Files 578 578
Lines 358784 358786 +2
===========================================
+ Hits 253376 272537 +19161
+ Misses 105408 86249 -19159
... and 262 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
brice-stacks
left a comment
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.
LGTM!
|
Looks good to me too! |
cf8d685
Closes #6496.
That issue reported that
clarity-eval SPWHATEVER something.clarhangs forever, but it turns out that that's only half true. What it's in fact doing is waiting forstdininput.The Clarity program file name is an optional argument, and if it's not given, the program is read from the standard input instead. In the above example command line,
something.claris interpreted as the VM state DB directory instead (which is obviously not the caller's intention).I made three changes:
The usage message now uses the common format where all optional args are wrapped in square brackets and required args are unwrapped:
Usage: clarity-cli eval [--costs] [--epoch E] [--clarity_version N] contract-identifier [program.clar] vm-state.dbI also added the info to the help message that without the
program.clar, things will be read fromstdin.And I changed the order of execution so that the contract ID and the VM DBs are handled first, before the program content is loaded. That way, if the user passes a
something.clarbut (incorrectly) leaves off one of the required args, it immediately causes an error, instead of waiting for the program fromstdinand then erroring.I also fixed the VSCode launch settings for clarity-cli.