Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Add ability to output selection when exiting #286

Closed
pyhedgehog opened this issue Nov 25, 2023 · 4 comments
Closed

[feature] Add ability to output selection when exiting #286

pyhedgehog opened this issue Nov 25, 2023 · 4 comments

Comments

@pyhedgehog
Copy link

pyhedgehog commented Nov 25, 2023

...as a continuation of #209.

As I've commented in original issue yank feature is something different.

  1. How to customize what console program think clipboard is? I.e. I'm using windows and connecting to linux via several ssh hops... you understand.
  2. How to use this (as was asked in #132 and #209) as a dialog-like selector in script? I.e. I've planned to write curl http://example.com/something.json|fx --select-value|jq -c 'to_entries[]'|sponge entries.jsonl. In some other script you can write something like:
jq 'del(.[].data)' long.json >short.json
path=`fx --select-path short.json`
jq -r "$path|.data" long.json | base64 -d >data.png
@antonmedv
Copy link
Owner

Done! Now you can print selected part of json:

Here is preview (type p):
print

Or type P to output it to stdout.

fx file.json > selected.json

Will be released in fx v32.

@eadmaster
Copy link

i've just downloaded fx v33, and both --select-path and --select-value switches are not working:

ReferenceError: select is not defined
    at Object.eval (eval at run (/tmp/fx-33.0.0.js:141:14), <anonymous>:3:7)
    at run (/tmp/fx-33.0.0.js:141:25)
    at transform (/tmp/fx-33.0.0.js:74:20)
    at main (/tmp/fx-33.0.0.js:59:13)

@antonmedv
Copy link
Owner

Those flags are not supposed. Value is printed by default.

@eadmaster
Copy link

Or type P to output it to stdout.

oh, i see it now, i have to press "P" instead of Enter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants