Git Product home page Git Product logo

jq-fish-plugin's Introduction

Important

jqrepl

A plugin for Oh My Fish.

MIT License Fish Shell Version Oh My Fish Framework


asciicast

Prerequisities

Install

$ omf install https://github.com/jihchi/jq-fish-plugin.git

Usage

# read from a file
$ jqrepl [file]

# read from stdin
$ cat <json> | jqrepl

Example

$ curl -s pie.dev/json | jqrepl

example

License

MIT © Jihchi Lee et al

Contributors

Many thanks for your help!

jq-fish-plugin's People

Contributors

elebeaup avatar jihchi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

elebeaup

jq-fish-plugin's Issues

Wrong jq paths

The possible jq paths for some json are wrong.
For example, for the given json, the jq paths are wrong :

[
  {
    "node1": "foo1",
    "node2": "bar1"
  },
  {
    "node1": "foo2",
    "node2": "bar2"
  }
]

image

But, the following query gives the correct result (https://github.com/reegnz/jq-zsh-plugin/blob/master/bin/jq-paths) :

$ echo '[ {"node1": "foo1", "node2": "bar1"}, {"node1": "foo2", "node2": "bar2"}]' | jq -r '
  [
    path(..) | map(select(type == "string") // "[]")
    | join(".")
  ] | sort | unique | .[] | split(".[]") | join("[]") | "." + .
  '
.
.[]
.[].node1
.[].node2

set: Unknown option “-f”

jqrepl /tmp/bw.json                                             13:06:51
set: Unknown option “-f”

~/.local/share/omf/pkg/jq-fish-plugin/functions/jqrepl.fish (line 3): 
  set -f input (string trim "$argv[1]")
  ^
in function 'jqrepl' with arguments '/tmp/bw.json'

(Type 'help set' for related documentation)
set: Unknown option “-f”

~/.local/share/omf/pkg/jq-fish-plugin/functions/jqrepl.fish (line 7): 
    set -f input (mktemp)
    ^
in function 'jqrepl' with arguments '/tmp/bw.json'

(Type 'help set' for related documentation)
~/.local/share/omf/pkg/jq-fish-plugin/functions/jqrepl.fish (line 9): Invalid redirection target: 
    cat /dev/stdin > $input
                   ^
in function 'jqrepl' with arguments '/tmp/bw.json'

.

fish, version 3.3.1

Feature Request: Dump Results of Query to stdout on Exit

Often times I'd like to pair down a large JSON blob from AWS or say Brew but am unsure of the document structure or query needed. I've thought a few times about writing a wrapper similar to what you've built. So thanks, this is great! However when I hit return to exit when I have the correct query the resulting JSON is not sent to stdout but sometimes the query is , but not always. It would be great if exiting would dump the present result of the query to stdout.

Let me know if the behavior I'm seeing is expected and not my environment and if this use cases matches your intention for the plugin. I may have some time coming up and would submit a PR if I get something working. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.