diff --git a/scripts/cli/completions.bash b/scripts/cli/completions.bash index d0384a721..0fc6a1309 100644 --- a/scripts/cli/completions.bash +++ b/scripts/cli/completions.bash @@ -64,14 +64,14 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --force-refresh --help --open -c -h -o")" -- "$cur" ) ;; - 'topic set-schema-compatibility'*'--topic') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) - ;; - 'debug generate-diagnostics'*'--container') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; + 'topic set-schema-compatibility'*'--topic') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) + ;; + 'connector create-or-update'*'--connector') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; @@ -84,44 +84,52 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; - 'ccloud-connector delete'*'--connector') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) + 'connector show-config-parameters'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; 'ccloud-connector status'*'--connector') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; - 'connector show-config-parameters'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) + 'ccloud-connector delete'*'--connector') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; 'ccloud-connector resume'*'--connector') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; + 'ccloud-connector pause'*'--connector') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) + ;; + 'connector create-or-update'*'--level') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "INFO WARN DEBUG TRACE")" -- "$cur" ) ;; - 'ccloud-connector pause'*'--connector') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) + 'ccloud-connector create-or-update'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) ;; - 'connector show-config'*'--connector') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) + 'debug flight-recorder'*'--container') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; 'topic set-schema-compatibility'*'-t') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) ;; - 'debug flight-recorder'*'--container') + 'connector show-config'*'--connector') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) + ;; + + 'debug enable-remote-debugging'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'ccloud-connector create-or-update'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) + 'topic get-number-records'*'--topic') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) ;; 'connector show-config-parameters'*) @@ -132,14 +140,10 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-kafka-region-list)")" -- "$cur" ) ;; - 'debug enable-remote-debugging'*'-c') + 'debug block-traffic'*'--container') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'topic get-number-records'*'--topic') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) - ;; - 'connector log-level'*'--connector') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; @@ -148,18 +152,14 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "scrub.invalid.names=true enhanced.avro.schema.support=true connect.meta.data=false object.additional.properties=false use.optional.for.nonrequired=true ignore.default.for.nullables=true generalized.sum.type.support=true enhanced.protobuf.schema.support=true generate.index.for.unions=false int.for.enums=true optional.for.nullables=true generate.struct.for.nulls=true wrapper.for.nullables=true wrapper.for.raw.primitives=false")" -- "$cur" ) ;; - 'debug block-traffic'*'--container') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + 'repro bootstrap'*'--connector-zip') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-zip-or-jar-with-fzf --type zip "$cur")")" -- "$cur" ) ;; 'ccloud-connector show-config'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; - 'repro bootstrap'*'--connector-zip') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-zip-or-jar-with-fzf --type zip "$cur")")" -- "$cur" ) - ;; - 'repro bootstrap'*'--connector-jar') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-zip-or-jar-with-fzf --type jar "$cur")")" -- "$cur" ) ;; @@ -168,74 +168,70 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--compatibility --help --topic -h -t")" -- "$cur" ) ;; - 'connector show-lag'*'--connector') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) + 'debug install-vscode-extension'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) ;; 'topic display-consumer-offsets'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) ;; + 'connector show-lag'*'--connector') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) + ;; + 'debug flight-recorder'*'--action') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "start stop")" -- "$cur" ) ;; - 'debug install-vscode-extension'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) + 'debug generate-diagnostics'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'topic produce'*'--compatibility') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "BACKWARD BACKWARD_TRANSITIVE FORWARD FORWARD_TRANSITIVE FULL FULL_TRANSITIVE NONE")" -- "$cur" ) + 'debug thread-dump'*'--container') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'debug generate-diagnostics'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + 'connector create-or-update'*'-l') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "INFO WARN DEBUG TRACE")" -- "$cur" ) ;; - 'debug enable-remote-debugging'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--container --help -c -h")" -- "$cur" ) + 'container restart'*'--container') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; 'connector restart'*'--connector') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; - 'connector create-or-update'*'-l') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "INFO WARN DEBUG TRACE")" -- "$cur" ) + 'topic produce'*'--compatibility') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "BACKWARD BACKWARD_TRANSITIVE FORWARD FORWARD_TRANSITIVE FULL FULL_TRANSITIVE NONE")" -- "$cur" ) ;; 'connector create-or-update'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; - 'container restart'*'--container') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + 'debug enable-remote-debugging'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--container --help -c -h")" -- "$cur" ) ;; - 'debug thread-dump'*'--container') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + 'ccloud-connector show-config'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) ;; - 'container resume'*'--container') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + 'connector delete'*'--connector') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; 'ccloud-connector show-lag'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; - 'connector delete'*'--connector') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) - ;; - 'debug block-traffic'*'--action') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "start stop")" -- "$cur" ) ;; - 'ccloud-connector show-config'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) - ;; - 'connector status'*'--connector') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; @@ -244,40 +240,40 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; - 'topic get-number-records'*'-t') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) - ;; - - 'get-jmx-metrics'*'--component') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "zookeeper broker connect schema-registry")" -- "$cur" ) + 'container resume'*'--container') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'connector log-level'*'--level') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "INFO WARN DEBUG TRACE")" -- "$cur" ) + 'container pause'*'--container') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; 'run-ccloud'*'--cluster-region') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-kafka-region-list)")" -- "$cur" ) ;; - 'debug log-level set'*'--level') + 'connector log-level'*'--level') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "INFO WARN DEBUG TRACE")" -- "$cur" ) ;; - 'container pause'*'--container') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) - ;; - 'connector pause'*'--connector') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; + 'get-jmx-metrics'*'--component') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "zookeeper broker connect schema-registry")" -- "$cur" ) + ;; + + 'debug log-level set'*'--level') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "INFO WARN DEBUG TRACE")" -- "$cur" ) + ;; + 'debug heap-dump'*'--container') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'get-properties'*'--container') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + 'topic get-number-records'*'-t') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) ;; 'debug generate-diagnostics'*) @@ -288,24 +284,32 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'ccloud-connector resume'*'-c') + 'container get-ip-addresses'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) + ;; + + 'ccloud-connector delete'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; - 'repro bootstrap'*'--pipeline') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-examples-list-with-fzf --without-repro --sink-only "$cur")")" -- "$cur" ) + 'container logs'*'--container') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'ccloud-connector status'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) + 'get-properties'*'--container') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + ;; + + 'repro bootstrap'*'--pipeline') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-examples-list-with-fzf --without-repro --sink-only "$cur")")" -- "$cur" ) ;; 'repro bootstrap'*'--producer') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "none avro avro-with-key protobuf protobuf-with-key json-schema json-schema-with-key")" -- "$cur" ) ;; - 'container exec'*'--container') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + 'ccloud-connector resume'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; 'connector create-or-update'*) @@ -320,7 +324,7 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-zip-or-jar-with-fzf --type zip "$cur")")" -- "$cur" ) ;; - 'container kill'*'--container') + 'container exec'*'--container') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; @@ -328,19 +332,11 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-zip-or-jar-with-fzf --type jar "$cur")")" -- "$cur" ) ;; - 'ccloud-connector delete'*'-c') + 'ccloud-connector status'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; - 'container logs'*'--container') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) - ;; - - 'container get-ip-addresses'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) - ;; - - 'container ssh'*'--container') + 'container kill'*'--container') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; @@ -348,31 +344,35 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-ccloud-connector-list)")" -- "$cur" ) ;; + 'schema register'*'--subject') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-subject-list)")" -- "$cur" ) + ;; + 'ccloud-connector show-lag'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help --wait-for-zero-lag -c -h")" -- "$cur" ) ;; - 'topic get-number-records'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help --topic -h -t")" -- "$cur" ) + 'container ssh'*'--container') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'ccloud-connector plugins'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) + 'topic get-number-records'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help --topic -h -t")" -- "$cur" ) ;; 'connector show-config'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; - 'debug flight-recorder'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + 'ccloud-connector plugins'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) ;; - 'ccloud-connector delete'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) + 'debug flight-recorder'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'ccloud-connector status'*) + 'ccloud-connector resume'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) ;; @@ -380,22 +380,30 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-subject-list)")" -- "$cur" ) ;; - 'ccloud-connector resume'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) + 'schema register'*'--input') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-predefined-schemas "$cur")")" -- "$cur" ) ;; - 'debug block-traffic'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + 'ccloud-connector delete'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) ;; - 'connector log-level'*'-l') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "INFO WARN DEBUG TRACE")" -- "$cur" ) + 'ccloud-connector status'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) ;; 'repro bootstrap'*'--file') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-examples-list-with-fzf --without-repro "$cur")")" -- "$cur" ) ;; + 'topic describe'*'--topic') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) + ;; + + 'connector log-level'*'-l') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "INFO WARN DEBUG TRACE")" -- "$cur" ) + ;; + 're-run'*'--connector-jar') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-zip-or-jar-with-fzf --type jar "$cur")")" -- "$cur" ) ;; @@ -404,12 +412,16 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; + 'debug block-traffic'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) + ;; + 're-run'*'--connector-zip') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-zip-or-jar-with-fzf --type zip "$cur")")" -- "$cur" ) ;; - 'topic describe'*'--topic') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) + 'ccloud-connector pause'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) ;; 'container exec'*'--shell') @@ -420,44 +432,40 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "INFO WARN DEBUG TRACE")" -- "$cur" ) ;; - 'ccloud-connector pause'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) - ;; - - 'debug flight-recorder'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--action --container --help -c -h")" -- "$cur" ) + 'connector show-lag'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; 'connector show-config'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) ;; - 'topic produce'*'--input') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-predefined-schemas "$cur")")" -- "$cur" ) + 'topic consume'*'--topic') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) ;; - 'connector show-lag'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) + 'container ssh'*'--shell') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "bash sh ksh zsh")" -- "$cur" ) ;; 'topic produce'*'--topic') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) ;; - 'topic consume'*'--topic') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) + 'topic produce'*'--input') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-predefined-schemas "$cur")")" -- "$cur" ) ;; - 'container ssh'*'--shell') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "bash sh ksh zsh")" -- "$cur" ) + 'debug flight-recorder'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--action --container --help -c -h")" -- "$cur" ) ;; 'container restart'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'topic delete'*'--topic') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) + 'connector restart'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; 'debug thread-dump'*'-c') @@ -468,15 +476,15 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-subject-list)")" -- "$cur" ) ;; - 'connector restart'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) + 'topic delete'*'--topic') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) ;; 'container resume'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'connector resume'*'-c') + 'connector status'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; @@ -492,18 +500,26 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--action --container --destination --help --port -c -h")" -- "$cur" ) ;; - 'topic alter'*'--topic') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) + 'connector resume'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; 'repro import'*'--file') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-playground-repro-export-with-fzf "$cur")")" -- "$cur" ) ;; + 'topic alter'*'--topic') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) + ;; + 'connector log-level'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help --level -c -h -l")" -- "$cur" ) ;; + 'connector delete'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) + ;; + 'run'*'--connector-jar') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-zip-or-jar-with-fzf --type jar "$cur")")" -- "$cur" ) ;; @@ -512,19 +528,15 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-zip-or-jar-with-fzf --type zip "$cur")")" -- "$cur" ) ;; - 'connector status'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) + 'container pause'*'-c') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'connector delete'*'-c') + 'connector pause'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) ;; - 'container pause'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) - ;; - - 'container recreate'*) + 'container kill-all'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) ;; @@ -532,14 +544,10 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "zookeeper broker connect schema-registry")" -- "$cur" ) ;; - 'container kill-all'*) + 'container recreate'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) ;; - 'connector pause'*'-c') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-connector-list)")" -- "$cur" ) - ;; - 'debug heap-dump'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; @@ -552,19 +560,19 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) ;; - 'repro bootstrap'*'-f') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-examples-list-with-fzf --without-repro "$cur")")" -- "$cur" ) - ;; - 'connector versions'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) ;; + 'repro bootstrap'*'-f') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-examples-list-with-fzf --without-repro "$cur")")" -- "$cur" ) + ;; + 'connector show-lag'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help --wait-for-zero-lag -c -h")" -- "$cur" ) ;; - 'container kill'*'-c') + 'container exec'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; @@ -576,11 +584,7 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; - 'connector plugins'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) - ;; - - 'container exec'*'-c') + 'container kill'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; @@ -596,30 +600,34 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--container --help -c -h")" -- "$cur" ) ;; - 'connector restart'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) - ;; - 'get-properties'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; + 'connector plugins'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) + ;; + 'run-ccloud'*'--file') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-examples-list-with-fzf --ccloud-only "$cur")")" -- "$cur" ) ;; - 'container resume'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--container --help -c -h")" -- "$cur" ) + 'connector restart'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) ;; - 'container ssh'*'-s') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "bash sh ksh zsh")" -- "$cur" ) + 'container resume'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--container --help -c -h")" -- "$cur" ) ;; 'container ssh'*'-c') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(docker ps --format '{{.Names}}')")" -- "$cur" ) ;; + 'container ssh'*'-s') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "bash sh ksh zsh")" -- "$cur" ) + ;; + 'connector resume'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) ;; @@ -656,10 +664,18 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h get set")" -- "$cur" ) ;; + 'connector pause'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) + ;; + 'debug heap-dump'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--container --help -c -h")" -- "$cur" ) ;; + 'schema register'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help --input --subject --verbose -h -v")" -- "$cur" ) + ;; + 'repro import'*'-f') while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-playground-repro-export-with-fzf "$cur")")" -- "$cur" ) ;; @@ -672,10 +688,6 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-topic-list)")" -- "$cur" ) ;; - 'connector pause'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--connector --help -c -h")" -- "$cur" ) - ;; - 'container kill'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--container --help -c -h")" -- "$cur" ) ;; @@ -712,10 +724,6 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) ;; - 'run-ccloud'*'-f') - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-examples-list-with-fzf --ccloud-only "$cur")")" -- "$cur" ) - ;; - 'topic produce'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--compatibility --forced-value --generate-only --headers --help --input --key --nb-messages --nb-partitions --producer-property --record-size --tombstone --topic --validate --validate-config --value-subject-name-strategy --verbose -h -t -v")" -- "$cur" ) ;; @@ -724,14 +732,18 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--grep --help --max-messages --min-expected-messages --plot-latencies-timestamp-field --subject --tail --timeout --topic --verbose -h -t -v")" -- "$cur" ) ;; - 'topic delete'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help --topic -h -t")" -- "$cur" ) + 'run-ccloud'*'-f') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "$(playground get-examples-list-with-fzf --ccloud-only "$cur")")" -- "$cur" ) ;; 'topic create'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help --nb-partitions --topic -h -t")" -- "$cur" ) ;; + 'topic delete'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help --topic -h -t")" -- "$cur" ) + ;; + 'repro export'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--all --help -h")" -- "$cur" ) ;; @@ -785,11 +797,7 @@ _playground_completions() { ;; 'schema'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h get")" -- "$cur" ) - ;; - - 'topic'*) - while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h alter consume create delete describe display-consumer-offsets get-number-records produce set-schema-compatibility")" -- "$cur" ) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h get register")" -- "$cur" ) ;; 'debug'*) @@ -800,6 +808,10 @@ _playground_completions() { while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h bootstrap export import")" -- "$cur" ) ;; + 'topic'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h alter consume create delete describe display-consumer-offsets get-number-records produce set-schema-compatibility")" -- "$cur" ) + ;; + 'stop'*) while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_playground_completions_filter "--help -h")" -- "$cur" ) ;; diff --git a/scripts/cli/playground b/scripts/cli/playground index 7b0a6e39e..d33180017 100755 --- a/scripts/cli/playground +++ b/scripts/cli/playground @@ -60,7 +60,8 @@ playground_usage() { echo printf "%s\n" "$(bold "Schema commands:")" printf " %s 🔰 Schema commands\n" "$(green "schema") " - [[ -n $long_usage ]] && printf " %s 🔰 Get all schemas versions for all subjects\n" "$(green "schema get") " + [[ -n $long_usage ]] && printf " %s 🔰 Get all schemas versions for specified subject (if --subject is not specified, all subjects will be used)\n" "$(green "schema get") " + [[ -n $long_usage ]] && printf " %s ⏺️ Register a schema in specified subject\n" "$(green "schema register") " echo printf "%s\n" "$(bold "Debug commands:")" printf " %s 🐞 Debug commands\n" "$(green "debug") " @@ -1408,8 +1409,9 @@ playground_schema_usage() { printf " playground schema [COMMAND] --help | -h\n" echo # :command.usage_commands - printf "%s\n" "$(bold "Kafka commands:")" - printf " %s 🔰 Get all schemas versions for all subjects\n" "$(green "get")" + printf "%s\n" "$(bold "Schema commands:")" + printf " %s 🔰 Get all schemas versions for specified subject (if --subject is not specified, all subjects will be used)\n" "$(green "get") " + printf " %s ⏺️ Register a schema in specified subject\n" "$(green "register")" echo # :command.long_usage @@ -1427,11 +1429,11 @@ playground_schema_usage() { # :command.usage playground_schema_get_usage() { if [[ -n $long_usage ]]; then - printf "playground schema get - 🔰 Get all schemas versions for all subjects\n" + printf "playground schema get - 🔰 Get all schemas versions for specified subject (if --subject is not specified, all subjects will be used)\n" echo else - printf "playground schema get - 🔰 Get all schemas versions for all subjects\n" + printf "playground schema get - 🔰 Get all schemas versions for specified subject (if --subject is not specified, all subjects will be used)\n" echo fi @@ -1448,7 +1450,7 @@ playground_schema_get_usage() { # :command.usage_flags # :flag.usage printf " %s\n" "$(magenta "--subject SUBJECT")" - printf " 📛 Subject\n" + printf " 📛 Subject name\n" echo # :command.usage_fixed_flags @@ -1465,6 +1467,57 @@ playground_schema_get_usage() { fi } +# :command.usage +playground_schema_register_usage() { + if [[ -n $long_usage ]]; then + printf "playground schema register - ⏺️ Register a schema in specified subject\n" + echo + + else + printf "playground schema register - ⏺️ Register a schema in specified subject\n" + echo + + fi + + printf "%s\n" "$(bold "== Usage ==")" + printf " playground schema register [OPTIONS]\n" + printf " playground schema register --help | -h\n" + echo + + # :command.long_usage + if [[ -n $long_usage ]]; then + printf "%s\n" "$(bold "== Options ==")" + + # :command.usage_flags + # :flag.usage + printf " %s\n" "$(magenta "--subject SUBJECT (required)")" + printf " 📛 Subject name\n" + echo + + # :flag.usage + printf " %s\n" "$(magenta "--verbose, -v")" + printf " 🐞 Show command being ran.\n" + echo + + # :flag.usage + printf " %s\n" "$(magenta "--input INPUT")" + printf " 🔥 You can either:\n \n * Set your own schema (avro, json-schema, protobuf) with stdin (see example\n section).\n \n * Use completion to select predefined schemas (or use your own schema file)\n 🎓 Tip: use completion to trigger fzf completion\n" + printf " Default: -\n" + echo + + # :command.usage_fixed_flags + printf " %s\n" "$(magenta "--help, -h")" + printf " Show this help\n" + echo + + # :command.usage_examples + printf "%s\n" "$(bold "Examples")" + printf " playground schema register --subject test-protobuf << 'EOF'\n syntax = \"proto3\";\n \n package com.github.vdesabou;\n \n message Customer {\n int64 count = 1;\n string first_name = 2;\n string last_name = 3;\n string address = 4;\n }\n EOF\n \n playground schema register --subject test-avro << 'EOF'\n {\n \"type\": \"record\",\n \"namespace\": \"com.github.vdesabou\",\n \"name\": \"Customer\",\n \"fields\": [\n {\n \"name\": \"count\",\n \"type\": \"long\",\n \"doc\": \"count\"\n },\n {\n \"name\": \"first_name\",\n \"type\": \"string\",\n \"doc\": \"First Name of Customer\"\n },\n {\n \"name\": \"last_name\",\n \"type\": \"string\",\n \"doc\": \"Last Name of Customer\"\n },\n {\n \"name\": \"address\",\n \"type\": \"string\",\n \"doc\": \"Address of Customer\"\n }\n ]\n }\n EOF\n" + echo + + fi +} + # :command.usage playground_debug_usage() { if [[ -n $long_usage ]]; then @@ -10577,6 +10630,75 @@ playground_schema_get_command() { done } +# :command.function +playground_schema_register_command() { + # src/schema_register_command.sh + subject="${args[--subject]}" + schema="${args[--input]}" + verbose="${args[--verbose]}" + + ret=$(get_sr_url_and_security) + + sr_url=$(echo "$ret" | cut -d "@" -f 1) + sr_security=$(echo "$ret" | cut -d "@" -f 2) + + tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) + #trap 'rm -rf $tmp_dir' EXIT + #log "tmp_dir is $tmp_dir" + schema_file=$tmp_dir/value_schema + + if [ "$schema" = "-" ] + then + schema_content=$(cat "$schema") + echo "$schema_content" > $schema_file + else + if [[ $schema == @* ]] + then + # this is a schema file + argument_schema_file=$(echo "$schema" | cut -d "@" -f 2) + cp $argument_schema_file $schema_file + elif [ -f $schema ] + then + cp $schema $schema_file + else + schema_content=$schema + echo "$schema_content" > $schema_file + fi + fi + + if grep -q "proto3" $schema_file + then + log "🔮 schema was identified as protobuf" + schema_type=PROTOBUF + elif grep -q "\"type\"\s*:\s*\"object\"" $schema_file + then + log "🔮 schema was identified as json schema" + schema_type=JSON + elif grep -q "\"type\"\s*:\s*\"record\"" $schema_file + then + log "🔮 schema was identified as avro" + schema_type=AVRO + else + logerror "❌ no known schema could be identified" + exit 1 + fi + + json="{\"schemaType\":\"$schema_type\"}" + + content=$(cat $schema_file | tr -d '\n' | tr -s ' ') + json_new=$(echo $json | jq --arg content "$content" '. + { "schema": $content }') + + log "⏺️ Registering schema to subject ${subject}" + if [[ -n "$verbose" ]] + then + set -x + fi + curl $sr_security --request POST -s "${sr_url}/subjects/${subject}/versions" \ + --header 'Content-Type: application/vnd.schemaregistry.v1+json' \ + --data "$json_new" | jq . + +} + # :command.function playground_debug_install_vscode_extension_command() { # src/debug_install_vscode_extension_command.sh @@ -16930,6 +17052,13 @@ playground_schema_parse_requirements() { shift $# ;; + register) + action="register" + shift + playground_schema_register_parse_requirements "$@" + shift $# + ;; + # :command.command_fallback "") playground_schema_usage >&2 @@ -17037,6 +17166,109 @@ playground_schema_get_parse_requirements() { } +# :command.parse_requirements +playground_schema_register_parse_requirements() { + # :command.fixed_flags_filter + while [[ $# -gt 0 ]]; do + case "${1:-}" in + --help | -h) + long_usage=yes + playground_schema_register_usage + exit + ;; + + *) + break + ;; + + esac + done + + # :command.command_filter + action="schema register" + + # :command.parse_requirements_while + while [[ $# -gt 0 ]]; do + key="$1" + case "$key" in + # :flag.case + --subject) + + # :flag.case_arg + if [[ -n ${2+x} ]]; then + + args['--subject']="$2" + shift + shift + else + printf "%s\n" "--subject requires an argument: --subject SUBJECT" >&2 + exit 1 + fi + ;; + + # :flag.case + --verbose | -v) + + # :flag.case_no_arg + args['--verbose']=1 + shift + ;; + + # :flag.case + --input) + + # :flag.case_arg + if [[ -n ${2+x} ]]; then + + args['--input']="$2" + shift + shift + else + printf "%s\n" "--input requires an argument: --input INPUT" >&2 + exit 1 + fi + ;; + + -?*) + printf "invalid option: %s\n" "$key" >&2 + exit 1 + ;; + + *) + # :command.parse_requirements_case + # :command.parse_requirements_case_simple + printf "invalid argument: %s\n" "$key" >&2 + exit 1 + + ;; + + esac + done + + # :command.required_flags_filter + if [[ -z ${args['--subject']+x} ]]; then + printf "missing required flag: --subject SUBJECT\n" >&2 + exit 1 + fi + + # :command.default_assignments + [[ -n ${args['--input']:-} ]] || args['--input']="-" + + # :command.user_filter + filter_error=$(filter_not_mdc_environment) + if [[ -n $filter_error ]]; then + echo "$filter_error" >&2 + exit 1 + fi + + filter_error=$(filter_schema_registry_running) + if [[ -n $filter_error ]]; then + echo "$filter_error" >&2 + exit 1 + fi + +} + # :command.parse_requirements playground_debug_parse_requirements() { # :command.fixed_flags_filter @@ -21808,6 +22040,7 @@ run() { "get-properties") playground_get_properties_command ;; "schema") playground_schema_command ;; "schema get") playground_schema_get_command ;; + "schema register") playground_schema_register_command ;; "debug") playground_debug_command ;; "debug install-vscode-extension") playground_debug_install_vscode_extension_command ;; "debug enable-remote-debugging") playground_debug_enable_remote_debugging_command ;; diff --git a/scripts/cli/playground.json b/scripts/cli/playground.json index 309c40cc9..3f6839ad7 100644 --- a/scripts/cli/playground.json +++ b/scripts/cli/playground.json @@ -651,7 +651,7 @@ "subcommands": [ { "name": "get", - "description": "🔰 Get all schemas versions for all subjects\n", + "description": "🔰 Get all schemas versions for specified subject (if --subject is not specified, all subjects will be used)\n", "usage": "playground schema get [OPTIONS]", "options": [ { @@ -659,7 +659,36 @@ "--subject" ], "argument": "SUBJECT", - "description": "📛 Subject\n" + "description": "📛 Subject name\n" + } + ] + }, + { + "name": "register", + "description": "⏺️ Register a schema in specified subject\n", + "usage": "playground schema register [OPTIONS]", + "options": [ + { + "names": [ + "--subject" + ], + "argument": "SUBJECT", + "description": "📛 Subject name\n\nRequired: ✓ Yes\n" + }, + { + "names": [ + "--verbose", + "-v" + ], + "argument": "", + "description": "🐞 Show command being ran.\n" + }, + { + "names": [ + "--input" + ], + "argument": "INPUT", + "description": "🔥 You can either:\n\n* Set your own schema (avro, json-schema, protobuf) with stdin (see example section). \n\n* Use completion to select predefined schemas (or use your own schema file) 🎓 Tip: use completion to trigger fzf completion\n\nDefault value: -\n" } ] } diff --git a/scripts/cli/playground.yaml b/scripts/cli/playground.yaml index 98a526c56..d096330fe 100644 --- a/scripts/cli/playground.yaml +++ b/scripts/cli/playground.yaml @@ -840,14 +840,46 @@ subcommands: subcommands: - name: get description: | - 🔰 Get all schemas versions for all subjects + 🔰 Get all schemas versions for specified subject (if --subject is not specified, all subjects will be used) usage: playground schema get [OPTIONS] options: - names: - --subject argument: SUBJECT description: | - 📛 Subject + 📛 Subject name + + - name: register + description: | + ⏺️ Register a schema in specified subject + usage: playground schema register [OPTIONS] + options: + - names: + - --subject + argument: SUBJECT + description: | + 📛 Subject name + + Required: ✓ Yes + + - names: + - --verbose + - -v + argument: "" + description: | + 🐞 Show command being ran. + + - names: + - --input + argument: INPUT + description: | + 🔥 You can either: + + * Set your own schema (avro, json-schema, protobuf) with stdin (see example section). + + * Use completion to select predefined schemas (or use your own schema file) 🎓 Tip: use completion to trigger fzf completion + + Default value: - - name: debug description: | diff --git a/scripts/cli/src/bashly.yml b/scripts/cli/src/bashly.yml index 5534719bb..0e564bc96 100644 --- a/scripts/cli/src/bashly.yml +++ b/scripts/cli/src/bashly.yml @@ -672,12 +672,12 @@ commands: commands: - name: get - group: Kafka + group: Schema filters: - not_mdc_environment - schema_registry_running help: |- - 🔰 Get all schemas versions for all subjects + 🔰 Get all schemas versions for specified subject (if --subject is not specified, all subjects will be used) flags: - &subject long: --subject @@ -686,11 +686,86 @@ commands: completions: - $(playground get-subject-list) help: |- - 📛 Subject + 📛 Subject name examples: - playground schema get - playground schema get --subject + - name: register + group: Schema + filters: + - not_mdc_environment + - schema_registry_running + help: |- + ⏺️ Register a schema in specified subject + flags: + - long: --subject + required: true + arg: subject + completions: + - $(playground get-subject-list) + help: |- + 📛 Subject name + - &verbose + long: --verbose + short: -v + help: 🐞 Show command being ran. + - long: --input + arg: input + completions: + - $(playground get-predefined-schemas "$cur") + default: "-" + required: false + help: |- + 🔥 You can either: + + * Set your own schema (avro, json-schema, protobuf) with stdin (see example section). + + * Use completion to select predefined schemas (or use your own schema file) 🎓 Tip: use completion to trigger fzf completion + examples: | + playground schema register --subject test-protobuf << 'EOF' + syntax = "proto3"; + + package com.github.vdesabou; + + message Customer { + int64 count = 1; + string first_name = 2; + string last_name = 3; + string address = 4; + } + EOF + + playground schema register --subject test-avro << 'EOF' + { + "type": "record", + "namespace": "com.github.vdesabou", + "name": "Customer", + "fields": [ + { + "name": "count", + "type": "long", + "doc": "count" + }, + { + "name": "first_name", + "type": "string", + "doc": "First Name of Customer" + }, + { + "name": "last_name", + "type": "string", + "doc": "Last Name of Customer" + }, + { + "name": "address", + "type": "string", + "doc": "Address of Customer" + } + ] + } + EOF + - name: debug expose: true group: Debug @@ -1136,10 +1211,7 @@ commands: help: |- 📥 Consume topic from beginning flags: - - &verbose - long: --verbose - short: -v - help: 🐞 Show command being ran. + - *verbose - *topic - long: --max-messages arg: max-messages diff --git a/scripts/cli/src/schema_register_command.sh b/scripts/cli/src/schema_register_command.sh new file mode 100644 index 000000000..b505be7e7 --- /dev/null +++ b/scripts/cli/src/schema_register_command.sh @@ -0,0 +1,63 @@ +subject="${args[--subject]}" +schema="${args[--input]}" +verbose="${args[--verbose]}" + +ret=$(get_sr_url_and_security) + +sr_url=$(echo "$ret" | cut -d "@" -f 1) +sr_security=$(echo "$ret" | cut -d "@" -f 2) + +tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) +#trap 'rm -rf $tmp_dir' EXIT +#log "tmp_dir is $tmp_dir" +schema_file=$tmp_dir/value_schema + +if [ "$schema" = "-" ] +then + schema_content=$(cat "$schema") + echo "$schema_content" > $schema_file +else + if [[ $schema == @* ]] + then + # this is a schema file + argument_schema_file=$(echo "$schema" | cut -d "@" -f 2) + cp $argument_schema_file $schema_file + elif [ -f $schema ] + then + cp $schema $schema_file + else + schema_content=$schema + echo "$schema_content" > $schema_file + fi +fi + +if grep -q "proto3" $schema_file +then + log "🔮 schema was identified as protobuf" + schema_type=PROTOBUF +elif grep -q "\"type\"\s*:\s*\"object\"" $schema_file +then + log "🔮 schema was identified as json schema" + schema_type=JSON +elif grep -q "\"type\"\s*:\s*\"record\"" $schema_file +then + log "🔮 schema was identified as avro" + schema_type=AVRO +else + logerror "❌ no known schema could be identified" + exit 1 +fi + +json="{\"schemaType\":\"$schema_type\"}" + +content=$(cat $schema_file | tr -d '\n' | tr -s ' ') +json_new=$(echo $json | jq --arg content "$content" '. + { "schema": $content }') + +log "⏺️ Registering schema to subject ${subject}" +if [[ -n "$verbose" ]] +then + set -x +fi +curl $sr_security --request POST -s "${sr_url}/subjects/${subject}/versions" \ + --header 'Content-Type: application/vnd.schemaregistry.v1+json' \ + --data "$json_new" | jq .