Giter VIP home page Giter VIP logo

fx's Introduction

fx's People

Contributors

alerque avatar alexandregv avatar alexkunin avatar antonmedv avatar armujahid avatar brewingcode avatar conorgrocock avatar danielruf avatar dry7 avatar ducaale avatar ezradiniz avatar kbakdev avatar lilihx avatar marvinjwendt avatar matthewadams avatar nateeag avatar nulldutra avatar offirmo avatar pengwynn avatar pombadev avatar popey avatar rdil avatar rosshadden avatar styfle avatar svenefftinge avatar testwill avatar yuryshulaev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fx's Issues

I can't install

➜  ~ npm install -g fx
npm ERR! code E404
npm ERR! 404 Not Found: @medv/prettyjson@^1.0.1

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/robixxu/.npm/_logs/2018-11-07T21_49_53_651Z-debug.log

Implement JSON search

Need to think about DX and interaction with current filter implementation.
There is good starting point to search:

'use strict'

function* find(v, regex, path = '') {
  if (regex.test(path)) {
    yield path
    return
  }

  if (typeof v === 'undefined' || v === null) {
    return
  }

  if (Array.isArray(v)) {
    let i = 0
    for (let value of v) {
      yield* find(value, regex, path + '[' + i++ + ']')
    }
  }

  if (typeof v === 'object' && v.constructor === Object) {
    const entries = Object.entries(v)
    for (let [key, value] of entries) {
      yield* find(value, regex, path + '.' + key)
    }
  }

  if (regex.test(v)) {
    yield path
  }
}

module.exports = find

Does anybody want to do this?

On a large file (556MB), "RangeError: Invalid string length" in Node 8.7.0, "JavaScript heap out of memory" in Node 10.12.0

Version

[email protected]

Input

A one-JSON-per-line file of about 556MB size.

Node 8.7.0

/Users/ivanbabak/.nvm/versions/node/v8.7.0/lib/node_modules/fx/index.js:111
      buff += chunk
              ^

RangeError: Invalid string length
    at Socket.stdin.on (/Users/ivanbabak/.nvm/versions/node/v8.7.0/lib/node_modules/fx/index.js:111:15)
    at emitNone (events.js:105:13)
    at Socket.emit (events.js:207:7)
    at emitReadable_ (_stream_readable.js:514:10)
    at emitReadable (_stream_readable.js:508:7)
    at addChunk (_stream_readable.js:275:7)
    at readableAddChunk (_stream_readable.js:247:13)
    at Socket.Readable.push (_stream_readable.js:209:10)
    at Pipe.onread (net.js:587:20)

Node 10.12.0


<--- Last few GCs --->

[30850:0x102802200]     3051 ms: Mark-sweep 847.8 (1080.7) -> 847.8 (1049.2) MB, 27.3 / 0.0 ms  (average mu = 0.854, current mu = 0.000) last resort GC in old space requested
[30850:0x102802200]     3076 ms: Mark-sweep 847.8 (1049.2) -> 847.8 (1049.2) MB, 25.3 / 0.0 ms  (average mu = 0.727, current mu = 0.001) last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x38ad3f32bf29 <JSObject>
    0: builtin exit frame: parse(this=0x38ad3f3204a1 <Object map = 0x38ad3df842a9>,0x38ad76ba6299 <Very long string[582662191]>,0x38ad3f3204a1 <Object map = 0x38ad3df842a9>)

    1: main(aka main) [0x38adde819559] [/Users/ivanbabak/.nvm/versions/node/v10.12.0/lib/node_modules/fx/index.js:47] [bytecode=0x38ad925ff261 offset=62](this=0x38ad428826f1 <undefined>,input=0x38ad76ba6299 <Very long strin...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0x10003ae75 node::Abort() [/Users/ivanbabak/.nvm/versions/node/v10.12.0/bin/node]
 2: 0x10003b07f node::OnFatalError(char const*, char const*) [/Users/ivanbabak/.nvm/versions/node/v10.12.0/bin/node]
 3: 0x1001a6a85 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/ivanbabak/.nvm/versions/node/v10.12.0/bin/node]
 4: 0x100574422 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/ivanbabak/.nvm/versions/node/v10.12.0/bin/node]
 5: 0x10057d894 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/ivanbabak/.nvm/versions/node/v10.12.0/bin/node]
 6: 0x10054f6d4 v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/Users/ivanbabak/.nvm/versions/node/v10.12.0/bin/node]
 7: 0x1006818a9 v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/Users/ivanbabak/.nvm/versions/node/v10.12.0/bin/node]
 8: 0x100266edb v8::internal::Builtin_Impl_JsonParse(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/ivanbabak/.nvm/versions/node/v10.12.0/bin/node]
 9: 0x26807c45bf9d 
