-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format json option #783
base: main
Are you sure you want to change the base?
Format json option #783
Conversation
7dd2a19
to
1a79172
Compare
4a1e3c3
to
f301c18
Compare
6e68614
to
3c4513c
Compare
This can either wait for tree tbd or be already merged |
Hey I don't think it still actually equivalent to I believe now it requires the flag so we might want to change the docs/completions |
it is as it just takes every cell used by long view and display its content differently |
tbh only tested with |
7d685f1
to
b50d5e3
Compare
b640ca1
to
ff107b5
Compare
ff107b5
to
0cf4855
Compare
I'd like to join the conversation for testing and contributing. I tried the |
pub enum OutputType { | ||
Legacy, | ||
Json, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't call the default output type Legacy
. This should be something like Console or TTY?
--smart-group"[Only show group if it has a different name from owner]" \ | ||
--stdin"[When piping to eza. Read file names from stdin]" | ||
--json"[Output results as JSON(equivalent to --long)]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail. You forgot the \
character.
--smart-group"[Only show group if it has a different name from owner]" \ | |
--stdin"[When piping to eza. Read file names from stdin]" | |
--json"[Output results as JSON(equivalent to --long)]" | |
--smart-group"[Only show group if it has a different name from owner]" \ | |
--stdin"[When piping to eza. Read file names from stdin]" \ | |
--json"[Output results as JSON(equivalent to --long)]" |
I don't like the approach here. I would have changed the codebase so that at the end there would always be a collection of structs with the respective file attributes. An output-specific renderer would then output the content. The code keeps getting bloated if more formats are added. There should be one source file for each format in which the rendering strategy is implemented. The render function always gets the same object so that the interface fits. If possible, other source files should not be changed at all. Maybe something like this. |
As per the precedent conversations, et to be consistent with current codebase this behaviour needs the
I Like the idea you proposing, but that is a bit of work tbh, tho, if you take a look at the current way of doing it, this is already like that as per how I implemented it, its just kinda hidden within the current structs. But refactoring everything is something I am thinking about. |
In the future, whenever a new format is added, it will be necessary to refactor it anyway. It would also be better to cleanly separate the data from the rendering logic. |
Well you got a point on the refactor part, as per the options one, there is priority made, but you can use the envvars to be more precise. |
650ac66
to
ad4d4dd
Compare
If you like I could try to reorganize the code and do a pull request. But only if that's okay and its alright for you to change some underlying architecture of the code. |
We always up for any contribution go ahead as you wish. |
fixes #472 |
80f7a2d
to
e84c470
Compare
5c74c4d
to
8360e15
Compare
0ca0cb4
to
65fdfaa
Compare
Okay @cafkafk and @PThorpe92 this is finally ready for merging |
Since this is hand rolling the json impl it isn't properly escaping invalid characters. For example a filename that has a quote in it produces invalid json. |
Oh Thanks didn't thought of that gonna take a look on how to fix it. |
f69b195
to
74f5098
Compare
I am still having trouble to implement json tree with the current data If I can't find anything I might refactor a bit of the code to have a different type of data structure saved to then be printed at once
Tree works for small trees but still have problems on big complex trees such as eza dir.
74f5098
to
f2476cb
Compare
Have we considered just creating a struct and |
Well, the thing is that the way we are storing everything right now is not really the best, I thought of using this but implementing it gave me more headaches than anything. And I was stuck between refactoring everything just for this to work, or doing this way. As I didn't had the head time to refactor I didn't move with it, but if we take the time to refactor, and stop storing the strings in a vector but a better table that would make it better clearly |
No description provided.