#!/bin/bash
# mcsh - Mandolin Creek System Helpers

set -e

source "/home/zwelch/src/mcf/mcsh-release/install/share/mcsh/mcsh.sh"

lib_load 'sys/shell'


######
# CLI

mcsh_shell() { shell_run "$@"; }
mcsh_shell_help() { shell_help; }


######
# Tools

mcsh_tool() { cmd_dispatch "$@"; }

mcsh_tool_usage() {
	cat <<USAGE
...
Tool Commands:
	list 				Prints all tools
	versions			Runs 'version' for each tool
USAGE
}

mcsh_tool_list() { tool_names; }
mcsh_tool_versions() { for_each_tool run_tool_version; }


######
# Check

mcsh_check() {
	shell_run <<EOF
!true
!app_version
quit
EOF
}

######
# Main

mcsh_desc() { echo "Mandolin Creek SHell utility"; }

mcsh_usage() {
	cat <<USAGE
<tool> <cmd> [...]
Commands:
	shell				Runs the built-in command shell
	tool ...			Commands for $package_name tools
USAGE
}

mcsh_help() {
	mcsh_usage
	local apps="${package_apps[*]}"
	[ -z "$apps" ] || cat<<HELP

The $script_name tool configures and manages settings that affect
the individual tools included in the $package_name package:

$(echo $apps | fmt --width=68 | sed -e 's,^,\t,')

See '<tool> help' for more information.
HELP
}

mcsh_dispatch() {
	if is_tool "$1"; then
		run "$@"
	else
		cmd_dispatch "$@"
	fi
}

mcsh_app_run() {
	local -a args=( "$@"  )
	[ "$*" ] || args=( shell )
	app_run "${args[@]}"
}

mcsh_app_run "$@"

View the Developer Guide Index

View the Reference Manual Index


Generated on Sat Jul 8 19:27:05 PDT 2017 by mcsh d14 v0.22.0.