#!/bin/bash
# dev/package/search - Package Search Support

set -e

lib_load 'dev/package/files'


######
# Native Dependencies

dev_package_search_client_packages=( )
dev_package_search_server_packages=( )


######
# Library Configuration

# dev_package_search_config_init() - Defines, documents, and initializes
# library settings.
dev_package_search_config_init() {
	# $package_grep_file_kind - Kind of files that grep should search.
	# Default: `sources`
	lib_setting_vars package_grep_file_kind
	package_grep_file_kind=${package_grep_file_kind:-sources}
}

# dev_package_search_config_check() - Initializes remaining library
# settings and validates their values.
dev_package_search_config_check() {
	: debug "dev_package_search_config_check called"
}


######
# Package Search CLI

# package_search_usage() - Prints the package search command usage
package_search_usage() {
	cat <<USAGE
...
Package Search Commands:
USAGE
}


######
# Source File Introspection

# package_wc() - Runs ``wc`` with all of the package source files,
# because real programmers measure their progress by line count.
# Furthermore, all code comments are 100% accurate and precise.
package_wc() {
	max_args 1 "$@"
	local kind=${1:-sources}
	package_file_kind_valid "$kind"

	with_package_files $kind run wc
}

# package_grep() - Runs ``grep`` on the kind of package files specifed
# by ``$package_grep_file_kind``.
# $@ - Passed diretly to ``grep``.
package_grep() {
	local kind=$package_grep_file_kind
	package_file_kind_valid "$kind" \
		|| error "\$package_grep_file_kind: invalid file kind"
	with_package_files $kind run grep --color=auto -n -e "$@"
}

View the Developer Guide Index

View the Reference Manual Index


Generated on Sat Jul 8 19:40:42 PDT 2017 by mcsh d14 v0.22.0.