Commit fc0ca0f
committed
fix(clarity-cli): Make behavior of
Closes #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.eval without .clar file less confusing1 parent 67f1283 commit fc0ca0f
2 files changed
+14
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
793 | | - | |
| 793 | + | |
794 | 794 | | |
795 | 795 | | |
| 796 | + | |
| 797 | + | |
796 | 798 | | |
797 | 799 | | |
798 | 800 | | |
799 | 801 | | |
800 | 802 | | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
801 | 813 | | |
802 | 814 | | |
803 | 815 | | |
| |||
814 | 826 | | |
815 | 827 | | |
816 | 828 | | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | 829 | | |
828 | 830 | | |
829 | 831 | | |
| |||
0 commit comments