pyxargs
bf.jq
pyxargs | bf.jq | |
---|---|---|
4 | 2 | |
4 | 39 | |
- | - | |
8.6 | 10.0 | |
about 2 months ago | over 9 years ago | |
Python | JSONiq | |
GNU General Public License v3.0 only | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
pyxargs
-
Modern Linux Tools vs. Unix Classics: Which Would I Choose?
> I too can never remember jq syntax when I need to. I usually just end up writing a Python script
Same here! That's why for small things I made pyxargs [1] to use python in the shell. In another thread I also just learned of pyp [2] which I haven't tried yet but looks like it'd be even better for this use case.
[1] https://github.com/elesiuta/pyxargs
[2] https://github.com/hauntsaninja/pyp
-
Alternative Shells
I personally use fish, but mostly for the out of the box auto completions and highlighting, I don't use it for actual scripting, nor have it set as the login shell due to the 2nd reason you mentioned.
I mostly use python as well, and for some short commands I made pyxargs [1] which lets you run python code on stdin, or a walk of your current directory.
[1] https://github.com/elesiuta/pyxargs
-
Ask HN: Share a shell script you like
pyxargs --py "print('{}') if os.path.ismount('{}') else ''" | pyxargs fusermount -u {}
My primary use case was using this with ffmpeg due to the encoding problem with xargs [2].
It can also run commands in parallel using a terminal multiplexer so outputs don't get mixed up or if they require user input.
[1] https://github.com/elesiuta/pyxargs
- Show HN: Clamshell- an experimental Python based shell
bf.jq
-
Modern Linux Tools vs. Unix Classics: Which Would I Choose?
"Those tried and true commands we were referring to? None other than the usual awk sed cut grep and of course the Unix pipe | to glue them all together. Really, why use a JSON parsing program that only could only do one function (parse JSON) when I could use a combination of tools that, when piped together, could do far more?"
IMHO, drinking the UNIX Kool-Aid means not only using coreutils and BSD userlands but also using the language in which almost all of those programs are written: C. For me, that means gcc and binutils are amongst the "tried and true commands". Also among them is flex. These are found on all the UNIX varieties I use, usually because they are used in compiling the OS. As such, no special installation is needed.
When I looked at jq in 2013, I noticed it used flex and possibly yacc/bison. No idea if it still does.
Using UNIX text processing utilities to manipulate JSON is easy enough. However if I am repeatedly processing JSON from the same source, e.g., YouTube, then I use flex instead of sed, etc. It's faster.
jq uses flex in the creation of a language interpreter intended^1 to process any JSON. I use flex not to create a language interpeter but to process only JSON from a single source. The blog author uses shell script to process JSON from a single source.^2 I think of the use I make of flex as like a compiled shell script. It's faster.
The blog author states than jq is specific to one type of text processing input: JSON. I write a utility that is specific to one source of JSON.
1. Sometimes it's not used as intended, e.g., https://github.com/makenowjust/bf.jq
2. I also used flex to make simple utility to reformat JSON from any source so it's easer to read and process with line-oriented UNIX utilities. Unlike jq and other JSON reformatters it does not require 100% correct JSON; e.g., it can accept JSON that is mixed in with HTML which I find is quite common in today's web pages.
- Brainfuck Interpreter Written in Jq
What are some alternatives?
fuz - Fuzzy search text / notes in the terminal, for any collection of text files
gron - Make JSON greppable!
spellbook - 🪄 Shell and Powershell scripts registry
fx - Terminal JSON viewer & processor
pyp - Easily run Python at the shell! Magical, but never mysterious.
dotfiles
stderred - stderr in red
clamshell - experimenting with a python based shell
fzf - :cherry_blossom: A command-line fuzzy finder