From f03a89836eacad282532ccd1b3fd94df34ce11ab Mon Sep 17 00:00:00 2001 From: John D Pell Date: Mon, 26 Jul 2021 01:43:05 -0700 Subject: [PATCH 1/2] plugins/java: quote path && `shfmt` Provides an error message if no file is specified. --- clean_files.txt | 1 + plugins/available/java.plugin.bash | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/clean_files.txt b/clean_files.txt index 53765a5f..61ee4665 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -97,6 +97,7 @@ plugins/available/history-search.plugin.bash plugins/available/history-substring-search.plugin.bash plugins/available/history.plugin.bash plugins/available/hub.plugin.bash +plugins/available/java.plugin.bash plugins/available/jump.plugin.bash plugins/available/less-pretty-cat.plugin.bash plugins/available/node.plugin.bash diff --git a/plugins/available/java.plugin.bash b/plugins/available/java.plugin.bash index 98e46247..ce823cfe 100644 --- a/plugins/available/java.plugin.bash +++ b/plugins/available/java.plugin.bash @@ -1,11 +1,11 @@ -cite about-plugin +# shellcheck shell=bash about-plugin 'Java and JAR helper functions' function jar_manifest { - about "extracts the specified JAR file's MANIFEST file and prints it to stdout" - group 'java' - param '1: JAR file to extract the MANIFEST from' - example 'jar_manifest lib/foo.jar' + about "extracts the specified JAR file's MANIFEST file and prints it to stdout" + group 'java' + param '1: JAR file to extract the MANIFEST from' + example 'jar_manifest lib/foo.jar' - unzip -c $1 META-INF/MANIFEST.MF + unzip -c "${1?${FUNCNAME[0]}: JAR file must be specified}" META-INF/MANIFEST.MF } From 33df3a2bcdb56e056b55b06a55bfe3fbf75fef21 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Thu, 30 Dec 2021 22:35:34 -0800 Subject: [PATCH 2/2] plugin/java: show message on missing *or* blank --- plugins/available/java.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/java.plugin.bash b/plugins/available/java.plugin.bash index ce823cfe..2a80a99a 100644 --- a/plugins/available/java.plugin.bash +++ b/plugins/available/java.plugin.bash @@ -7,5 +7,5 @@ function jar_manifest { param '1: JAR file to extract the MANIFEST from' example 'jar_manifest lib/foo.jar' - unzip -c "${1?${FUNCNAME[0]}: JAR file must be specified}" META-INF/MANIFEST.MF + unzip -c "${1:?${FUNCNAME[0]}: JAR file must be specified}" META-INF/MANIFEST.MF }