Atom-beautify: Add support for Bash

Created on 7 Jul 2015  Â·  45Comments  Â·  Source: Glavin001/atom-beautify

I would like to request Bash shell scripts support in atom-beautify plugin.
Thanks for great work, anyway :+1:

add-beautifier add-language published

Most helpful comment

@ataraxus @GryfonN you guys do realize that there's a thumbs up button on GH now, right?
Please don't comment +1, it just triggers a notification to everyone involved :(

All 45 comments

I think the only bash beautifier is this: https://github.com/ewiger/beautify_bash (python)
But latest commit is 3 years old...

I tried this python script and it looks very well if i try it on an example.sh file. i just replaced self.tab_size = 2 to self.tab_size = 4 for better reading (could be an atom config...)

Maybe, if it's integrated in atom, we get a fork from the python script with a few "new" improvements ;-)

+1

I'd like to support this request, a shell script beautifier is in dire need.

:+1:

I'm forking the bash beautifier @andya9 mentioned and doing some work on it; would anyone like to give a hand?

I'm not familiar with python enough to lend a helpful hand. If there's any javascript tasks that will help you out - let me know.

A Node.js beautifier would be ideal.

In order for js-beautifier to cover bash - yes. Personally I'm fine referencing a python library to beautify on save for .sh file extensions.

I'm not familiar with JS at all, so I can't port this right now, but give me a couple of days and I should be able to do it. Would you guys rather go with a Python version or have me port it to Node? I'm more than happy to go either way.

In this community you're likely to receive "node please" answers haha. Ask the python community and they'll tell you otherwise. Since you're the one doing the work, you get to choose. I guess one way to help you make the decision is where you'll receive more help. I'm down to help with testing - I'm not comfortable with the porting portion because I have no desire to learn python atm.

Edit: Ah shit - totally forgot this library stays functionally compatible between python and node - so my above comment is pretty off-base.

Phew, this was a little harder than I thought; but it's done!
In all honesty, I didn't feel comfortable making this in Node, I lacked the knowledge to do it so I ended up just making it in Python.

Here it is, beautysh! I've also added it to PyPI to make for an easy installation. Hope you guys like it.

Thanks, @bemeurer :+1:

Will it be supported in atom-beautify?

@rogierlommers I just need somebody to work the pull request to integrate the new beautifier and we will have bash script support.

+1
And kudos to @bemeurer for making something work. Will this be integrated into atom beautify? We need BASH!

For those interested in creating a Pull Request

Read and follow https://github.com/Glavin001/atom-beautify/blob/master/docs/add-languages-and-beautifiers.md
Ask any specific questions you come across. We can improve the documentation.

Example Languages

Looking at these should be helpful.

Example Beautifiers

Looking at these should be helpful. These are specifically CLI beautifiers, with options as CLI arguments.

Your goal would be to:

  • [ ] Add Bash language
  • [ ] Add beautifysh beautifier support
  • [ ] Add a couple tests that pass on Travis CI (I will ignore AppVeyor/Windows)

Best of luck! Thanks :smiley:

Alright, I'll have some time to work on it this week, I'll let you all know when I reach something.

+1 - First thing I looked for in the Atom plugins.

+1 needed

+1 for bash/shell support!

:+1: Gotta add this!

@bemeurer Fantastic, ask me if you need help on this!!

@guilbep I'm currently overloaded with work, if you could start working on the implementation it would be great since I couldn't touch it yet.

Any status on this being added? Updates?

:+1:

Yeah, I'm curious as well.

A recommendation for a solid Bash script beautifier is still needed.

Well, there's https://github.com/hermanbergwerf/bashbeautify
but i didn't tried yet, so somebody needs to see if that's good enough.

I've had a try at this with beautysh, the PR is here.
If there's another beautifier to plug, I can get a look does anyone know if bashbeautify is OK ?

Beautifysh does not enable configuring indentation which is sad and from what I've seen in bashbeautify, it doesn't do it either.

Any other options ?

Waiting on Pull Request: https://github.com/Glavin001/atom-beautify/pull/1220

Very close to merging and publishing new version!

@quilicicf I can make the customizable indentation happen I think, give me a week and if my real analysis course hasn't killed me by then I'll post an update here. Shouldn't be difficult.

@bemeurer That'd be awesome. I'll integrate the option in atom if need be when you release it in beautysh.

Good luck for your analysis course.

@quilicicf How are you calling beautysh? I just checked, this should be super easy to implement.

@bemeurer see https://github.com/Glavin001/atom-beautify/pull/1220/files#diff-9721522e67f5b74bbdc14c9ec12e7f33R13 for implementation.

@Glavin001 Got it. Making this happen.

@Glavin001 @quilicicf Done. There will be some small changes in documentation. To sum it up:

  1. Beautysh no longer creates a backup file automatically, you need the -b flag for that
  2. The files to be beautified must follow the -f flag, i.e -f foo.sh bar.sh foobar.sh ...
  3. Setting indentation is available with the -i flag. Default is 4

I'm finishing the changes, and will pull to the project and to PyPI soon.

Done. New docs are up and the new version should already be up and running on PyPI. Hope this adds the functionality as you guys wanted. https://pypi.python.org/pypi/beautysh/3.1

Nice. I'll try to take the changes today and update the PR.
Thanks @bemeurer !

Fantastic work guys

_________________ eXtremeSHOK.com _________________

On 27 Sep 2016, at 9:13 AM, Cyprien Quilici [email protected] wrote:

Nice. I'll try to take the changes today and update the PR.
Thanks @bemeurer !

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

+1

+1

@ataraxus @GryfonN you guys do realize that there's a thumbs up button on GH now, right?
Please don't comment +1, it just triggers a notification to everyone involved :(

Indeed, vim filetype plugin may be a good starting point for bash beautify.

Published to v0.29.15

Was this page helpful?
0 / 5 - 0 ratings

Related issues

opikhidayat picture opikhidayat  Â·  4Comments

CorentinAndre picture CorentinAndre  Â·  4Comments

philiplb picture philiplb  Â·  5Comments

physcocode picture physcocode  Â·  3Comments

callmeyesh picture callmeyesh  Â·  3Comments