topmark.cli.commands.probe¶
topmark / cli / commands / probe
TopMark probe command.
Explain how TopMark resolves files to file types and header processors.
Input modes supported
- Paths mode (default): one or more PATHS and/or
--files-from FILE. - Content on STDIN: a single
-as the sole PATH plus--stdin-filename NAME. - Lists on STDIN for ...-from: allow
--files-from -,--include-from -, or--exclude-from -(exactly one may consume STDIN).
Output model
- TEXT output is console-oriented and may use
-v/--quiet. - Markdown output is document-oriented and ignores TEXT-only verbosity/quiet controls.
- JSON/NDJSON output is machine-readable and uses the full raw result set.
Examples:
Probe files and print human-readable resolution diagnostics:
$ topmark probe src
Emit per-file objects in NDJSON (one per line):
$ topmark probe --output-format=ndjson src pkg
Read a single file's content from STDIN:
$ cat foo.py | topmark probe - --stdin-filename foo.py
Read a list of paths from STDIN:
$ git ls-files | topmark probe --files-from -
probe_command ¶
probe_command(
*,
verbosity,
quiet,
color_mode,
no_color,
strict,
no_config,
config_files,
stdin_filename,
files_from,
include_from,
exclude_from,
include_patterns,
exclude_patterns,
include_file_types,
exclude_file_types,
allow_content_probe,
output_format,
)
Run the resolution probe pipeline.
The command reads positional paths from click.get_current_context().args
(Black-style) and supports three input styles:
- Paths mode (default): PATHS and/or
--files-from FILE. - Content-on-STDIN: use
-as the sole PATH and provide--stdin-filename. - Lists-on-STDIN for one of the "...-from" options:
--files-from -,--include-from -, or--exclude-from -(exactly one may consume STDIN).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbosity
|
int
|
Increase TEXT output detail. |
required |
quiet
|
bool
|
Suppress TEXT output. |
required |
color_mode
|
ColorMode | None
|
Set the color mode (default: auto). |
required |
no_color
|
bool
|
bool: If set, disable color mode. |
required |
strict
|
bool | None
|
if True, report warnings as errors. |
required |
no_config
|
bool
|
If True, skip loading project/user configuration files. |
required |
config_files
|
list[str]
|
Additional configuration file paths to load and merge. |
required |
stdin_filename
|
str | None
|
Assumed filename when reading content from STDIN). |
required |
files_from
|
list[str]
|
Files that contain newline-delimited paths to add to the
candidate set before filtering. Use |
required |
include_from
|
list[str]
|
Files that contain include glob patterns (one per line).
Use |
required |
exclude_from
|
list[str]
|
Files that contain exclude glob patterns (one per line).
Use |
required |
include_patterns
|
list[str]
|
Glob patterns to include (intersection). |
required |
exclude_patterns
|
list[str]
|
Glob patterns to exclude (subtraction). |
required |
include_file_types
|
list[str]
|
Restrict processing to the given file type identifiers. |
required |
exclude_file_types
|
list[str]
|
Exclude processing for the given file type identifiers. |
required |
allow_content_probe
|
bool | None
|
Shared policy override controlling whether file-type resolution may consult file contents when needed. |
required |
output_format
|
OutputFormat | None
|
Output format to use ( |
required |
Exit Status
SUCCESS (0): All probed files resolved to a supported file type and processor.
UNSUPPORTED_FILE_TYPE (69): One or more files could not resolve to a supported file type
and processor.
USAGE_ERROR (64): Invalid invocation (e.g., mixing - with --files-from -).
FILE_NOT_FOUND (66): One or more specified files or directories could not be found.
PERMISSION_DENIED (77): Insufficient permissions to read or write a file.
ENCODING_ERROR (65): A file could not be decoded or encoded with the expected encoding.
IO_ERROR (74): An unexpected I/O failure occurred while writing changes.
PIPELINE_ERROR (70): An internal processing step failed.
UNEXPECTED_ERROR (255): An unhandled error occurred.
Source code in src/topmark/cli/commands/probe.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |