55"""Handles loading from command line args."""
66
77import logging
8+ import os
9+ from pathlib import Path
810import sys
911
1012import structlog
11- from pydantic import AliasChoices , Field , computed_field
13+ from pydantic import AliasChoices , DirectoryPath , Field , FilePath , PrivateAttr , computed_field
1214from pydantic_settings import BaseSettings , SettingsConfigDict
1315
1416
@@ -69,7 +71,7 @@ class Config(BaseSettings):
6971 cli_parse_args = True ,
7072 )
7173
72- output_file : str | None = Field (
74+ output_file : FilePath | None = Field (
7375 default = None ,
7476 validation_alias = _alias_choice ("output_file" ),
7577 description = "Output file path for compilation flags" ,
@@ -78,11 +80,12 @@ class Config(BaseSettings):
7880 language : str | None = Field (
7981 default = None ,
8082 validation_alias = _alias_choice ("language" ),
81- description = "Programming language to detect flags for (e.g., c, cpp, rust)" ,
83+ description = "Programming language to detect flags for "
84+ "(e.g., c, cpp, rust). Will try and automatically detect if unspecified" ,
8285 )
8386
84- build_dir : str = Field (
85- default = "." ,
87+ build_dir : DirectoryPath = Field (
88+ default = Path ( os . getcwd ()) ,
8689 validation_alias = _alias_choice ("build_dir" ),
8790 description = "Build directory to analyze" ,
8891 )
@@ -98,3 +101,4 @@ def log_level(self) -> int:
98101 def log_level_name (self ) -> str :
99102 """The current log level name."""
100103 return logging .getLevelName (self .log_level )
104+
0 commit comments