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

Add jq autocomplete / more helpful errors / error arrows #3

Open
Wazzaps opened this issue Mar 25, 2020 · 2 comments
Open

Add jq autocomplete / more helpful errors / error arrows #3

Wazzaps opened this issue Mar 25, 2020 · 2 comments

Comments

@Wazzaps
Copy link
Owner

Wazzaps commented Mar 25, 2020

No description provided.

@systemmonkey42
Copy link

Remember to allow custom macros (from ~/.jq and ~/.jq/*) to be autocompleted.

My ~/.jq directory contains about 150 custom macros (~800 lines of JQ) and autocomplete would be awesome.

Example macro - actual formatting.

# Convert the input integer to a string in the specified base (2 to 36 inclusive)
def convert(base):
  def stream:
    recurse(if . > 0 then ./base|floor else empty end) | . % base ;
  if . == 0 then "0"
  else  [stream] | reverse | .[1:]
  | if   base <  10 then map(tostring) | join("")
    elif base <= 36 then map(if . < 10 then 48 + . else . + 87 end) | implode
    else error("base too large")
    end
  end;

@dufferzafar
Copy link

@systemmonkey42 Are your jq macros on GitHub somewhere? Would love to see what sort of things people use it for!

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