#!/usr/bin/python

# osh
# Copyright (C) 2005 Jack Orenstein <jao@geophile.com>
#
# 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 2 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, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

import sys
import traceback

import osh.tpg
from osh.cliparser import *
import osh.core

from osh.builtins import *

args = sys.argv[1:]
if len(args) == 0:
    args.append('help')
osh.core.verbosity = 0
if args[0].startswith('-v'):
    level = args[0][2:]
    if level:
        osh.core.verbosity = int(level)
    else:
        osh.core.verbosity = 1
    args = args[1:]
command_source = SPACE.join(args)
command = parse(command_source)
command.execute()
