projectdiscovery/alterx

[feature] Add tab to autocomplete file name

Opened this issue · 2 comments

While using -pp param it would be useful to have the tab autocomplete function to load the file name.

For instance, I want to use the file brute.force.txt into the param word here:

alterx -p '{{word}}.{{suffix}}' -pp word=brute.force.txt

I think that's because the shell knows when to autocomplete paths usually when they come right after a command or flag. The shell treats "word=brute.for<TAB>" as a single string, so it doesn’t recognize it as a path that needs completing because it's mixed with other text ("word=").

For the workaround, you can set up a simple custom completion script for alterx to handle completions:

# if you're using Bash :)
_alterx_custom_completion() {
    local cur

    cur="${COMP_WORDS[COMP_CWORD]}"
    COMPREPLY=( $(compgen -f -- "$cur") )
}

complete -F _alterx_custom_completion alterx

Thank you.

Works good. But doing source .bashrc gave me a different result than closing the terminal and opening it again.