#!/usr/bin/env python
#

"""
gmenu: execute menu operation
"""

import sys

from optparse import OptionParser

import gtermapi

usage = "usage: %prog <menu1> <menu2> ... [on/off]"
parser = OptionParser(usage=usage)

(options, args) = parser.parse_args()

if not args:
    sys.exit(0)

if args[-1].lower() in ("on", "off", "true", "false"):
    value = args[-1].lower() in ("on", "true")
    args = args[:-1]
else:
    value = None

if not args:
    sys.exit(0)

target = "_".join(args)

gtermapi.menu_op(target, value)
    
