#!/usr/bin/env python
#
# This file is part of PyWake.
# 
# PyWake 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.
# 
# PyWake 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 PyWake.  If not, see <http://www.gnu.org/licenses/>.

from pywake import PyWake

if __name__ == '__main__':
    import argparse
    parser = argparse.ArgumentParser(description='PyWOL - Wake-On-LAN client')
    parser.add_argument('mac', metavar='MAC', help='MAC address for "magic packet"')
    parser.add_argument('-s', '--src', '--source', dest='src_ip',
            help='source IP address to bind to')
    parser.add_argument('-d', '--dst', '--destination', dest='dst_ip',
            help='destination IP address')
    parser.add_argument('-p', '--port', dest='port', type=int, default=9,
            help='target UDP port (default: 9)')
    group = parser.add_mutually_exclusive_group()
    group.add_argument('-4', '--ipv4', dest='ipv', action='store_const', const=4)
    group.add_argument('-6', '--ipv6', dest='ipv', action='store_const', const=6, default=None)
    pywol = PyWake(None)
    parser.parse_args(namespace=pywol)
    pywol.send_packet()

