AshlinHarris / Spinners.jl

Command line spinners in Julia with Unicode support
MIT License
14 stars 1 forks source link

Spinner arguments should be parsed #72

Closed AshlinHarris closed 1 year ago

AshlinHarris commented 1 year ago

Currently, users can supply the following spinner parameters:

At the end of the list, an expression is required.

Example: @spinner :clock 0.1 "LOADING" "..." sleep(5)

Default arguments are provided by timer_spin in a lazy way (My bad!). It is assumes the first argument is style, the second is the framerate, etc. So we have

@spinner :pong sleep(4)     # possible
@spinner :pong 0.1 sleep(4) # possible
@spinner 0.1 sleep(4)       # error

What inputs should be accepted? Some possibilities:

@spinner f()
@spinner :pong f()
@spinner 0.1 f()
@spinner :pong 0.1 f()
@spinner :clock msg="LOADING " f()

What order of arguments should be accepted, and how can they be parsed by type?

curio-sitas commented 1 year ago

I think the most used argument should be the style and the custom message. So i would suggest to put the framerate at the end, before the Expr.

Also spinner is good for rapid and easy use and this suggests not to have much customization. On the other hand the function does not give the scope...

AshlinHarris commented 1 year ago

That makes sense.

Should style always take priority over msg? That is, should @spinner some_string f() assume that some_string is a style, not a message? Alternatively, we could assume the first Symbol is a style, the firstString is a message, and the first Number is a framerate.

Each of these arguments could be optional with a default value supplied. Any other argument (preceding message, mode) could be an named argument (e.g., mode=:random).

curio-sitas commented 1 year ago

That makes sense.

Should style always take priority over msg? That is, should @spinner some_string f() assume that some_string is a style, not a message? Alternatively, we could assume the first Symbol is a style, the firstString is a message, and the first Number is a framerate.

Each of these arguments could be optional with a default value supplied. Any other argument (preceding message, mode) could be an named argument (e.g., mode=:random).

Isn't it to complicated and confusing to have different argument order based on the style type ? I mean, choosing an unique convention is often the best choice