TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Sol – A de-minifier for shell programs

147 pointsby noperator9 months ago
I&#x27;ve built a tool called sol (like &quot;soul&quot;) that helps you inspect and format complex shell one-liners. Features:<p>- Choose which transformations you want (break on pipe, args, redirect, whatever)<p>- &quot;Peeks&quot; into stringified commands (think xargs, parallel) and formats those, too<p>- Auto-breaks at a given width (e.g., 80 characters)<p>- Shows you non-standard aliases, functions, files, etc. that you might not have in your shell environment<p>- Breaks up long jq lines with jqfmt because—let&#x27;s be honest—they&#x27;re getting out of hand<p>As a security researcher and tool developer, I often encounter (or create) long pipelined Bash commands. While quick and powerful, they can be a nightmare to read or debug. I created sol to make it easier to understand and share these commands with others.

4 comments

kmarc9 months ago
I usually do this by hand. Good to see a tool for it :-)<p>Feature request, which I would love to have in all my automation scripts:<p>Replace short flags with the long switches. Short flags are great when typing in a terminal but I don&#x27;t want to figure out 2 years from now what the<p><pre><code> obscurecommand -v -f -n </code></pre> does, and I have to assume that it&#x27;s NOT --version --file --dry-run, but --verbose, --force, and --dont-ask-before-deleting-everything<p>I try to use long options in my script, therefore (especially in a team, where not everyone is familiar with every single command)
评论 #41577378 未加载
评论 #41583406 未加载
snatchpiesinger9 months ago
Cool! My personal preference is Knuth-style line-breaks on binary operators and pipes, which means breaking before the operator&#x2F;pipe symbol.<p><pre><code> foo -a -b \ | bar -c -d -e \ | baz -e -f </code></pre> instead of<p><pre><code> foo -a -b | \ bar -c -d -e | \ baz -e -f </code></pre> This doesn&#x27;t seem to be an option, but could be easy to implement.
评论 #41581875 未加载
评论 #41578005 未加载
评论 #41586215 未加载
评论 #41579286 未加载
评论 #41580225 未加载
ComputerGuru9 months ago
This is really cool; for a second I thought I could use it to stop manually maintaining both the minified and full-text versions of my “shell prefix” that makes it possible to run rust source code directly as if it were a shell script [0] where I’ve accidentally diverged between the two in the past, but then I revisited it and saw that the real value was in the comments and explanations more than just placing output in variables and breaking up command pipelines across shell lines.<p>But the opposite might work, does anyone have a good <i>minifier</i> they could recommend (preferably one that does more than just whitespace mangling, eg also renames variables, chains executions, etc) that doesn’t introduce bash-isms into the resulting script?<p>[0]: <a href="https:&#x2F;&#x2F;neosmart.net&#x2F;blog&#x2F;self-compiling-rust-code&#x2F;" rel="nofollow">https:&#x2F;&#x2F;neosmart.net&#x2F;blog&#x2F;self-compiling-rust-code&#x2F;</a>
pxc8 months ago
This looks really handy! I should add this to the environment for some of my shell-centric projects at work.