{"id":835,"date":"2020-10-31T02:43:58","date_gmt":"2020-10-31T07:43:58","guid":{"rendered":"https:\/\/www.brunerd.com\/blog\/?p=835"},"modified":"2020-10-31T02:50:15","modified_gmt":"2020-10-31T07:50:15","slug":"new-projects-jpt-and-shui-now-available","status":"publish","type":"post","link":"https:\/\/www.brunerd.com\/blog\/2020\/10\/31\/new-projects-jpt-and-shui-now-available\/","title":{"rendered":"New Projects: jpt and shui, Now Available"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Between March and October 2020 I had some great ideas for command line Mac utilities the MacAdmin could apprecite and I had the time to devote to their realization. I&#8217;m excited to present these two open source projects, available on GitHub: <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/brunerd\/shui\" target=\"_blank\">jpt<\/a> and <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/brunerd\/\" target=\"_blank\">shui<\/a>. I hope they can add richness to your shell scripts&#8217; presentation and capabilities without requiring additional external dependancies.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>jpt<\/strong> &#8211; the &#8220;JSON Power Tool&#8221; is a Javascript and shell script polyglot that leverages <code><a href=\"https:\/\/trac.webkit.org\/wiki\/JSC\" target=\"_blank\" rel=\"noreferrer noopener\">jsc<\/a><\/code>, the <a rel=\"noreferrer noopener\" href=\"https:\/\/trac.webkit.org\/wiki\/JavaScriptCore\" target=\"_blank\">JavascriptCore<\/a> binary that is standard on <em>every<\/em> Mac since 10.4 and since the jpt is purposefully written in ES5 to maintain maximum compatibility, why yes, this tool <em>does<\/em> run on both PPC and Intel Macs all the way back to OS X Tiger and then all the way forward to the latest 11.0 macOS Big Sur! Many Linux distros like CentOS and Ubuntu come with jsc pre-installed also, even Windows with the Linux Subsystem installed can run jsc and therefore can run the jpt! <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What you can do with the jpt? Query JSON documents using either the simple yet expressive <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/brunerd\/jpt\" target=\"_blank\">JSONPath<\/a> syntax or the singular and precise JSON Pointer (<a rel=\"noreferrer noopener\" href=\"https:\/\/tools.ietf.org\/html\/rfc6901\" target=\"_blank\">RFC6901<\/a>) syntax. The output mode is JSON but additional creative output modes can render JSONPaths, JSON Pointer paths, or even just the property names with their &#8220;constructor&#8221; types (try -KC with -J or -R) Textual output can be encoded in a variety of formats (hex\/octal\/URI encoding, Unicode code points, etc&#8230;), data can be modified using both <a rel=\"noreferrer noopener\" href=\"http:\/\/jsonpatch.com\" target=\"_blank\">JSON Patch<\/a> (<a href=\"https:\/\/tools.ietf.org\/html\/rfc6902\">RFC6902<\/a>) operations (add, replace, remove, copy, move, test) and also  <a rel=\"noreferrer noopener\" href=\"https:\/\/tools.ietf.org\/html\/rfc7396\" target=\"_blank\">JSON Merge Patch<\/a> (<a rel=\"noreferrer noopener\" href=\"https:\/\/tools.ietf.org\/html\/rfc7386\" target=\"_blank\">RFC7386<\/a>) operations. JSON can be worked with in new ways, try <code>-L<\/code> for &#8220;JSONPath Object Literal&#8221; output to see what I mean. Or you simply feed <code>jsc<\/code> a file to pretty-print (stringify) to \/dev\/<code>stdout<\/code>. I&#8217;ll be writing more about this one for sure.<br>Github project page: <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/brunerd\/shui\" target=\"_blank\">jpt<\/a><br>Tagged blog posts: <a rel=\"noreferrer noopener\" href=\"https:\/\/www.brunerd.com\/blog\/category\/scripting\/jpt\/\" target=\"_blank\">scripting\/jpt<\/a><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>shui<\/strong> &#8211; first-class Applescript dialog boxes in your shell scripts without needing to remember esoteric Applescript phrasings! If you think it&#8217;s odd for code to have possessive nouns and are more comfortable in shell, you&#8217;re not alone. shui can be embedded in either bash or zsh scripts but it can <em>also<\/em> output Applescript if you really want to know how the sausage is made or want to embed in your script without shui. Hopefully shui will let you forget those awkward Applescript phrasing and focus on your shell script&#8217;s features and functionality. It uses <code>osascript<\/code> to execute the Applescript and <code>launchctl<\/code> to invoke <code>osascript<\/code> in the correct user context so user keyboard layouts are respected (vs. root runs). Check out the project page for demo videos and then give <strong>shui<\/strong> a try.<br>Project page: <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/brunerd\/\" target=\"_blank\">shui<\/a><br>Tagged blog posts: <a rel=\"noreferrer noopener\" href=\"https:\/\/www.brunerd.com\/blog\/category\/scripting\/shui\/\" target=\"_blank\">scripting\/shui<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Between March and October 2020 I had some great ideas for command line Mac utilities the MacAdmin could apprecite and I had the time to devote to their realization. I&#8217;m excited to present these two open source projects, available on GitHub: jpt and shui. I hope they can add richness to your shell scripts&#8217; presentation [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,37,4,12,36],"tags":[32,20,35,30,34,25,33,24,31,23],"class_list":["post-835","post","type-post","status-publish","format-standard","hentry","category-applescript","category-jpt","category-os-x","category-scripting","category-shui","tag-appplescript","tag-bash","tag-gui","tag-jpt","tag-json","tag-macos","tag-os-x","tag-shell","tag-shui","tag-zsh"],"_links":{"self":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/comments?post=835"}],"version-history":[{"count":6,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions"}],"predecessor-version":[{"id":842,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions\/842"}],"wp:attachment":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/media?parent=835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/categories?post=835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/tags?post=835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}