Bash/ZSH completion

Issue #123 resolved
SzV created an issue

Do you plan to add completion feature?

Comments (11)

  1. Tildeslash repo owner

    That would be really cool and useful, but this is an issue for bash completion not for Monit.

  2. SzV reporter

    I was not so clear. When I type stop name <TAB> a list of services should appear. Bash/ZSH calls a special predefined option. E.g. monit completions --line="$COMP_LINE" --point="$COMP_POINT" and substitutes the whole line for $COMP_LINE and the position in $COMP_POINT Then monit should output a list of running services. For start name <TAB> a list of stopped services.

  3. Tildeslash repo owner

    A bash completion module could use monit summary to get a list of service names and their status and then expand on that list.

  4. Tildeslash repo owner

    thanks Victor :) We'll try to improve the completion support - the "monit summary" which we recommended an is used in the referred script as well, requires the monit daemon to be running.

    Alternative could be to use 'monit -vIt' which just parses the configuration file and dumps the configuration ... will see if we can find some better way which won't require post-processing the monit output for completion

  5. Tildeslash repo owner

    Fixed: Issue #123: Added a bash completion script for monit command-line. The script is not installed by default, if you want to enable the bash completion for monit, copy system/bash/monit file to /etc/bash_completion.d/ directory or similar (depends on your bash installation).

    → <<cset f6350aedd579>>

  6. Tildeslash repo owner

    created a bash completion script ... it supports all monit commands, detects if sudo is necessary, supports service groups completion for the "-g" option

  7. Log in to comment