pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[improve][cli] Add generate-completion command to admin and client

Open nodece opened this issue 1 year ago • 0 comments

Motivation

The tab-completion is an important feature, we have migrated the CLI parser to picocli from jcommander, right now we can use the picocli autocomplete to do that.

  • pulsar-admin
❯ source <(bin/pulsar-admin generate-completion)
❯ bin/pulsar-admin topics clear-backlog --subscription
--help          --subscription  --version       -h              -s              -v  
  • pulsar-client
❯ source <(bin/pulsar-client generate-completion)
❯ bin/pulsar-client produce -h
--chunking                 --files                    --key-value-key            --rate                     -db                        -h                         -kvkf                      -s                       
--disable-batching         --help                     --key-value-key-file       --separator                -dr                        -k                         -m                         -v                       
--disable-replication      --key                      --messages                 --value-schema             -ekn                       -ks                        -n                         -vs                      
--encryption-key-name      --key-schema               --num-produce              --version                  -ekv                       -kvet                      -p                                                  
--encryption-key-value     --key-value-encoding-type  --properties               -c                         -f                         -kvk                       -r  

Modifications

  • Add generate-completion command to the pulsar-admin and pulsar-client, which supports the bash and zsh

Documentation

  • [ ] doc
  • [ ] doc-required
  • [x] doc-not-needed
  • [ ] doc-complete

nodece avatar Apr 22 '24 16:04 nodece