Skip to content

Commit

Permalink
Improve jq completions and add gojq completions
Browse files Browse the repository at this point in the history
* completions: updated jq completions

* completions: added completions for gojq

* Shorten jq completion descriptions

* Update gojq.fish

Capitalize first letter of descriptions to match other completions.

---------

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
  • Loading branch information
exploide and mqudsi committed Apr 23, 2023
1 parent 3a2033b commit 480133b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 14 deletions.
28 changes: 28 additions & 0 deletions share/completions/gojq.fish
@@ -0,0 +1,28 @@
# Pure Go implementation of jq
# https://github.com/itchyny/gojq

complete -c gojq -s c -l compact-output -d "Compact output, no pretty-print"
complete -c gojq -s r -l raw-output -d "Output raw strings without quotes"
complete -c gojq -s j -l join-output -d "Stop printing a newline after each output"
complete -c gojq -s 0 -l nul-output -d "Print NUL after each output"
complete -c gojq -s C -l color-output -d "Colorize output even if piped"
complete -c gojq -s M -l monochrome-output -d "Stop colorizing output"
complete -c gojq -l yaml-output -d "Output as YAML"
complete -c gojq -l indent -x -d "Number of spaces for indentation"
complete -c gojq -l tab -d "Use tabs for indentation"
complete -c gojq -s n -l null-input -d "Use null as input value"
complete -c gojq -s R -l raw-input -d "Read input as raw strings"
complete -c gojq -s s -l slurp -d "Read all inputs into an array"
complete -c gojq -l stream -d "Parse input in stream fashion"
complete -c gojq -l yaml-input -d "Read input as YAML"
complete -c gojq -s f -l from-file -rF -d "Load query from file"
complete -c gojq -s L -xa "(__fish_complete_directories)" -d "Directory to search modules from"
complete -c gojq -l arg -x -d "Set variable to string value"
complete -c gojq -l argjson -x -d "Set variable to JSON value"
complete -c gojq -l slurpfile -x -d "Set variable to the JSON contents of the file"
complete -c gojq -l rawfile -x -d "Set variable to the contents of the file"
complete -c gojq -l args -d "Consume remaining arguments as positional string values"
complete -c gojq -l jsonargs -d "Consume remaining arguments as positional JSON values"
complete -c gojq -s e -l exit-status -d "Exit 1 when the last value is false or null"
complete -c gojq -s v -l version -d "Print gojq version"
complete -c gojq -s h -l help -d "Print help"
30 changes: 16 additions & 14 deletions share/completions/jq.fish
@@ -1,27 +1,29 @@
# jq is a lightweight and flexible command-line JSON processor.
# See: https://stedolan.github.io/jq

complete -c jq -l version -d 'Output version and exit'
complete -c jq -l seq -d 'Use application/json-seq MIME type scheme'
complete -c jq -l version -d 'Output jq version'
complete -c jq -l seq -d 'Use application/json-seq MIME type'
complete -c jq -l stream -d 'Parse input in streaming fasion'
complete -c jq -l slurp -s s -d 'Run filter just once in large array'
complete -c jq -l raw-input -s R -d 'Don\'t parse as JSON but as string'
complete -c jq -l slurp -s s -d 'Read input to array and filter once'
complete -c jq -l raw-input -s R -d 'Parse input as string (not JSON)'
complete -c jq -l null-input -s n -d 'Ignore input and treat it as null'
complete -c jq -l compact-output -s c -d 'Don\'t pretty-print JSON'
complete -c jq -l tab -d 'Use a tab for indentation instead of 2 spaces'
complete -c jq -l indent -x -d 'Use given number of spaces for indentation'
complete -c jq -l tab -d 'Indent w/ tabs instead of spaces'
complete -c jq -l indent -x -d 'Num of spaces per indent'
complete -c jq -l color-output -s C -d 'Color output'
complete -c jq -l monochrome-output -s M -d 'Don\'t color output'
complete -c jq -l ascii-output -s a -d 'Replace UTF-8 characters with escape sequences'
complete -c jq -l unbuffered -d 'Flush output after each JSON object is printed'
complete -c jq -l ascii-output -s a -d 'Replace UTF-8 chars w/ escape sequences'
complete -c jq -l unbuffered -d 'Flush output after each JSON object'
complete -c jq -l sort-keys -s S -d 'Sort object keys in output'
complete -c jq -l raw-output -s r -d 'If output is string output its content directly to stdout'
complete -c jq -l raw-output -s r -d 'Write string output w/out quotes'
complete -c jq -l join-output -s j -d 'Raw output without newlines'
complete -c jq -l from-file -s f -r -d 'Read filter from file'
complete -c jq -s L -d 'Prepend given directory to search modules'
complete -c jq -l exit-status -s e -x -d 'Set exit status'
complete -c jq -s L -d 'Prepend dir to module search list'
complete -c jq -l exit-status -s e -d 'Set exit status from output'
complete -c jq -l arg -x -d 'Set variable'
complete -c jq -l argjson -x -d 'Set JSON-encoded variable'
complete -c jq -l slurpfile -r -d 'Read JSON in file and bind to given variable'
complete -c jq -l argfile -r -d 'Read JSON in file and bind to given variable [see man]'
complete -c jq -l run-tests -r -d 'Run tests in given file'
complete -c jq -l slurpfile -x -d 'Read JSON in file and bind to given variable'
complete -c jq -l argfile -x -d 'Read JSON in file and bind to given variable [see man]'
complete -c jq -l args -d 'Remaining args are positional string args'
complete -c jq -l jsonargs -d 'Remaining args are positional JSON text args'
complete -c jq -l run-tests -d 'Run tests in given file'

0 comments on commit 480133b

Please sign in to comment.