#!/bin/bash
#
# show commands for show tech-support 
#
# July 2016, Neil McGill
#
# Copyright (c) 2016 by cisco Systems, Inc.
# All rights reserved.
#

. /pkg/bin/show_tech_main_fragment

__cardtype="unspecified"

# Parse the arguments to the script.
while [ "$#" -gt "0" ]; do
    case "$1" in
        -t) __cardtype="$2"; shift 2;;
        *)  default_parser_function "$@"; shift $#;;
    esac
done

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

if [ "$__cardtype" == "unspecified" ]; then
    __cardtype=`node_type`
fi

# Commands that run once per system
sys_exec[1]="show running-config"
sys__ksh[1]='nvgen -c -l 1 -t 1 -i1 -o 1'
sys_exec[2]="show install active"
sys__ksh[2]='sdr_instcmd show install active'
sys_exec[3]="show redundancy"
sys__ksh[3]='redcon_show'
sys_exec[4]="show logging"
sys__ksh[4]='show_logging'
sys_exec[5]="show ztp log"
sys__ksh[5]='ztp_show_log.py'
sys_exec[6]="show ztp tech-support"
sys__ksh[6]='ztp_show_tech.py'

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

    if [ "$__cardtype" == "SYS" ]; then
        exec_commands sys
        exec_commands admin
    fi

    print_main_heading "show tech-support ztp complete"
}

# Run the appropriate function depending on the node specified and if a
# file is specified write the output to that file. We need to redirect
# stderr to stdout when writing to a file because some of the show
# commands output to stderr instead of stdout
. /pkg/bin/show_tech_file_fragment
