Announcement

Collapse
No announcement yet.

GCC 9 Offering Up Better Error Messages, JSON Output Support

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Zan Lynx
    replied
    Originally posted by starshipeleven View Post
    For the love of Bob. Command line is a scriptable user interface.

    If you need to get a real job done use a real scripting programming language like Lua or Python with the appropriate library.
    Yes absolutely this.

    Almost every Linux/Unix command line utility is either trivial to do using C or script (ls, find) or the command-line tool is already based on a library (curl, gzip).

    Leave a comment:


  • starshipeleven
    replied
    Originally posted by edgar444 View Post
    PS: I find JSON to be awkward format for humans to manipulate or read.
    I doubt anyone will find it easy to read. It is mostly designed for machine-to-machine communication of "objects", which is a quite alien concept for non-programmers.

    I mean OK if you HAVE to read or write it by hand it's not as cringy and syntax-error-prone as XML, but it does feel like abastract machiney language, unlike yaml and similar.

    Leave a comment:


  • brrrrttttt
    replied
    Originally posted by skeevy420 View Post

    Not to mention how much easier it would be to write code if there was a standardized output model like that. Being able to source a variable over some weird ass grep/sed/cut one-liner would be nice.

    Just look at all the crap with /usr merges and systemd...we can't even agree on where to save or how to start stuff. We damn sure ain't gonna agree on a standardized output model that every frickin program would somehow be expected to follow, but damn would it be nice.
    You'd have to standardise the schema, a near impossible task. Standardising the serialization format doesn't get you far. Most tools already offer a machine readable format that's easy to parse/deserialize, it's the schema that differs.
    [QUOTE=starshipeleven;n1085318]
    For the love of Bob. Command line is a scriptable user interface.

    If you need to get a real job done use a real scripting programming language like Lua or Python with the appropriate library.[QUOTE]
    This!

    Leave a comment:


  • numacross
    replied
    Originally posted by zxy_thf View Post
    but JSON is widely adopted, and it's still text, while I think most of us have no idea about what PowerShell is passing.
    Internally it's passing .NET objects serialized to XML if needed. Capable of somewhat awkward remoting using WSMAN, but since the open-source efforts started there are plans of using SSH for it instead.

    It is a different paradigm than classic text-based shells, but worth learning in my opinion especially since it's now open-source and cross-platform. For people working with Windows it's very valuable, especially if they also discover the gem that is Windows Management Instrumentation.

    Leave a comment:


  • wagaf
    replied
    Still waiting for a gcc daemon to speedup builds. On large projects, a significant amount of build time is spent forking, loading/parsing the same files over and over etc. instead of compiling..

    Leave a comment:


  • edgar444
    replied
    While parsing structured data with `jq` is nice, grep/sed/awk is guaranteed to stay, as not everything is as simple as selecting a property. Quite often there's a need for minute manipulations. Either way there's a need for learning and practicing string manipulation tricks.

    The terminal interface is human first, machine second. Having custom formats, 2D tables, column alignment, joined strings, lack of escape characters all help with human readability, where as separating each item into individual properties would turn output one dimensional, hinder output density, cause more lines and noise.

    So the preferred method is to deliver both, machine readable and human readable, like `ls` for humans, `find` for machines. If you really want `find` to output JSON, here ya go: `find . | jq -Rn '[inputs]'`, I wonder why I don't like the output though. My guess is 1D newline delimited arrays (or simple lists) are easier to reason about, and write, and It's good enough for 90%. Thus I rather have two 90% implementations, than one 100% implementation.

    PS: I find JSON to be awkward format for humans to manipulate or read. Preferring Yaml, but that doesn't matter, as one can convert Yaml or even XML to JSON and manipulate that (see `yq, xq` https://github.com/kislyuk/yq)
    PPS: Be cultural, don't use new lines in filenames. Or control codes. Ya messed up boi. ; )

    Leave a comment:


  • zxy_thf
    replied
    Originally posted by numacross View Post

    So we're reinventing PowerShell?
    but JSON is widely adopted, and it's still text, while I think most of us have no idea about what PowerShell is passing.
    Last edited by zxy_thf; 08 March 2019, 02:49 PM.

    Leave a comment:


  • starshipeleven
    replied
    Originally posted by Britoid View Post
    To be honest it would be pretty handy if every command line utility outputted as json.
    For the love of Bob. Command line is a scriptable user interface.

    If you need to get a real job done use a real scripting programming language like Lua or Python with the appropriate library.

    Leave a comment:


  • skeevy420
    replied
    Originally posted by Britoid View Post
    To be honest it would be pretty handy if every command line utility outputted as json.

    Then the Terminal can display those results however the user prefers or needs them.
    Not to mention how much easier it would be to write code if there was a standardized output model like that. Being able to source a variable over some weird ass grep/sed/cut one-liner would be nice.

    Just look at all the crap with /usr merges and systemd...we can't even agree on where to save or how to start stuff. We damn sure ain't gonna agree on a standardized output model that every frickin program would somehow be expected to follow, but damn would it be nice.

    Leave a comment:


  • Britoid
    replied
    Originally posted by numacross View Post

    So we're reinventing PowerShell?
    Yes..

    Leave a comment:

Working...
X