Misleading error message when no input files are detected
Continued from markdownlint#304
markdownlint --fix '**/*.md'
When running this command in a project without any md files, it gives me confusing error:
Usage: markdownlint [options] <files|directories|globs>
MarkdownLint Command Line Interface
Options:
-h, --help output usage information
-V, --version output the version number
-f, --fix fix basic errors (does not work with STDIN)
-s, --stdin read from STDIN (does not work with files)
-o, --output [outputFile] write issues to file (no console)
-c, --config [configFile] configuration file (JSON, JSONC, JS, or YAML)
-i, --ignore [file|directory|glob] file(s) to ignore/exclude
-p, --ignore-path [file] path to file with ignore pattern(s)
-r, --rules [file|directory|glob|package] custom rule files
It was my mistake to forget to add a readme file, but I think in this case the output should be something more specific, like No valid files found. Now it suggests I entered invalid command.
+1
This same symptom occurs if the user provides a path to a specific existing file but that file is ignored via any of the ignore mechanisms.
My two cents is that either of these two situations should be a 0 exit code -- the tool has considered all 0 files and none of them had any lint issues
This is related to https://github.com/igorshubovych/markdownlint-cli/issues/370 but it seems like if the user explicity provides a path to a file to lint, and the file doesn't exist, then we should exit with 1 to indicate the error.
This same symptom occurs if the user provides a path to a specific existing file but that file is ignored via any of the ignore mechanisms.
My two cents is that either of these two situations should be a 0 exit code -- the tool has considered all 0 files and none of them had any lint issues
This totally got me and I've spent quite a bit of time trying to understand why the glob was not working.