Add a shortcut for pretty-printing XML
- ID
4752383- date
2024-01-12 20:57:03+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
4582c3c- message
Add a shortcut for pretty-printing XML- changed files
2 files, 23 additions, 2 deletions
Changed files
text/README.md (7650) → text/README.md (8085)
diff --git a/text/README.md b/text/README.md
index 3a0dc21..1f4673a 100644
--- a/text/README.md
+++ b/text/README.md
@@ -61,6 +61,12 @@ scripts = [
"description": "removes the `list` query parameter from a YouTube URL; I use it with `youtube-dl`",
},
{
+ "name": "pp_xml < [TEXT]",
+ "description": """
+ alias for <code>xmllint --format -</code>, which pretty-prints a blob of XML.
+ """,
+ },
+ {
"name": "r",
"description": """
an alias for `rg`, aka <a href="https://geoff.greer.fm/ag/">the Silver Searcher</a>. (Yes, I really am too lazy to type two whole characters.)
@@ -104,7 +110,7 @@ scripts = [
},
]
-cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
+cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts, ignore_files={'prettyjson'})
]]]-->
<dl>
@@ -184,6 +190,15 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
</dd>
<dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/text/pp_xml">
+ <code>pp_xml < [TEXT]</code>
+ </a>
+ </dt>
+ <dd>
+ alias for <code>xmllint --format -</code>, which pretty-prints a blob of XML.
+ </dd>
+
+ <dt>
<a href="https://github.com/alexwlchan/scripts/blob/main/text/r">
<code>r</code>
</a>
@@ -250,4 +265,4 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
"codepoints. This is a Docker wrapper around <a href="https://github.com/lunasorcery/utf8info">a tool of the same name</a> by @lunasorcery.
</dd>
</dl>
-<!-- [[[end]]] (checksum: ca2352d23f305660d76ce3000c8e98df) -->
\ No newline at end of file
+<!-- [[[end]]] (checksum: d635f5a163a958b2746e4ef50d7cf2d9) -->
\ No newline at end of file
text/pp_xml (0) → text/pp_xml (71)
diff --git a/text/pp_xml b/text/pp_xml
new file mode 100755
index 0000000..f661e12
--- /dev/null
+++ b/text/pp_xml
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+xmllint --format -