Files
obitools4/autodoc/docmd/pkg/obioptions/options.md
T
Eric Coissac 8c7017a99d ⬆️ version bump to v4.5
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5"
- Update version.txt from 4.29 → .30
(automated by Makefile)
2026-04-13 13:34:53 +02:00

48 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# OBIOptions Package: Global Command-Line Interface Utilities
The `obioptions` package provides shared command-line argument parsing and runtime configuration for OBITools4 commands. It centralizes common options, logging setup, profiling controls, and taxonomy handling.
## Core Functionalities
- **Global Option Registration**: `RegisterGlobalOptions()` defines shared flags such as:
- `--version`, `--debug`
- CPU/thread control (`--max-cpu`)
- Batch processing parameters: `--batch-size`, `-size-max`, `--batch-mem`
- Quality encoding (`--solexa`)
- Warning suppression (`--silent-warning`)
- **Option Processing**: `ProcessParsedOptions()` handles post-parsing logic:
- Prints help/version and exits on request
- Loads default taxonomy via `obiformats.LoadTaxonomy()`
- Configures log level (debug/info)
- Starts `pprof` HTTP servers for performance profiling:
- Generic (`/debug/pprof`)
- Mutex contention (`--pprof-mutex`, `runtime.SetMutexProfileFraction()`)
- Goroutine blocking (`--pprof-goroutine`, `runtime.SetBlockProfileRate()`)
- **Parser Generator**: `GenerateOptionParser()` builds a reusable argument parser with:
- Bundled short options (`-abc`)
- Strict unknown-option handling
- Automatic `--help` support
## Taxonomy Integration
- `LoadTaxonomyOptionSet()` registers taxonomy-specific flags:
- Required/optional path to DB (`--taxonomy`, `-t`)
- Alternative names search (`--alternative-names`)
- Taxonomic validation: `--fail-on-taxonomy`, automatic updates via `--update-taxid`
- Raw taxID output (`--raw-taxid`)
- Leaf sequences inclusion via `--with-leaves`
## Runtime Accessors
- `CLIIsDebugMode()`, `SeqAsTaxa()` → read current state
- `SetDebugOn/Off()` → programmatic debug toggling
## Design Principles
- Environment variable support (`OBIMAXCPU`, `OBIWARNING`, etc.)
- Thread-safe taxonomy loading with mutex
- Graceful error handling (parse errors → help + exit)
- Integration with `logrus` and Gos standard profiling tools