Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pretty print options #12

Open
dol opened this issue Jul 25, 2016 · 1 comment
Open

Add pretty print options #12

dol opened this issue Jul 25, 2016 · 1 comment

Comments

@dol
Copy link

dol commented Jul 25, 2016

It would be nice of the resulting bash commands could be pretty printed.

E.g.:

(trap "kill 0" SIGINT; export LC_ALL=C; curl -s -N "http://some.tld/data" | tail -n+2|awk -F',' '{q=0; o=""; for (i=1; i<=NF; i+=1) {if (q) o=o","$i; else o=o"\t"$i; if ($i == "\"") q=1-q; else{ if (substr($i,length($i),1)=="\"") q=0; else if (substr($i,1,1)=="\"") q=1; }}gsub(/\"/,"",o); print substr(o,2)}'|cut -d $'\t' -f1,3,8|awk -F '\t' '($3 > 0.97) {print}'|awk -F '\t' '{print $1"\t"$2}')

Pretty print version:

(
    trap "kill 0" SIGINT; \
    export LC_ALL=C; \
    curl -s -N "http://some.tld/data" \
    | tail -n+2 \
    | awk -F',' '{q=0; o=""; for (i=1; i<=NF; i+=1) {if (q) o=o","$i; else o=o"\t"$i; if ($i == "\"") q=1-q; else{ if (substr($i,length($i),1)=="\"") q=0; else if (substr($i,1,1)=="\"") q=1; }}gsub(/\"/,"",o); print substr(o,2)}' \
    | cut -d $'\t' -f1,3,8 \
    | awk -F '\t' '($3 > 0.97) {print}' \
    | awk -F '\t' '{print $1"\t"$2}'
)

When using a VCS a pretty printed command can be easily compared in comparison to a one line bash command.

@lasomethingsomething
Copy link
Contributor

Hi @dol: I noticed that you didn't get a response to this. Are you still interested in BigBash? Would you like to submit a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants