diff options
author | Shaun McCance <shaunm@gnome.org> | 2011-04-30 12:49:16 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2011-04-30 12:49:16 -0400 |
commit | fdac61ce0e48c21b9633f0eeb96cb5cc5213542e (patch) | |
tree | a1dafee78f3fdff83520c61cac6a038ef32cf337 | |
parent | a942850ac0f5fdd6c929acf193382cbbaad82b73 (diff) | |
download | yelp-tools-fdac61ce0e48c21b9633f0eeb96cb5cc5213542e.tar.gz |
tools: Improvements to --help output
-rwxr-xr-x | tools/yelp-build.in | 3 | ||||
-rwxr-xr-x | tools/yelp-check.in | 36 |
2 files changed, 36 insertions, 3 deletions
diff --git a/tools/yelp-build.in b/tools/yelp-build.in index 4053ae6..fce6718 100755 --- a/tools/yelp-build.in +++ b/tools/yelp-build.in @@ -97,6 +97,9 @@ yelp_usage_cache () { echo " Create a Mallard cache file from the page files FILES." echo " If FILES contains directories, all .page files in those" echo " directories will be used." + echo "" + echo "Options:" + echo " -o OUT Output cache to the file OUT" ) 1>&2 } yelp_usage_html () { diff --git a/tools/yelp-check.in b/tools/yelp-check.in index ca0cb74..1d135d2 100755 --- a/tools/yelp-check.in +++ b/tools/yelp-check.in @@ -61,6 +61,9 @@ yelp_usage_orphans () { echo " Locate orphaned pages among <FILES> in a Mallard document." echo " Orphaned pages are any pages that cannot be reached by" echo " topic links alone from the index page." + echo "" + echo "Options:" + echo " -c CACHE Use the existing Mallard cache CACHE" ) 1>&2 } @@ -105,6 +108,10 @@ yelp_links_page () { } yelp_links () { + if [ "$#" = "0" -o "x$1" = "x--help" ]; then + yelp_usage_links + exit 1 + fi while [ "$#" != "0" ]; do case "$1" in "-c") @@ -165,8 +172,29 @@ yelp_orphans_page () { } yelp_orphans () { - check_cache_file=`mktemp` - yelp-build cache -o "$check_cache_file" "$@" + if [ "$#" = "0" -o "x$1" = "x--help" ]; then + yelp_usage_orphans + exit 1 + fi + while [ "$#" != "0" ]; do + case "$1" in + "-c") + shift + check_cache_file="$1" + shift + ;; + *) + break + ;; + esac + done + if [ "x$check_cache_file" != "x" ]; then + check_cache_file=`(cd $(dirname "$check_cache_file") && pwd)`/`basename "$check_cache_file"` + else + check_cache_file_is_tmp="yes" + check_cache_file=`mktemp` + yelp-build cache -o "$check_cache_file" "$@" + fi for xml in "$@"; do if [ -d "$xml" ]; then for page in "$xml"/*.page; do @@ -176,7 +204,9 @@ yelp_orphans () { yelp_orphans_page "$xml" fi done - rm "$check_cache_file" + if [ "x$check_cache_file_is_tmp" = "xyes" ]; then + rm "$check_cache_file" + fi } cmd="$1" |