10: 0x26807c4118d5 
11: 0x26807c4118d5 
12: 0x26807c4118d5 
Abort trap: 6

Needs some streaming processing for large files, jq has one.

Also looks like it doesn't support one-JSON-per-line like jq (but that's a separate issue).

EACCES: permission denied, on Ubuntu 18.04

Not working after installing with Snap on Ubuntu 18.04.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.1 LTS
Release:	18.04
Codename:	bionic
$ ls -lah composer.json 
-rwxrwxrwx 1 devrck devrck 4.0K Oct  8 16:12 composer.json
$ fx composer.json 
fs.js:642
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open 'composer.json'
    at Error (native)
    at Object.fs.openSync (fs.js:642:18)
    at Object.fs.readFileSync (fs.js:510:33)
    at main (/snap/fx/24/lib/node_modules/fx/index.js:52:16)
    at run (/snap/fx/24/lib/node_modules/fx/index.js:80:5)
    at Object.<anonymous> (/snap/fx/24/lib/node_modules/fx/index.js:98:1)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)

fails to install on node 10.7.0

log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'fx' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session d65dbe24d87ded37
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 verbose stack TypeError: asyncWrite is not a function
7 verbose stack     at onwrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:480:7)
7 verbose stack     at WritableState.onwrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:180:5)
7 verbose stack     at WriteStream.to [as _worker] (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:154:13)
7 verbose stack     at WriteStream._write (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js:35:13)
7 verbose stack     at doWrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
7 verbose stack     at writeOrBuffer (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5)
7 verbose stack     at WriteStream.Writable.write (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:334:11)
7 verbose stack     at WriteStream.to [as _worker] (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:171:25)
7 verbose stack     at WriteStream._write (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js:35:13)
7 verbose stack     at doWrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
7 verbose stack     at writeOrBuffer (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5)
7 verbose stack     at WriteStream.Writable.write (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:334:11)
7 verbose stack     at WriteStream.to [as _worker] (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:182:19)
7 verbose stack     at WriteStream._write (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js:35:13)
7 verbose stack     at doWrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
7 verbose stack     at writeOrBuffer (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5)
8 verbose cwd /Users/myuser
9 verbose Darwin 18.2.0
10 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "fx"
11 verbose node v10.7.0
12 verbose npm  v6.1.0
13 error asyncWrite is not a function
14 verbose exit [ 1, true ]

Arrow keys support?

I love the interactive mode! 🎉

I'd love to be able to navigate it using the arrow keys. I imagine it working like in the Elements/Inspector tab in Chrome/Firefox dev tools.

  • Up/Down goes up down :)
  • Right expands collapsed objects and arrays.
  • Left collapses objects and arrays. If the current item already is collapsed or isn't an object or array, it moves to the parent.

There would need to be some kind of highlight so we know where we are.

What do you think?

Exploiting .fxrc

I created a gist of an .fxrc file that doesn't (but could) ship sensitive information on the user's file system to a remote endpoint.

While I realize it is the responsibility of the user downloading code off the internet to do some due diligence to prevent this sort of attack, I would at least recommend including a disclaimer that the user should know exactly what's in their .fxrc file.

I can't think of a good way to entirely prevent this but blocking XHRs might work? 🤷‍♂️

Just a thought :) Otherwise, a very cool library!

Can't open binary on macOS.

Forgive me if this is a noob question, but I can't open the 'dms' file on my Mac. When I first download it, it says it's an unsigned file so the OS blocks it. I then run the following...

xattr -d com.apple.quarantine /Users/md48954/Downloads/fx-macos.dms

...which removes that block, but then I get this...

The contents of 'fx-macos.dms' cannot be extracted with 'The Unarchiver'

So what am I supposed to do with the file?

Note: I also downloaded the source, but I'm not sure how to pipe data through a node.js file since it isn't a binary.

Ability to add any dependency?

Hey @antonmedv

Nicely done, I'm a huge fan of jq and I was working with lambduh actually.

But I still hate the fact that lambduh has the opinionated way of treating the stdout: like json/line/file etc. I like the idea of using 'this'.

