Salt: bash completion doesn't work for modules

Created on 20 Apr 2018  路  5Comments  路  Source: saltstack/salt

Description of Issue/Question

Hi,
if I try to autocomplete modules name clicking on tab nothing happens. Other thing as the options works well.

Advices?

Steps to Reproduce Issue

On shell:

salt '*' test.<tab><tab>

Versions Report

Salt Version:
           Salt: 2018.3.0

Dependency Versions:
           cffi: 1.11.5
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.1
   mysql-python: Not Installed
      pycparser: 2.18
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Aug  4 2017, 00:39:18)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.4.1708 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-693.17.1.el7.x86_64
         system: Linux
        version: CentOS Linux 7.4.1708 Core
Bug P3 severity-low

All 5 comments

was this working previously? I actually just realized we have a bash completion script here: https://github.com/saltstack/salt/blob/develop/pkg/salt.bash is this what your using?

Hi @Ch3LL,
yes is that. I remember that it worked in the previous versions but I'm not sure in which version I used it, maybe in 2016.x.x.

i've tried 2016.11.9, 2017.7.5 and 2018.30 with no luck.

ping @alekibango seems you were the original author of this completion script. Any ideas here?

iirc, the test.[tab] should be working
Sadly, as i outlined in #24390, i think the completion script needs rewrite.
by that i mean:

  • unittesting (make it possible to test it is really important here)
  • solve dynamic and slow generation of needed data (caching?, fixed data?)

    • by data i mean things like _salt_coms (salt commands), _salt_get_grains (for completion of grains)

I found bash completion and bash in general not very good for salt.
I am personally rather using python scripts and ipython, and i think i will be using more and more xonsh in future for interactive work.

if you are able to write better bash completion, please try doing it. look here for inspiration about unittesting.

fixed on PR #49483

Was this page helpful?
0 / 5 - 0 ratings