Closed maximbaz closed 5 years ago
Sure, I'd be happy for a patch. It should be pretty easy to do this as we now have argument parsing anyway. I don't think we need a config file, though. CLI params should be plenty!
Do you want a CLI param for configuring the entire qalc
command, or only for the "terse" parameter?
https://github.com/svenstaro/rofi-calc/blob/c3346d8e1b523ea2426722a133d806f0b653439c/src/calc.c#L307
I tried to come up with a patch for the former, but my C-fu is not that great and I'm not sure how to implement this properly, I can receive for example qalc +u8 -s "update_exchange_rates 1days"
as a char*
from a CLI param, but then in order to feed it to g_subprocess_newv
it needs to be converted to an array of strings, and it's not a simple split by a whitespace, but need to account for quotes (i.e. I should get { "qalc", "+u8", "-s", "update_exchange_rates 1days" }
and not { "qalc", "+u8", "-s", "update_exchange_rates", "1days" }
).
Do you have any suggestions? :)
I think for the time being we can provide a better interface by only allowing the user to customize some of the flags that go out to qalc. I can only think of few more cases where we might even want to set different flags directly. For now, I think it's prudent to think with just the -t
and then if it actually does because a problem, figure out a better way.
That should also help you with your problem as it will now be a fixed flag, I think
Nice project!
I'd like
qalc
instance to run with-t
/-terse
option, not only it gives, well, terse output, but also it removes the annoying parsing errors while I'm typing my expression.Compare the current master:
With a patched
rofi-calc
that adds-t
:I'd like to avoid patching the sources 😉
The request is therefore to consider using
-t
as a default, or providing a configuration for it, maybe make the entireqalc
command with all of its parameters configurable.