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

Please respect line break for large pipe commands after HEREDOC #1118

Open
lamyergeier opened this issue Jan 8, 2025 · 0 comments
Open

Please respect line break for large pipe commands after HEREDOC #1118

lamyergeier opened this issue Jan 8, 2025 · 0 comments

Comments

@lamyergeier
Copy link

lamyergeier commented Jan 8, 2025

Reference for syntax

Input

sqlite3 -separator "$sep" "${Temp_HistoryP}" << EOF |
        SELECT
            datetime(v.visit_date / 1000000, 'unixepoch') AS visit_date,
            p.title,
            p.url
        FROM moz_places p
        JOIN moz_historyvisits v ON p.id = v.place_id
        GROUP BY p.url
        ORDER BY v.visit_date DESC
EOF
awk -F "$sep" '{printf "%s  \x1b[36m%s  \x1b[m%s\n", $1, $2, $3}' | 
sed -E 's/\x1b\[[0-9;]+m  //g' | 
fzf --ansi --multi | 
grep -oP 'https?://.*$'

Output with shfmt

sqlite3 -separator "$sep" "${Temp_HistoryP}" << EOF | awk -F "$sep" '{printf "%s  \x1b[36m%s  \x1b[m%s\n", $1, $2, $3}' | sed -E 's/\x1b\[[0-9;]+m  //g' | fzf --ansi --multi | grep -oP 'https?://.*$'
        SELECT
            datetime(v.visit_date / 1000000, 'unixepoch') AS visit_date,
            p.title,
            p.url
        FROM moz_places p
        JOIN moz_historyvisits v ON p.id = v.place_id
        GROUP BY p.url
        ORDER BY v.visit_date DESC
EOF

Desired output

No change!

Additional

shfmt should actually break long pipeline into separate lines

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

1 participant