#!python
# gir2rst - Create Sphinx documentation from GIR files
# Copyright (C) 2012 Matthias Vogelgesang
#
# 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/>.

import sys
import gir2rst.formatter


def usage():
    print "Usage: gir2rst FILE1.gir [FILE2.gir ...]"
    sys.exit()


if __name__ == '__main__':
    if len(sys.argv) == 1:
        usage()

    try:
        for filename in sys.argv[1:]:
            formatter = gir2rst.formatter.RstCFormatter(filename, sys.stdout)
            formatter.write_rst()
    except IOError:
        usage()
