Code Monkey home page Code Monkey logo

Comments (7)

jzelinskie avatar jzelinskie commented on May 29, 2024 1

@chancez maybe we should just add

if rawOutput {
  outputConf.Color = false
  outputConf.Pretty = false
}

above

faq/pkg/faq/faq.go

Lines 87 to 92 in ecc24ae

for _, output := range outputs {
err := encoder.UnmarshalJSONBytes([]byte(output), outputConf.Color, outputConf.Pretty)
if err != nil {
return err
}
}

The original jq (and early faq) handled this at flag-parsing time, but it honestly seems more sane to do it at the call site.

from faq.

jzelinskie avatar jzelinskie commented on May 29, 2024

This is on faq v0.0.6?

from faq.

vbatts avatar vbatts commented on May 29, 2024
vbatts@infra1:~$ faq --version
0.0.6

from faq.

chancez avatar chancez commented on May 29, 2024

Try -ojson when using -r and maybe -c. I think it's broken with non-JSON output.

from faq.

vbatts avatar vbatts commented on May 29, 2024

@chancez it already defaulted to json output. Adding that flag did not change anything.

vbatts@infra1:~$ curl -s https://api.github.com/repos/flatcar-linux/manifest/releases | faq -f json -o json -r '.[0].tag_name'
Error: failed to encode as pretty: invalid character 'v' looking for beginning of value
Usage:
  faq [flags] [filter string] [files...]
[...]

p.s. despite erroring out, the return code is from this is still 0

from faq.

chancez avatar chancez commented on May 29, 2024

Try -c. It's trying to pretty the raw output, which cannot be done.

from faq.

chancez avatar chancez commented on May 29, 2024

I'd agree with that.

from faq.

Related Issues (20)

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.