#!/bin/bash
# -----------------------------------------------------------------------------
# show_tech_shelf_mgr         
#                                       
# Copyright (c) 2012-2013 by cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------------------

#
# Load the script provided by show-tech infra, which provides worker functions
#
source /opt/cisco/calvados/script/show_tech_main_fragment

#
# Parse the arguments to the script - card type and interface filter are the 
# only support options currently.  No need to use the default parser function,
# as this has been done by caller.
#
__cardtype="unspecified"
trace_only="0"
show_only="0"
arg_string=""
showtech_argv=""
showtech_argc="0"

while [ "$#" -gt "0" ]; do
    case "$1" in
        -T) trace_only="1"; shift 1;;
        -S) show_only="1"; shift 1;;
        -t) __cardtype="$2"; shift 2;;
        *) showtech_argv="$showtech_argv $1"; (( showtech_argc+=1 )); shift 1;;
    esac
done

#
# Call the showtech infra default parser - using set to recreate the $#, $@, 
# etc. - "--" is necessary so set doesn't try to interpret any of the 
# arguments we are passing through!
#
if [[ $showtech_argc -ne 0 ]]; then
    set -- $showtech_argv
    default_parser_function $@
fi

if [ "$trace_only" != "0" ]; then
    arg_string="$arg_string -T"
fi

if [ "$show_only" != "0" ]; then
    arg_string="$arg_string -S"
fi

if [ "$__filename" = "unspecified" ]; then
    echo "$0: output file not specified"
    exit
fi

if [ "$__cardtype" = "unspecified" ]; then
    __cardtype=`/opt/cisco/calvados/script/node_type`
fi

arg_string="$arg_string -t $__cardtype"

display() {
    print_main_heading "show tech-support shelf_mgr"

    run_module tech_shelf_mgr "$arg_string"
        
    print_main_heading "show tech-support shelf_mgr complete"
}        

#
# This function calls the display() function and sends the output to file if
# the file option has been set. 
#
source /opt/cisco/calvados/script/show_tech_file_fragment

