Skip to content

Commit

Permalink
Make outputFile optional for indy-cli scripts that require inputFile.
Browse files Browse the repository at this point in the history
Signed-off-by: Wade Barnes <[email protected]>
  • Loading branch information
WadeBarnes committed Jun 15, 2020
1 parent bca171d commit 8817959
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/manage
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ function indy-cli() {
fi
# ========================================================================

# ========================================================================
# Set default outputFile name if not specified.
# - Only for scripts that require an input file.
# ------------------------------------------------------------------------
if [[ "${@}" == *"inputFile"* ]] && [[ "${@}" != *"outputFile"* ]]; then
cmd="${@} eval echo '\${inputFile}' | envsubst"
inputPath=$(eval ${cmd})
outputPath="${inputPath%/*}/signed-${inputPath##*/}"
set -- "$@" "outputFile=${outputPath}"
fi
# ========================================================================

escapedArgs=$(echo $@ | sed "s~'~\\\'~g" | sed 's~\"~\\"~g')
cmd="${escapedArgs} envsubst < ${batchTemplate} > ${batchfile}"
eval ${cmd}
Expand Down

0 comments on commit 8817959

Please sign in to comment.