update embedded help

This commit is contained in:
Asif Bacchus 2020-06-20 04:58:30 -06:00
parent ed367f7963
commit 432b250094

12
sri
View File

@ -30,14 +30,14 @@ displayError (){
}
scriptHelp (){
printf "\n%sUsage: %s%s %s[--help] [--sha256|--sha384|--sha512] %s--file /path/to/file1 %s[/path/to/file2 ...]%s --directory /directory/to/hash %s[--filter 'filter']%s\n\n" "$magenta" "$norm" "$scriptName" "$cyan" "$norm" "$cyan" "$norm" "$cyan" "$norm"
printf "\n%sUsage: %s%s %s[--help] [--sha256|--sha384|--sha512] %s--file '/path/to/file1 %s[/path/to/file2 ...]'%s --directory /directory/to/hash %s[--filter 'filter']%s\n\n" "$magenta" "$norm" "$scriptName" "$cyan" "$norm" "$cyan" "$norm" "$cyan" "$norm"
printf "If both '--file' and '--directory' are specified, *both* will be processed.\n\n"
printf "%s---parameters---%s\n" "$magenta" "$norm"
printf "%s-h|-?|--help%s: Show this help page\n" "$cyan" "$norm"
printf "%s-2|--sha256%s: Generate SHA256 SRI hash\n" "$cyan" "$norm"
printf "%s-3|--sha384%s: Generate SHA384 SRI hash (default)\n" "$cyan" "$norm"
printf "%s-5|--sha512%s: Generate SHA512 SRI hash\n" "$cyan" "$norm"
printf "%s-f|--file%s: Full path of the file(s) to hash. Space delimited list accepted.\n" "$cyan" "$norm"
printf "%s-f|--file%s: Full path of the file(s) to hash. Quoted space-delimited list accepted. Wildcards NOT accepted.\n" "$cyan" "$norm"
printf "%s-d|--dir|--directory%s: Hash each file within specified directory.\n" "$cyan" "$norm"
printf "%s--filter%s: Only considered when processing a directory (-d flag). Will only hash files matching this filter. Eg: '*.css', 'file*.ext'\n\n" "$cyan" "$norm"
printf "%s---examples---%s\n" "$magenta" "$norm"
@ -45,11 +45,13 @@ scriptHelp (){
printf "%s./%s -f styles.css%s\n\n" "$cyan" "$scriptName" "$norm"
printf "Generate SHA512 hash for /var/www/js/script.js:\n"
printf "%s./%s -5 --file /var/www/js/script.js%s\n\n" "$cyan" "$scriptName" "$norm"
printf "Generate default SHA384 hashes for all files in ~/webpage/css/\n"
printf "Generate default SHA384 hashes for 'script.js' and 'style.css', located in different places:\n"
printf "%s./%s -f '/var/www/js/script.js /var/www/css/style.css'%s\n\n" "$cyan" "$scriptName" "$norm"
printf "Generate default SHA384 hashes for all files in ~/webpage/css/:\n"
printf "%s./%s --directory ~/webpage/css%s\n\n" "$cyan" "$scriptName" "$norm"
printf "Generate default SHA384 hashes for all files with names starting with 'foo' within /var/www/includes/\n"
printf "Generate default SHA384 hashes for all files with names starting with 'foo' within /var/www/includes/:\n"
printf "%s./%s -d /var/www/includes --filter 'foo*'%s\n\n" "$cyan" "$scriptName" "$norm"
printf "Generate SHA256 hashes for all '.css' files in /var/www/css and 'script.js' in /var/www/js/\n"
printf "Generate SHA256 hashes for all '.css' files in /var/www/css and 'script.js' in /var/www/js/:\n"
printf "%s./%s -2 -f /var/www/js/script.js -d /var/www/css --filter '*.css'%s\n\n" "$cyan" "$scriptName" "$norm"
printf "N.B. If you copy this script to somewhere in your path, like /usr/local/bin, then you can run it like any other command without having to specify a leading path ('./' in above examples):\n"
printf "%s%s -f /var/www/css/styles.css%s\n\n" "$cyan" "$scriptName" "$norm"