Shards: Unknown CLI options should be a failure instead of silently being ignored

Created on 4 Mar 2021  路  6Comments  路  Source: crystal-lang/shards

https://github.com/crystal-lang/shards/blob/c93b628fb5b51b75495feedf7a0f19e3bf4e08c1/src/cli.cr#L66

It turns out, that the flag just has to be there somewhere to work 馃槀

Screen Shot 2021-03-04 at 10 39 31 AM
Screen Shot 2021-03-04 at 10 41 03 AM

Probably not a huge deal, but just in case I figured I'd open the issue.

bug

All 6 comments

https://github.com/crystal-lang/crystal/pull/9465 :-)

So a bug in Crystal that affects shrads.

oh, just noticed as well... If you do write something funky, it borks the formatting:

shards list --tree
Shards installed:
  * lucky (0.26.0)
    * lucky_cli (0.26.0)
      * teeplate (0.8.2)
        * future (0.1.0)
shards list --treefiddy
Shards installed:
* lucky (0.26.0)
* lucky_cli (0.26.0)
* teeplate (0.8.2)
* future (0.1.0)

@asterite No, the Crystal bug is already fixed in 0.36.0.

There is no actual bug here except that shards list doesn't complain about additional, unknown flags.
The result of shards list --treeweeeee is exactly the same as shards list (the flag is just silently ignored).

To fix this properly CLI.run needs a major refactoring because currently a number of common options is handled there and thus allowed for all commands. But shards list --skip-postinstall doesn't make any more sense than shards list --treeweeeee 馃槅

but it's so fun to say!! 馃槅

Yeah, not a big deal. This actually came up because my finger slipped and typed --treed, and I was shocked that it still output something. So I started playing with it to see how far that went.

Yeah, it should definitely fail on invalid options.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vladfaust picture vladfaust  路  7Comments

ysbaddaden picture ysbaddaden  路  7Comments

j8r picture j8r  路  6Comments

Blacksmoke16 picture Blacksmoke16  路  8Comments

vladfaust picture vladfaust  路  5Comments