cli
cli copied to clipboard
More verbose output
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.
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.
In any case, you're right, having the usual -v
/ --verbose
flag would probably be good also.
@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.
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]
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.
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 something like this would be great, especially when more files are being beautified: https://www.npmjs.com/package/cli-spinner.
@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:
-
You need to specify
--file-path
(-f
) beforetable.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. -
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
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 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