cli icon indicating copy to clipboard operation
cli copied to clipboard

More verbose output

Open muuvmuuv opened this issue 6 years ago • 11 comments

I had to beautify a file over 5000 lines of code and it was really depressing to see no output at all. I killed the process a few seconds after because I didn't know if it had really started. We could add a progress bar or just some colored text that says something. This would help users to not kill the process and wait for a result.

muuvmuuv avatar Oct 24 '18 08:10 muuvmuuv

What language and beautifier did you use? I think any beautifier should be able to handle a file of 5000 lines in a few seconds (probably faster), so there's probably some other problem. It could be a bug in the beautifier plugin.

lassik avatar Oct 24 '18 08:10 lassik

In any case, you're right, having the usual -v / --verbose flag would probably be good also.

lassik avatar Oct 24 '18 08:10 lassik

@lassik I pass in the --language html so my command is unibeautify table.html --language html. If you want to test it, here is the HTML, simply grab the HTML from the main content.

Edit: it seems to not even work with a simple 40 line html file.

muuvmuuv avatar Oct 24 '18 09:10 muuvmuuv

This is my list of installed packages globally:

→ npm list -g --depth 0
/usr/local/lib
├── @angular/[email protected]
├── @unibeautify/[email protected]
├── @unibeautify/[email protected]
├── @unibeautify/[email protected]
├── @unibeautify/[email protected]
├── @unibeautify/[email protected]
├── @unibeautify/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

muuvmuuv avatar Oct 24 '18 09:10 muuvmuuv

More verbose outputs for certain actions are a good idea. But I don't know how much I would do for a simple beautification of a file.

But it shouldn't hang like that. That's something to look into.

stevenzeck avatar Oct 24 '18 19:10 stevenzeck

Looks like requireg made some changes and the cli no longer loads beautifiers. Not sure why it hangs exactly. Edit: Actually might be a node change.

stevenzeck avatar Oct 25 '18 00:10 stevenzeck

@stevenzeck something like this would be great, especially when more files are being beautified: https://www.npmjs.com/package/cli-spinner.

muuvmuuv avatar Oct 25 '18 06:10 muuvmuuv

@muuvmuuv I don't disagree, but the issue you described originally won't be fixed with verbose output. You are running unibeautify table.html --language html, which has two issues:

  1. You need to specify --file-path (-f) before table.html, that is what is causing it to hang. The cli should handle this properly and exit, or pick up the file name without it.

  2. Unibeautify core should be a little more flexible when passing in the language name. In this case it won't find the language because html should be capitalized.

If you run unibeautify --file-path table.html --language HTML it should work

stevenzeck avatar Oct 25 '18 16:10 stevenzeck

I've opened #106 to fix the hang issue, it will either return Cannot find language. or No text in the file or stdin.

stevenzeck avatar Oct 25 '18 21:10 stevenzeck

@stevenzeck oh didn‘t know that, I assumed it works like prettier (passing the file and it just works). Thanks for the solution, but we may should change this so users don‘t need to capitalize letters in the CLI, not everyone knows the correct lettering of every language. But we discussed this already in another issue.

Anyway a verbose flag would be good to display some more info when debugging, fixing errors or when something did not work and we want the user to show us the verbose information.

Sent with GitHawk

muuvmuuv avatar Oct 27 '18 08:10 muuvmuuv

Can you open an issue in Unibeautify core for the language issue? Relevant lines are in LanguageManager.ts 18 and 25

stevenzeck avatar Oct 27 '18 18:10 stevenzeck