diff --git a/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/HscCommand.groovy b/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/HscCommand.groovy
index 9d68d6de..6e97a7d6 100644
--- a/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/HscCommand.groovy
+++ b/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/HscCommand.groovy
@@ -13,8 +13,8 @@ import picocli.CommandLine.Parameters
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
-import java.util.logging.Formatter
import java.util.logging.ConsoleHandler
+import java.util.logging.Formatter
import java.util.logging.Level
import java.util.logging.LogManager
import java.util.logging.LogRecord
@@ -98,6 +98,7 @@ class HscCommand implements Runnable {
File[] srcDocs
static void main(String[] args) {
+
HscRunner hscRunner = new HscRunner()
HscCommand hscCommand = new HscCommand(hscRunner)
CommandLine cmd = new CommandLine(hscCommand)
diff --git a/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/Main.groovy b/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/Main.groovy
deleted file mode 100644
index 16703cf6..00000000
--- a/htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli/Main.groovy
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.aim42.htmlsanitycheck.cli
-
-import org.aim42.htmlsanitycheck.AllChecksRunner
-import org.aim42.htmlsanitycheck.Configuration
-import org.aim42.htmlsanitycheck.check.AllCheckers
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
-import picocli.CommandLine
-import picocli.CommandLine.Parameters
-import picocli.CommandLine.Command
-import picocli.CommandLine.Option
-
-import java.nio.file.Files
-import java.nio.file.Path
-import java.nio.file.Paths
-
-// see end-of-file for license information
-
-@Command(name = "hsc", mixinStandardHelpOptions = true, version = "hsc 2.0.0",
- description = "Check HTML files for Sanity")
-class Main implements Runnable {
- private static final Logger logger = LoggerFactory.getLogger(Main.class)
-
- MainRunner runner
-
- Main() {
- Main(new MainRunner())
- }
-
- Main(MainRunner runner) {
- this.runner = runner
- }
-
- @Option(names = ["-r", "--resultsDir"], description = "Results Directory")
- String resultsDirectoryName = "/tmp/results"
-
- @Parameters(arity = "1", description = "base directory", index = "0")
- File srcDir
-
- @Parameters(arity = "0..*", description = "at least one File", index = "1..*")
- File[] files
-
- static void main(String[] args) {
- MainRunner runner = new MainRunner()
- Main app = new Main(runner)
- CommandLine cmd = new CommandLine(app)
- runner.setMain(app)
- runner.setCmd(cmd)
- cmd.execute(args)
- }
-
- private static List findFiles(File directory) throws IOException {
- Files.walk(Paths.get(directory.getPath()))
- .filter(Files::isRegularFile)
- .filter({ path -> path.toString().endsWith(".html") || path.toString().endsWith(".htm")})
- .collect { it.toFile() }
- }
-
- void run() {
- var configuration = new Configuration()
-
- var resultsDirectory = new File(resultsDirectoryName)
-
- configuration.addConfigurationItem(Configuration.ITEM_NAME_sourceDir, srcDir)
- configuration.addConfigurationItem(Configuration.ITEM_NAME_sourceDocuments,
- files ?: findFiles(srcDir)
- )
- configuration.addConfigurationItem((Configuration.ITEM_NAME_checkingResultsDir), resultsDirectory)
-
- if (configuration.isValid()) {
- // create output directory for checking results
- resultsDirectory.mkdirs()
-
- // create an AllChecksRunner...
- var allChecksRunner = new AllChecksRunner(configuration)
-
- // ... and perform the actual checks
- var allChecks = allChecksRunner.performAllChecks()
-
- // check for findings and fail build if requested
- var nrOfFindingsOnAllPages = allChecks.nrOfFindingsOnAllPages()
- logger.debug("Found ${nrOfFindingsOnAllPages} error(s) on all checked pages")
- }
- }
- }
-
- void run() {
- runner.run()
- }
-}
-
-/*========================================================================
- Copyright Gerd Aschemann and aim42 contributors
-
- Licensed under the Apache License, Version 2.0 (the "License")
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an
- "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ========================================================================*/
diff --git a/htmlSanityCheck-cli/src/test/groovy/org/aim42/htmlsanitycheck/cli/MainCliSpec.groovy b/htmlSanityCheck-cli/src/test/groovy/org/aim42/htmlsanitycheck/cli/MainCliSpec.groovy
deleted file mode 100644
index 96ae0f69..00000000
--- a/htmlSanityCheck-cli/src/test/groovy/org/aim42/htmlsanitycheck/cli/MainCliSpec.groovy
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.aim42.htmlsanitycheck.cli
-
-
-import picocli.CommandLine
-import spock.lang.Specification
-import spock.lang.Unroll
-
-class MainCliSpec extends Specification {
-
- Main.MainRunner myAppRunner = Mock(Main.MainRunner)
-
- @Unroll
- def "test hsc with #args"() {
- given:
- def cmdLine = new CommandLine(new Main(myAppRunner))
-
- when:
- def exitCode = cmdLine.execute(args.split())
-
- then:
- exitCode == expectedExitCode
- (runnerWasCalled ? 1 : 0) * myAppRunner.run()
-
- where:
- args | expectedExitCode | runnerWasCalled
- "-h" | 0 | false
- "--help" | 0 | false
- "-V" | 0 | false
- "--version" | 0 | false
- "" | 0 | true
- "." | 0 | true
- "-r /tmp/results" | 0 | true
- "--resultsDir /tmp/results" | 0 | true
- }
-}