CLI Options¶
Configuration options for CLI commands and mock device behavior.
Options controls serial port, baud rate, and output formatting, while MockOptions configures the mock device's event generation.
Options¶
kazunoko.options.Options
¶
Centralized typer.Option definitions for device communication commands
Example
import typer
from kazunoko.options import Options
app = typer.Typer()
@app.command()
def status(port: str = Options.port(), verbose: bool = Options.verbose()):
"""Show device status"""
# Command implementation
pass
@app.command()
def read(
event: int = typer.Argument(...),
port: str = Options.port(),
format: str = Options.format(),
):
"""Read detection events"""
# Command implementation
pass
Source code in src/kazunoko/options.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 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 | |
event_timeout(default=5.0)
staticmethod
¶
Event reception timeout option (seconds)
Source code in src/kazunoko/options.py
116 117 118 119 120 121 122 123 124 | |
format(default='jsonl')
staticmethod
¶
Output format option (table, jsonl, json, csv, ssv, tsv, ltsv)
Source code in src/kazunoko/options.py
83 84 85 86 87 88 89 90 91 92 93 | |
log_level(default='error')
staticmethod
¶
Logging level option (debug, info, success, warning, error)
Source code in src/kazunoko/options.py
139 140 141 142 143 144 145 146 147 148 | |
pattern(default)
staticmethod
¶
Glob pattern option for filtering files
Source code in src/kazunoko/options.py
150 151 152 153 154 155 156 157 | |
poll_count(default=10)
staticmethod
¶
Poll count option for device configuration
Source code in src/kazunoko/options.py
126 127 128 129 130 131 132 133 134 135 136 | |
port()
staticmethod
¶
Serial port option (default: auto-detection)
Source code in src/kazunoko/options.py
52 53 54 55 56 57 58 59 60 | |
timeout(default=0.1)
staticmethod
¶
Serial communication timeout option (seconds)
Source code in src/kazunoko/options.py
62 63 64 65 66 67 68 69 70 | |
use_event(default=True)
staticmethod
¶
Event count vs duration option
Source code in src/kazunoko/options.py
107 108 109 110 111 112 113 114 | |
use_flat(default=True)
staticmethod
¶
Flattened structure option
Source code in src/kazunoko/options.py
95 96 97 98 99 100 101 102 103 104 105 | |
verbose()
staticmethod
¶
Verbose console output option (for user-facing status messages)
Source code in src/kazunoko/options.py
72 73 74 75 76 77 78 79 80 | |
MockOptions¶
kazunoko.options.MockOptions
¶
Centralized typer.Option definitions for mock device and testing
Example
import typer
from kazunoko.options import MockOptions
app = typer.Typer()
@app.command()
def generate(
count: int = MockOptions.generate_count(),
speed: float = MockOptions.speed(),
jitter: float = MockOptions.jitter(),
seed: int | None = MockOptions.seed(),
):
"""Generate mock detection events"""
# Command implementation
pass
Source code in src/kazunoko/options.py
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 | |
generate_count()
staticmethod
¶
Count option for generate command
Source code in src/kazunoko/options.py
192 193 194 195 196 197 | |
jitter()
staticmethod
¶
Event timing jitter option
Source code in src/kazunoko/options.py
206 207 208 209 210 211 | |
mock()
staticmethod
¶
Mock device option for testing
Source code in src/kazunoko/options.py
184 185 186 187 188 189 | |
seed()
staticmethod
¶
Random seed option for reproducibility
Source code in src/kazunoko/options.py
213 214 215 216 217 218 | |
speed()
staticmethod
¶
Event generation speed option (0.01-100x)
Source code in src/kazunoko/options.py
199 200 201 202 203 204 | |