https://github.com/noperator/sol Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions By size + Enterprise + Teams + Startups By industry + Healthcare + Financial services + Manufacturing By use case + CI/CD & Automation + DevOps + DevSecOps * Resources Topics + AI + DevOps + Security + Software Development + View all Explore + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up Reseting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} noperator / sol Public * Notifications You must be signed in to change notification settings * Fork 2 * Star 340 A de-minifier (formatter, exploder, beautifier) for shell one-liners License MIT license 340 stars 2 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 2 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights noperator/sol This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit message Last commit date Latest commit History 3 Commits cmd/sol cmd/sol std-cmds std-cmds testdata testdata .gitignore .gitignore LICENSE.md LICENSE.md README.md README.md explode.go explode.go go.mod go.mod go.sum go.sum implode.go implode.go shellenv.go shellenv.go sol.go sol.go sol_test.go sol_test.go transform.go transform.go View all files Repository files navigation * README * MIT license sol A de-minifier (formatter, exploder, beautifier) for shell one-liners. ray sol [ sohl ] noun 1. a tool to help you inspect chained shell commands before you s hare a one-liner (or after you receive one) Before I ran sol, I had no idea what the h**k that one-liner I got from Oscar was supposed to do. 2. (also soul) the spiritual part of humans regarded in its moral aspect You probably don't have a soul--or at least, not a good one--if you share a one-liner with me without cleaning it up with sol first. 3. (rude slang) in a hopeless position or situation You're SOL if you think I'm going to try to read your one-liner without using sol. 4. an old French coin equal to 12 deniers sol is an free open-source project, but I take dollars and even sols as tips. Features * Choose which transformations you want (break on pipe, args, redirect, whatever) * "Peeks" into stringified commands (think xargs, parallel) and formats those, too * Shows you non-standard aliases, functions, files, etc. that you might not have in your shell environment * Breaks up long jq lines with jqfmt because--let's be honest--they're getting out of hand Built with * https://github.com/mvdan/sh * https://github.com/noperator/jqfmt Getting started Install go install -v github.com/noperator/sol/cmd/sol@latest Usage sol -h Usage of sol: -a arguments -all all -b binary commands: &&, ||, |, |& -c command substitution: $(), `` -e inspect env to resolve command types -f string file -j jq -jqarr arrays -jqobj objects -jqop string operators (comma-separated) -l clauses: case, for, if, while -o one line -p process substitution: <(), >() -r redirect: >, >>, <, <>, <&, >&, >|, <<, <<-, <<<, &>, &>> -s shell strings: xargs, parallel -v verbose via CLI Explode a complex one-liner directly on an interactive shell prompt. Great for iteratively editing a complex command. cli In the example above, I'm using bash in vi mode; I've bound @ to sol-func which calls sol with a few preset options. sol-func() { local current_line="${READLINE_LINE}" READLINE_LINE=$(echo "$current_line" | sol -p -c -b -r -a -s -jqobj -jqarr -jqop comma) READLINE_POINT=${#READLINE_LINE} } bind -m vi-command -x '"@": sol-func' via Vim Invoke it directly within Vim using visual block mode, a custom keybinding, etc. vim via stdin Alternatively, you can simply pipe a one-liner into standard input. stdin Back matter See also * mvdan/sh#80 (comment) * mvdan/sh#690 (comment) * mvdan/sh#992 To-do * [ ] parallelize exec.Command calls in shellenv.go * [ ] log better * [ ] explicitly handle other shell environments besides bash * [ ] fail gracefully when command not found * [*] auto-break on 80-char width, etc. * [ ] document API usage * [ ] add a test for shell environment inspection License This project is licensed under the MIT License. About A de-minifier (formatter, exploder, beautifier) for shell one-liners Resources Readme License MIT license Activity Stars 340 stars Watchers 5 watching Forks 2 forks Report repository Languages * Go 100.0% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.