So, the "feature" that I miss is to add dependencies into the eval.

"{,x}" causes fx to crash

Thanks for this really cool tool!

$ echo '"{,x}"' | fx
TypeError: Cannot read property 'slice' of null
    at /home/lydell/.npm-global/lib/node_modules/fx/node_modules/neo-blessed/lib/program.js:2543:35
    at Array.forEach (<anonymous>)
    at Program._attr (/home/lydell/.npm-global/lib/node_modules/fx/node_modules/neo-blessed/lib/program.js:2542:11)
    at Box.Element._parseTags (/home/lydell/.npm-global/lib/node_modules/fx/node_modules/neo-blessed/lib/widgets/element.js:498:26)
    at Box.Element.parseContent (/home/lydell/.npm-global/lib/node_modules/fx/node_modules/neo-blessed/lib/widgets/element.js:393:22)
    at Box.Element.setContent (/home/lydell/.npm-global/lib/node_modules/fx/node_modules/neo-blessed/lib/widgets/element.js:335:8)
    at render (/home/lydell/.npm-global/lib/node_modules/fx/fx.js:248:9)
    at start (/home/lydell/.npm-global/lib/node_modules/fx/fx.js:253:3)
    at main (/home/lydell/.npm-global/lib/node_modules/fx/index.js:42:20)
    at Socket.stdin.on (/home/lydell/.npm-global/lib/node_modules/fx/index.js:109:5)

I'm using 3.0.2.

[Question] Support for node version 6.x.x

Does fxsupport Node.js v6 LTS?

I got following error while running on Node v6.11.5

echo '{"foo": "bar"}' | fx
TypeError: Object.entries is not a function
    at doPrint (/usr/local/lib/node_modules/fx/fx.js:183:30)
    at print (/usr/local/lib/node_modules/fx/fx.js:121:12)
    at render (/usr/local/lib/node_modules/fx/fx.js:221:21)
    at start (/usr/local/lib/node_modules/fx/fx.js:253:3)
    at main (/usr/local/lib/node_modules/fx/index.js:51:20)
    at Socket.stdin.on (/usr/local/lib/node_modules/fx/index.js:116:5)
    at emitNone (events.js:91:20)
    at Socket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)

Toggle line numbers display

Show line numbers

Modes

  • Hide line numbers by default
  • Toggle line numbers by shortcut

Line numbers display

  • For fully opened nodes only
  • For currently highlighted (search) line only
  • For partly collapsed nodes

Reference

May be like in bat:

Line numbering reference

Cannot follow stdout and pipe into fx

Would be nice to tail json logs and pipe to fx.
Example

$ tail -f myjson.log | fx
# and get a realtime output of json objects
{
"@timestamp": ...
"message": ...
"objectId": ...
}
{
"@timestamp": ...
"message": ...
"customField" ...
}
...

node non LTS requirement

Hey,

is node >= 9 a hard requirement?

node LTS is still v8 until october 2018. So I can't use fx in production until then...

How to use on Windows?

Install WSL, install nodejs, install fx.

Currently fx doesn't work outside WSL as interactive mode reads/writes from /dev/tty. In order to it work on windows we need use WinAPI. I can do it, if somebody wants to sponsor my work on Patreon.

Exception when run inside tmux

With the latest 10.0.0 standalone release I get an exception when running inside of tmux:

$ echo $TERM
tmux-256color
$ aws ec2 describe-instances --output json | fx

Error on tmux-256color.plab_norm:
";2%;%?%p7%t;8%;m%?%p9%t\u000e%e\u000f%;"

var v,
 stack = [],
 out = [];
