33# SPDX-License-Identifier: AGPL-3.0
44
55import logging
6+ import os
7+ from pathlib import Path
68import sys
79
810import structlog
9- from pydantic import AliasChoices , Field , PrivateAttr , computed_field
11+ from pydantic import AliasChoices , DirectoryPath , Field , FilePath , PrivateAttr , computed_field
1012from pydantic_settings import BaseSettings , SettingsConfigDict
1113
1214
@@ -67,7 +69,7 @@ class Config(BaseSettings):
6769 cli_parse_args = True ,
6870 )
6971
70- output_file : str | None = Field (
72+ output_file : FilePath | None = Field (
7173 default = None ,
7274 validation_alias = _alias_choice ("output_file" ),
7375 description = "Output file path for compilation flags" ,
@@ -76,11 +78,12 @@ class Config(BaseSettings):
7678 language : str | None = Field (
7779 default = None ,
7880 validation_alias = _alias_choice ("language" ),
79- description = "Programming language to detect flags for (e.g., c, cpp, rust)" ,
81+ description = "Programming language to detect flags for "
82+ "(e.g., c, cpp, rust). Will try and automatically detect if unspecified" ,
8083 )
8184
82- build_dir : str = Field (
83- default = "." ,
85+ build_dir : DirectoryPath = Field (
86+ default = Path ( os . getcwd ()) ,
8487 validation_alias = _alias_choice ("build_dir" ),
8588 description = "Build directory to analyze" ,
8689 )
@@ -96,3 +99,4 @@ def log_level(self) -> int:
9699 def log_level_name (self ) -> str :
97100 """The current log level name."""
98101 return logging .getLevelName (self .log_level )
102+
0 commit comments