Package: debian-goodies Version: 0.76 Severity: wishlist In bug report 877137 Astian <ast...@eclipso.at> has been generous enough to rewrite dman to add some nice features, including some caching capabilities.
For consideration, attached is his modified script as well as the notes on the changes introduced by it ((also available at https://paste.debian.net/988250/ and https://paste.debian.net/988249) Best regards Javier
- fix "not found" error reporting, broken in 27ac5129ce187c6f571cac25ef70553bb9c9d475 - tabs for indentation (as in the original code) where spaces creeped in - when calling commands use -- to separate options - make all global variables uppercase - remove unnecessary (default) argument to mktemp --tmpdir - replace the remaining usages of `` for command substitutions with $() syntax. backticks parse the string specially, which is less intuitive; for example, dman had the following code: MAN_ARGS=`echo "$@" | sed "s/\$PAGE$//"` here the sequence "\$" is parsed by the outer shell when scanning the string inside the backticks. this is why this code removes the expansion of variable PAGE, and not literally '$PAGE', from the end of "$@". in other words, it does the same as any of the following: MAN_ARGS=`echo "$@" | sed "s/$PAGE$//"` MAN_ARGS=$(echo "$@" | sed "s/$PAGE$//") MAN_ARGS=$(echo "$@" | sed "s/$PAGE\$//") MAN_ARGS=$(echo "$@" | sed 's/'$PAGE'$//') but not: MAN_ARGS=$(echo "$@" | sed "s/\$PAGE$//") both dash and bash behave this way, and though dash doesn't seem to mention this in its man page, bash does: When the old-style backquote form of substitution is used, backslash retains its literal meaning except when followed by $, `, or \. The first backquote not preceded by a backslash terminates the command substitution. When using the $(command) form, all characters between the parentheses make up the command; none are treated specially. - use getopt (from util-linux) to parse command line options; support options in any order - check that at least one man page name was given as argument and fail otherwise; previously the script would have used the last one and treat the previous ones as options for man - remove undocumented method for passing options to man (there's already MANOPT for this) - use literal quotes whenever a string is not meant to be expanded (even if it currently does not contain expandable stuff) - quote the argument to "rm -rf", for consistency and abundance of caution - when referring to the script itself, use the basename not its full path - fix what looks like a typo: error was going to stdout instead of stderr - remove the sequence "|| true; exit 0" in the following man $MAN_ARGS -l "$man" || true exit 0 this is at least redundant; furthermore, I don't understand the purpose - support for caching downloaded pages - dependencies removed: awk, wget dependencies added: getopt (util-linux), curl
dman_with_cache
Description: Binary data