0

I have this pretty cool command that giving me a nice json representation of a nix package

nix-env --json -qaA nixpkgs.wireshark | json_pp | less

But what I really want in pseudo shell/OCaml

nix-env --json -qaA nixpkgs.wireshark | json_pp | fun name -> name.json | less

I tried doing this with usages of tee with no success.

  • Do you mean you simply want to see occurrences of "fun name" replaced with "name.json" in the output of the json_pp call? – John Dec 4 '15 at 20:06
  • I am saying that right now less is getting the semantic equivalent of basically: less something but I want it to be getting less something.json because then I can get syntax highlithing and whatnot. – Edgar Aroutiounian Dec 4 '15 at 20:07
  • Perhaps an example of the expected output of both commands would help us answer. – dhag Dec 4 '15 at 20:31
  • @dhag I want less to get a file that ends in json, i have right now the inmemory representation of the json coming from json_pp at the moment. – Edgar Aroutiounian Dec 4 '15 at 20:33
  • Do you mean something like nix-env ... >name.json && less name.json? – dhag Dec 4 '15 at 20:39
1

If I understand your question correctly, something like the following should work:

nix-env --json -qaA nixpkgs.wireshark | json_pp >name.json && less name.json

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.