#compdef versionah versionah.py
# coding=utf-8
# versionah - ZSH completion support for versionah
# Copyright © 2011-2014  James Rowe <jnrowe@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# Most of this file is generated from versionah/__init__.py, but feel free to
# customise it!  If you make improvements, open a pull request against
# `JNRowe/versionah' with your super changes attached.

(( $+functions[__versionah_list_filetypes] )) ||
__versionah_list_filetypes() {
    local tmp
    tmp=($(python -c 'import versionah; print " ".join(versionah.Version.filetypes)'))
    if [ -z "${tmp}" ]; then
        _message "Unable to read supported file types!"
    else
        compadd ${tmp[@]}
    fi
}

(( $+functions[__versionah_list_displaytypes] )) ||
__versionah_list_displaytypes() {
    local tmp
    tmp=($(python -c 'import versionah; print " ".join(versionah.Version.display_types())'))
    if [ -z "${tmp}" ]; then
        _message "Unable to read supported display types!"
    else
        compadd ${tmp[@]}
    fi
}

_arguments '--help[show help message and exit]' \
    "--version[show program's version number and exit]" \
    ':versionah command:(bump display set)' \
    '*::subcmd:->subcmd' && return 0

### DGEN_TAG: Generated from versionah/__init__.py {{{
case "$words[1]" in
(bump)
    _arguments '--help[show help message and exit]' \
        '--display=[display output in format]:select type:__versionah_list_displaytypes' \
        '--type=[define the file type used for version file]:select type:__versionah_list_filetypes' \
        '1:select file:_files' \
        '2:select type:(major minor micro patch)'
    ;;
(set)
    _arguments '--help[show help message and exit]' \
        '--display=[display output in format]:select type:__versionah_list_displaytypes' \
        '--type=[define the file type used for version file]:select type:__versionah_list_filetypes' \
        '--name=[package name for version]' \
        '1:select file:_files' \
        '2:set version: '
    ;;
(display)
    _arguments '--help[show help message and exit]' \
        '--display=[display output in format]:select type:__versionah_list_displaytypes' \
        '*:select file:_files'
    ;;
(*)
    ;;
esac
### DGEN_TAG: Generated from versionah/__init__.py }}}
