tiffany352 / rink-rs

Unit conversion tool and library written in rust
https://rinkcalc.app/about
GNU General Public License v3.0
442 stars 28 forks source link

Inline CLI usage #52

Closed dd86k closed 4 years ago

dd86k commented 4 years ago

rink(1) is proving to be a neat utility, but I only perform quick inlined CLI usage, so echo "..." | rink feels too long, and an alias/function (adding ^D) feels like a poor hack.

Would it make sense, say, to add -i "..." as a way to directly invoke the utility instead of piping it out?

liclac commented 4 years ago

What about making it rink -- ...?

liclac commented 4 years ago

I'm also wondering how common a use case it actually is to give rink a file.

Basically, I wonder if it'd be worth flipping this suggestion around, deprecating rink filename in favour of rink -f filename, and down the line making the default action to just evaluate the arguments.

This would reduce typing in (what I imagine to be) the more common use case, but also prevents various shell quoting errors from having to squeeze whole expressions into a flag value.

dd86k commented 4 years ago

The latter seems like a fine suggestion. To reduce headaches the input could be within one argument (e.g. rink "example").

For additional examples, julia have the -e and -E flags to evaluate inline expressions, but since julia is a scripting language, it makes sense for them to have such flag. I'm unaware of rink's goals, but I believe most (personal, at least so far) usage seems to be inlined (and not as a file/scriptlang).

That's my take on it.