If you are like me, you make Bash or Zsh scripts to make your life easier with those small computing tasks. One of my favorite uses of Bash automation is the creation of Debian packages, which requires a LOT of work in directories. When you're typing in the waves of "mkdir" and "cd" into a bash script, it's easy to get lost, and that efficiency you felt while making the script goes out the window.
For the first time ever, there is now a solution: bpp. Bash PreProcessor reads a .bpp file, which is formatted plain text, and creates a bash script. The bpp language was designed with ease-of-use and visual perception in mind. How would you describe a directory layout to somebody through text? My answer to this question looked something like this:
|home
||Pictures
|||Vacation
|||Cats
||Documents
|||Document.txt
|bin
||ghc
||boy
I took this idea, and made a language with it. With the exception of Documents.txt, this is a valid bpp file that would create this directory layout, with proper nesting et al. Originally, this was as far as I was going to take the project. But I realized the need for creating content from within the script, so the next level of bpp was created. 4 special commands control the flow of a bpp file.
^file - Creates a file using touch
%command - Executes a shell command from the current directory
~file: line of text - Writes a line of text to a file.
~{file:
line1
line2
line3
} - Writes multiple lines to a file.
It is possible to do anything that Bash could with these commands. You can embed Bash scripts, or even embed Bash PreProcessor scripts with your PreProcessor scripts. This, paired with the directory layouts tool, creates a shell interface with an important feature: Modeling Power
A picture is worth a thousand words. A video is worth a lot more than that. Go watch bpp in action at the top of this article to see its capabilities. Since the making of this video, there has been the addition of one command, "jmp", which lets you jump between parts of the file like a goto statement.
Links
https://github.com/dymatic/bpp/tree/master/bpp
Samples
https://github.com/dymatic/bpp/blob/master/bpp/sample.bpp
If you're going to create a new language, why don't you just create a new language?
ReplyDelete"For the first time ever..." Get over yourself.
ReplyDeleteI meant the first part of this blog post in a satirical manor. Sorry if it didn't come across as such.
Delete