Skip to content

Commit

Permalink
Merge pull request #8 from srz-zumix/feature/fix_default_input
Browse files Browse the repository at this point in the history
fix default input
  • Loading branch information
srz-zumix committed Jun 15, 2022
2 parents 1a04fc3 + 1dc75e8 commit 78abfbb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions jenkinsfile-shellcheck.groovy
Expand Up @@ -15,7 +15,7 @@ class JenkinsfileShellcheck {
static void main(String[] args) {
def cli = new CliBuilder(usage: 'jenkinsfile-shellcheck [options]')
cli.with {
i longOpt:'input', args:'+', required:false, argName:'file1,file2,...', valueSeparator:',', defaultValue:'Jenkinsfile', 'input files (default: Jenkinsfile)'
i longOpt:'input', args:'+', required:false, argName:'file1,file2,...', valueSeparator:',', 'input files (default: Jenkinsfile)'
_ longOpt:'no-expand-gstring', 'do not expand GString values'
h longOpt: 'help', 'usage information'
}
Expand All @@ -29,7 +29,11 @@ class JenkinsfileShellcheck {
if( through_index < args.size()-1 ) {
shellcheck_opts = args[through_index+1..args.size()-1].join(" ")
}
args = args[0..through_index-1]
if( through_index > 0 ) {
args = args[0..through_index-1]
} else {
args = []
}
}
def options = cli.parse(args)

Expand All @@ -41,7 +45,12 @@ class JenkinsfileShellcheck {
cli.usage()
System.exit(0)
}
for( input : options.is ) {

def inputs = options.is
if( !options.is ) {
inputs = ['Jenkinsfile']
}
for( input : inputs ) {
def jfs = new JenkinsfileShellcheck(filePath:input, noExpandGString:options.'no-expand-gstring')
println(input)
jfs.parse(input as File, shellcheck_opts)
Expand Down

0 comments on commit 78abfbb

Please sign in to comment.