1
1
mirror of https://github.com/wader/fq.git synced 2024-08-17 16:00:41 +03:00
This commit is contained in:
Mattias Wadman 2024-06-12 15:40:09 +00:00 committed by GitHub
commit 1b4a48fe18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,9 +52,10 @@ def _complete($line; $cursor_pos):
def _is_separator: . as $c | " .;[]()|=" | contains($c); def _is_separator: . as $c | " .;[]()|=" | contains($c);
def _is_internal: startswith("_") or startswith("$_"); def _is_internal: startswith("_") or startswith("$_");
def _query_index_or_key($q): def _query_index_or_key($q):
( ([.[] | _eval($q; {}) | type]) as $n ( ([.[] | _eval($q; {}) | type])
| if ($n | all(. == "object")) then "." | if length > 0 and all(. == "object") then "."
elif ($n | all(. == "array")) then "[]" # TODO: only [] if not first [1,2,3]\t -> [][] not [].[]
elif length > 0 and all(. == "array") then ".[]"
else null else null
end end
); );