module

Deadfinder::Completion

Shell completion generators.

The OptionParser block in cli.cr is the single source of truth for the CLI surface; FLAGS below mirrors it. The entries store the raw parser.on(...) arguments rather than pre-split names so that teaching the completions about a new flag is a copy-paste of that line, and spec/deadfinder/completion_spec.cr scrapes the parser back out of the source to fail loudly the moment the two drift apart.

Constants

FISH_VALUE_ARGS = {"--concurrency" => "(seq 1 100)", "--timeout" => "(seq 1 60)", "--output_format" => OUTPUT_FORMATS.join(" ")}

Value suggestions fish offers after an option, keyed by long name. A value starting with ( is a fish command substitution evaluated when the user hits TAB; the numeric ranges are hints, not limits — the parser accepts any integer.

FLAGS = [Flag.new("-r", "--include30x", "Include 30x redirections"), Flag.new("-c CONCURRENCY", "--concurrency=CONCURRENCY", "Number of concurrency (default: 50)"), Flag.new(nil, "--target-concurrency=N", "Number of targets scanned in parallel; total in-flight requests stay capped at -c (default: 10)"), Flag.new("-t TIMEOUT", "--timeout=TIMEOUT", "Timeout in seconds (default: 10)"), Flag.new(nil, "--method=METHOD", "Link check method: auto, head, get (default: auto). auto sends HEAD first and re-checks with GET on any 4xx/5xx (405/501 included), so no link is reported dead on a HEAD status alone. A HEAD that never reached the host is not re-checked"), Flag.new(nil, "--retry=N", "Retry a transient failure N times: connection error, timeout, 429 or 5xx. A 404 is never retried (default: 2)"), Flag.new(nil, "--delay=MS", "Minimum milliseconds between two requests to the same host; other hosts are unaffected (default: 0)"), Flag.new(nil, "--accept-status=LIST", "Treat these statuses as alive, e.g. '200,204,403,999' or '400-499'. Wins over --dead-status and over the built-in >= 400 rule"), Flag.new(nil, "--dead-status=LIST", "Treat these statuses as dead, e.g. '500-599'. Applied after --accept-status and before the built-in rule"), Flag.new(nil, "--exclude-status=LIST", "Alias of --dead-status"), Flag.new("-o OUTPUT", "--output=OUTPUT", "File to write result"), Flag.new("-f FORMAT", "--output_format=FORMAT", "Output format: json, yaml, toml, csv, sarif (default: json)"), Flag.new("-H HEADER", "--headers=HEADER", "Custom HTTP headers for initial request"), Flag.new(nil, "--worker_headers=HEADER", "Custom HTTP headers for worker requests"), Flag.new(nil, "--user_agent=UA", "User-Agent string"), Flag.new("-p PROXY", "--proxy=PROXY", "Proxy server"), Flag.new(nil, "--proxy_auth=CREDS", "Proxy authentication (user:pass)"), Flag.new("-k", "--insecure", "Skip TLS certificate verification (not recommended)"), Flag.new("-m PATTERN", "--match=PATTERN", "Match URL pattern"), Flag.new("-i PATTERN", "--ignore=PATTERN", "Ignore URL pattern"), Flag.new("-s", "--silent", "Silent mode"), Flag.new("-v", "--verbose", "Verbose mode"), Flag.new(nil, "--debug", "Debug mode"), Flag.new(nil, "--limit=N", "Limit number of URLs to scan"), Flag.new(nil, "--check-anchors", "Verify #fragment targets exist in the linked document"), Flag.new(nil, "--coverage", "Enable coverage tracking and reporting"), Flag.new("-F", "--fail-on-dead", "Exit with code 2 when any dead link or dead target is found (default: always exit 0)"), Flag.new(nil, "--visualize=PATH", "Generate visualization PNG"), Flag.new("-h", "--help", "Show help")]
OUTPUT_FORMATS = ["json", "yaml", "toml", "csv", "sarif"] of ::String

Formats accepted by --output_format. yml is also accepted by cli.cr's validation as a silent alias of yaml, so it is deliberately not offered here — one canonical spelling per format.

SHELLS = ["bash", "zsh", "fish"] of ::String

Shells accepted by completion <SHELL>.

SUBCOMMANDS = [{"pipe", "Scan the URLs from STDIN"}, {"file", "Scan the URLs from File (`-` for STDIN)"}, {"url", "Scan the Single URL"}, {"sitemap", "Scan the URLs from sitemap"}, {"completion", "Generate completion script (bash/zsh/fish)"}, {"version", "Show version"}]

Subcommands cli.cr dispatches on, with the blurb from their parser.separator lines.

Class methods

bash
Source
fish
Source

Nested types