out.push(";
2")};
if ((stack.push(v = params[6]),
 v)) {out.push(";
8")}out.push("m");
if ((stack.push(v = params[8]),
 v)) {out.push("\x0e")} else {out.push("\x0f")};
return out.join("");

pkg/prelude/bootstrap.js:262
  if (error) throw error;
             ^

Error: File '/**/fx/node_modules/@medv/blessed/usr/xterm' was not included into executable at compilation stage. Please recompile adding it as asset or script.
    at error_ENOENT (pkg/prelude/bootstrap.js:422:17)
    at readFileFromSnapshot (pkg/prelude/bootstrap.js:650:29)
    at Object.fs.readFileSync (pkg/prelude/bootstrap.js:693:18)
    at Tput.readTerminfo (/snapshot/fx/node_modules/@medv/blessed/lib/tput.js:157:13)
    at Tput.compileTerminfo (/snapshot/fx/node_modules/@medv/blessed/lib/tput.js:623:28)
    at Tput.injectTerminfo (/snapshot/fx/node_modules/@medv/blessed/lib/tput.js:627:27)
    at Tput._useXtermInfo (/snapshot/fx/node_modules/@medv/blessed/lib/tput.js:118:15)
    at Tput.setup (/snapshot/fx/node_modules/@medv/blessed/lib/tput.js:92:10)
    at new Tput (/snapshot/fx/node_modules/@medv/blessed/lib/tput.js:63:10)
    at Program.setupTput (/snapshot/fx/node_modules/@medv/blessed/lib/program.js:252:26)

Running it as TERM=xterm fx works.

XML support

This feature is kinda out of context of amazing fx. But after using it, the first question was: "can I parse and interact with XMLs in the same manner?" 😄

Maybe there is any good tool for that? I used xpath and xmllint, but they are not as tasty as fx 😢

snap - TypeError: Object.entries is not a function

When I try to run this command, I get the following error:

$ curl https://swapi.co/api/planets/ | fx
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5039    0  5039    0     0  12170      0 --:--:-- --:--:-- --:--:-- 12171
TypeError: Object.entries is not a function
    at doPrint (/snap/fx/24/lib/node_modules/fx/print.js:86:30)
    at print (/snap/fx/24/lib/node_modules/fx/print.js:110:11)
    at render (/snap/fx/24/lib/node_modules/fx/fx.js:537:24)
    at start (/snap/fx/24/lib/node_modules/fx/fx.js:547:3)
    at main (/snap/fx/24/lib/node_modules/fx/index.js:60:20)
    at Socket.stdin.on (/snap/fx/24/lib/node_modules/fx/index.js:94:5)
    at emitNone (events.js:91:20)
    at Socket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:978:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)

System info

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.4 LTS
Release:	16.04
Codename:	xenial
$ snap list
Name    Version    Rev   Tracking  Publisher   Notes
core    16-2.36.3  6130  stable    canonical✓  core
core18  18         512   stable    canonical✓  base
fx      10.0.0     24    stable    antonmedv   -
hello   2.10       20    stable    canonical✓  -
$ hello
Hello, world!

Node version support

It does not seem to work on node >v8 on Windows,

fx data.json where data.json contains and object with 9 nodes gives following:

src\node_file.cc:1610: Assertion `(argc) == (5)' failed.
 1: 00007FF75418ECE5
 2: 00007FF754168196
 3: 00007FF754168261
 4: 00007FF75412D571
 5: 00007FF754992E52
 6: 00007FF7549942ED
 7: 00007FF754993349
 8: 00007FF75499322B
 9: 0000028E36EDC5C1

Node version 8.9.4 works fine though

Does not support node v6

On node v6, there is no Object.entries so fx dies with the following stack trace:

TypeError: Object.entries is not a function
    at doPrint (/Users/karimsa/.nvm/versions/node/v6.12.2/lib/node_modules/fx/fx.js:183:30)
    at print (/Users/karimsa/.nvm/versions/node/v6.12.2/lib/node_modules/fx/fx.js:121:12)
    at render (/Users/karimsa/.nvm/versions/node/v6.12.2/lib/node_modules/fx/fx.js:221:21)
    at start (/Users/karimsa/.nvm/versions/node/v6.12.2/lib/node_modules/fx/fx.js:253:3)
    at main (/Users/karimsa/.nvm/versions/node/v6.12.2/lib/node_modules/fx/index.js:51:20)
    at Socket.stdin.on (/Users/karimsa/.nvm/versions/node/v6.12.2/lib/node_modules/fx/index.js:116:5)
    at emitNone (events.js:91:20)
    at Socket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)

v6 is still LTS so supporting it would be nice

iTerm2 + fish - don't see cursor nor can I edit the nodes

Thanks for this great package! I tried running this on Mac iTerm2 and I use fish shell. Everything went smoothly except I cannot see the cursor or edit the nodes.

I tried with echo '{"foo": [{"bar": "value"}]}' | fx.

Is this supposed to work like I described? I see a ticket open to support arrow keys so I'm not sure if editing is supposed to work.

.fxrc file

What about .fxrc file in $HOME? It will be cool place to store common functions and definitions.

const _ = require('lodash');

And now I can use lodash in args! Instead of

fx "require('lodash').fromPairs(this)"

Will be possible to

fx "_.fromPairs(this)"

support for cases without quotes

such as:

echo '{a: 1}' | fx

because there are no quotes, it will cause an error.

This is just a suggestion, because if you add this feature, it will no longer support json, but support objects.

Doesn't work on windows

On windows (Windows 10/64 Bit) it fails with the error:

fs.js:119
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/dev/tty'
    at Object.openSync (fs.js:443:3)
    at start (C:\Users\sbiedermann\.npm-global\node_modules\fx\fx.js:9:20)
    at main (C:\Users\sbiedermann\.npm-global\node_modules\fx\index.js:42:20)
    at Socket.stdin.on (C:\Users\sbiedermann\.npm-global\node_modules\fx\index.js:109:5)
    at Socket.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1081:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Feature request: Copy result to clipboard.

Maybe that feature exists but It would be great if users could copy their search results or some fields to clipboard. I know about the ability to select but it now what I want

Tried a simple echo but failed

$ echo '{"envType":"native","tenant":"hrcoremt","landscape":"develop","startDate":"2018-11-06","endDate":"2018-11-06","group":"kubernetes"}' | fx
/home/hearen/.nvm/versions/node/v5.0.0/lib/node_modules/fx/index.js:6
const {stdin, stdout, stderr} = process
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:404:25)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:136:18)
    at node.js:972:3

when I used this viewer online: http://jsonviewer.stack.hu/

It just works fine.

{
  "envType": "native",
  "tenant": "hrcoremt",
  "landscape": "develop",
  "startDate": "2018-11-06",
  "endDate": "2018-11-06",
  "group": "kubernetes"
}

No support for command line arguments except file name

fx --help throws an error

fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '--help'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at main (/usr/lib/node_modules/fx/index.js:52:16)
    at run (/usr/lib/node_modules/fx/index.js:80:5)
    at Object.<anonymous> (/usr/lib/node_modules/fx/index.js:98:1)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

fx <something here> regards <something here> as a file path.

Some errors on FC

Hi, some error like that:

TypeError: Object.entries is not a function
    at doPrint (/usr/lib/node_modules/fx/fx.js:183:30)
    at doPrint (/usr/lib/node_modules/fx/fx.js:166:26)
    at print (/usr/lib/node_modules/fx/fx.js:121:12)
    at render (/usr/lib/node_modules/fx/fx.js:221:21)
    at ScrollableBox.<anonymous> (/usr/lib/node_modules/fx/fx.js:217:5)
    at ScrollableBox.EventEmitter._emit (/usr/lib/node_modules/fx/node_modules/neo-blessed/lib/events.js:94:20)
    at ScrollableBox.EventEmitter.emit (/usr/lib/node_modules/fx/node_modules/neo-blessed/lib/events.js:117:12)
    at Program.<anonymous> (/usr/lib/node_modules/fx/node_modules/neo-blessed/lib/widgets/screen.js:508:34)
    at emitOne (events.js:96:13)
    at Program.emit (events.js:188:7)

my os: Linux localhost 4.8.6-201.fc21.x86_64

Navigate from top-level array

Hi,

I have an issue using fx with json arrays.

Let's consider the following json:

[
  {
    "foo": 0,
    "bar": 1
  }
]

I tried to type something like .[0].bar for example, but starting with an array does not seem to work.
Am I missing something?

Thank you

a jq command generation

Lovely work here! Might be a moon shot, but I’m wondering if generation of a jq selection command would be too much work? I imagine it’d be super useful to be able to interactively select a property and have the corresponding jq string command generated.

Add bash auto-completion

For example, when using with cat or echo commands.

cat data.json | fx this.path.part

Can be transformed into:

cat data.json | fx this.path 'Object.keys(this)'

Returned lists of keys can be used for bash auto-completion.

issues executing the script

running fx with the provided shebang (#!/usr/bin/env node --max-old-space-size=8192) does not work for me, node starts but it appears to be doing nothing (cat package.json | fx or fx --help).
running the script directly (node index.js) works and changing the shebang to omit --max-old-space-size works as well.

i'm running fx 2.0.0 on node 10.12.0-1 (tried 10.11.0 as well) on some arch-linux based distro.

Display version info

Add command line option for version display

Commands

Short -v form:

$ fx -v

Long --version form:

$ fx --version

Output

Short output, the same for -v and --version:

11.0.1

Optional output

Name and version:

fx 11.0.1

Name, version and build date:

fx 11.0.1  31 Jan 2019

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.