App-PFT

 view release on metacpan or  search on metacpan

bash_completion.d/pft  view on Meta::CPAN

_pft_init()
{
    local alt="$(
        perl -CO -MPFT::Conf=bash_completion_autogen -wE 'say bash_completion_autogen'
    )"
    COMPREPLY=($(compgen -W "$alt" -- "${COMP_WORDS[COMP_CWORD]}"))
}

_pft_edit()
{
    local cur="${COMP_WORDS[COMP_CWORD]}"
    local common_opts='-t --author --select --back --resume
                       --year --month --day --help'
    local alt

    case "${COMP_WORDS[COMP_CWORD - 1]}" in
        '--editor')
            alt="$EDITOR vim emacs"
            ;;
        '-t'|'--tag'|'-T')
            alt="$(pft ls tags --pretty='%s')"
            ;;
        '-P')
            alt="$(pft ls pages --pretty='%s')"
            ;;
        '-B'|'-M')
            alt="$common_opts"
            ;;
        '--back'|'--year'|'-y'|'--month'|'-m'|'--day'|'-d')
            # Supposed to be numeric, no suggestion
            ;;
        *)
            alt="-B -M -T -P $common_opts"
            ;;
    esac

    COMPREPLY=($(compgen -W "$alt" -- "$cur"))
}

_pft_grab()
{
    local alt

    case "${COMP_WORDS[COMP_CWORD - 1]}" in
        '--rename'|'--year'|'-y'|'--month'|'-m'|'--day'|'-d')
            # No suggestion for name or numerics.
            ;;
        *)
            alt='--today --picture --rename --year --month --day --help'
            ;;
    esac

    COMPREPLY=($(compgen -W "$alt" -- "${COMP_WORDS[COMP_CWORD]}"))
}

_pft_show()
{
    case "${COMP_WORDS[COMP_CWORD - 1]}" in
        '--browser')
            local browsers="firefox chromium chrome lynx elinks"
            COMPREPLY=($(compgen -W "$browsers" -- "${COMP_WORDS[COMP_CWORD]}"))
            ;;
        *)
            local opts='--browser --help'



( run in 0.525 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )