Files
swift-inotify/Sources/TaskCLI/Global Options.swift
T. R. Bernstein 541b9d68a0
Some checks failed
Docs / docs (push) Has been cancelled
Docs / deploy (push) Has been cancelled
Use Shwift library instead of Subprocess
Shwift has a concise API, which makes writing shell code nice and easy.
This is an opinionated decision.
2026-03-20 21:44:05 +01:00

26 lines
470 B
Swift

import Script
import Logging
struct GlobalOptions: ParsableArguments {
@Flag(
name: .short,
help: "Increase logging verbosity. Use -v, -vv, or -vvv."
)
var verbose: Int
var logLevel: Logger.Level {
switch verbose {
case 0: return .notice
case 1: return .info
case 2: return .debug
default: return .trace
}
}
func makeLogger(labeled label: String) -> Logger {
var logger = Logger(label: label)
logger.logLevel = logLevel
return logger
}
}