redundant
[dumbwifi.git] / scanwifi
blob956fca8896882924278230befbaadbb1aa88a63b
1 #!/usr/bin/env python
3 # Author: Martin Matusiak <numerodix@gmail.com>
4 # Licensed under the GNU Public License, version 3.
6 from conf import config
7 import opts
8 import ui
11 def init():
12 ui.init_routine()
13 process_opts()
16 def process_opts():
17 p = opts.create_parser()
18 p.add_option("-i", "--interface", dest="interface", action="append",
19 metavar="iface", help="Prefer this interface")
20 p.add_option("-t", "--timeout", dest="timeout", action="store",
21 metavar="s", help="Scan for this many seconds, then exit")
22 opts.read_opts(p)
25 def main():
26 init()
28 # determine interface
29 iface = config.interfaces.get_top(pred=lambda x: x.medium == "wireless")
31 # get timeout
32 timeout = int(config.opts.get('timeout', -1))
34 ui.curse(iface.interface, timeout)
38 if __name__ == "__main__":
39 main()