#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Main Stetl program.
#
# Author: Just van den Broecke
#
from stetl.main import parse_args
from stetl.etl import ETL
from stetl.util import Util

log = Util.get_log('main')


def main():
    """The Stetl `main` program, to be called from commandline, like `stetl -c etl.cfg`.

    Args:
       -c  --config <config_file>  the Stetl config file.
       -s  --section <section_name> the section in the Stetl config (ini) file to execute (default is [etl]).
       -a  --args <arglist> substitutable args for symbolic, {arg}, values in Stetl config file, in format "arg1=foo arg2=bar" etc.

    """

    args = parse_args()

    # Do the ETL
    etl = ETL(vars(args), args.config_args)
    etl.run()


if __name__ == "__main__":
    main()
