antonmedv / fx

Terminal JSON viewer & processor
https://fx.wtf
MIT License
19.08k stars 438 forks source link

[New] add `--indent` CLI arg; add tabs support #126

Closed ljharb closed 2 years ago

ljharb commented 4 years ago

Fixes #121

Happy to add tests and usage examples if this is the right direction to be going.

(Separately, i think thinks would be a lot cleaner if you used something like yargs as an arg parser, but that's out of scope for this PR)

antonmedv commented 4 years ago

I don’t like adding more flags to fx. Can we use .fxrc cars for this setting? Also I try to use as little bpm packages as possible. This allows to faster startup time.

ljharb commented 4 years ago

I'm not sure why using npm packages would meaningfully increase startup time, but sure, that's up to you.

As for flags - .fxrc is not an option for me because i want to use it as a systemwide utility, in any project. I could use an environment variable, however, if that would be preferable?

antonmedv commented 4 years ago

I'm not sure why using npm packages would meaningfully increase startup time, but sure, that's up to you

It will. How you suppose it can be done without extra costs? For example adding yargs adds around 50 ms delay.

And I trying to keep fx under 100 ms startup time.

I could use an environment variable, however, if that would be preferable?

Yes, env is better. Also can you support other params too?

ljharb commented 4 years ago

Sure, what'd you have in mind? Most of the config things are functions (impossible to support via env vars), or shell colors (awkward to support via env vars), so this seems like the only one.

antonmedv commented 4 years ago

Hmmm, yes. You are right. Let's find some solutions. Maybe completely refactor to env instead of function?

ljharb commented 4 years ago

That's certainly an approach - but it might be better to wait for a use case to present itself before creating churn, and i'm sure .fxrc makes a lot of sense for many use cases. At the moment the only new use case i'm aware of is for indentation :-)

antonmedv commented 2 years ago

I rewrote the entire fx in golang. So I belove this PR is no longer actual.

ljharb commented 2 years ago

@antonmedv does it have --indent as an option, with tabs support?

antonmedv commented 2 years ago

Will have FX_INDENT env variable.

antonmedv commented 2 years ago

Right now fx has themes support with FX_THEME. So I'm going to add FX_INDENT as well.

BTW, fx still supports JS reducerts and .fxrc file.