tailhook / vagga

Vagga is a containerization tool without daemons
http://vagga.readthedocs.org
MIT License
1.86k stars 96 forks source link

Regarding UNIX CLI dependent workflows #515

Open colbyn opened 5 years ago

colbyn commented 5 years ago

I hope I’m not intruding or anything. I literally just discovered your project and it’s everything I’ve always wanted from Docker! :)

Anyway if you’re ever looking for some inspiration for shell scripting, theres this project I’ve written a while back (and still use such personally every day, especially for quickly running hardcoded commands from the horribly verbose AWS CLI) that implements an indentation sensitive shell parser: https://github.com/colbyn/commands Anyway just thought it may interest you (also I’ve been thinking about rewriting such in rust).

It doesn’t try to replace shell scripting in any way, rather the intention was to simply make writing such less verbose, and feel more modern (i.e. it supports multiline strings; which has been very convenient for CLI based SQL workflows). It’s crazy that in Docker I have to write scripts like this:

RUN cd ./frontend/cms \
  && npm install \
  && bower install --allow-root \
  && mkdir -p ./dist/release/build \
  && pulp browserify --optimise --to ./dist/release/build/app.bundle.js \
  && browserify -p tinyify ./dist/release/build/app.bundle.js --outfile ./dist/release/build/app.bundle.js \
  && uglifycss ./assets/css/*.css > ./dist/release/build/app.bundle.css \
  && html-minifier ./assets/index.html \
    --collapse-whitespace \
    --remove-comments \
    --remove-optional-tags \
    --remove-redundant-attributes \
    --remove-script-type-attributes \
    --remove-tag-whitespace \
  && cp -r ./dist ../../release/build

Since I think an indentation sensitive shell parser feels more natural (also with some higher order convenience utils, i.e. the from thing (not sure what to call it)):

from ./frontend/cms do
  npm install
  bower install
    --allow-root
  mkdir -p ./dist/release/build
  pulp browserify
    --optimise
    --to ./dist/release/build/app.bundle.js
  browserify
    -p tinyify ./dist/release/build/app.bundle.js
    --outfile ./dist/release/build/app.bundle.js
  uglifycss ./assets/css/*.css > ./dist/release/build/app.bundle.css
  html-minifier ./assets/index.html
    --collapse-whitespace
    --remove-comments
    --remove-optional-tags
    --remove-redundant-attributes
    --remove-script-type-attributes
    --remove-tag-whitespace
  cp -r ./dist ../../release/build

Here is an example from a UI lib I'm currently working on (internal helper cmd):

from ./ss-web-utils do
    try cargo publish
from ./ss-css-types do
    try cargo publish
from ./ss-cssom-tree do
    try cargo publish
from ./ss-trees do
    try cargo publish
from ./ss-view-tree do
    try cargo publish
from ./ss-dom-tree do
    try cargo publish
from ./subscript do
    try cargo publish

Or using ffmpeg (most of my real stuff usually spans hundreds of lines, which would quickly get very messy using traditional bash syntax):

mkdir -p output/batch
ffmpeg -hide_banner -y
    -i ./input/test-two.mp4
    -an
    -c:v libx264
    -profile:v high
    -level 3.1
    -preset veryslow
    -flags +loop
    -pix_fmt yuv420p
    -qp 1 output/batch/out1.mp4
    -qp 50 output/batch/out2.mp4
    -qp 60 output/batch/out3.mp4