Skip to content

Commit b918375

Browse files
authored
Merge branch 'master' into build-workflow
2 parents 9628d37 + f7e5b20 commit b918375

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

compile_flags/config.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
"""Handles loading from command line args."""
66

77
import logging
8+
import os
9+
from pathlib import Path
810
import sys
911

1012
import structlog
11-
from pydantic import AliasChoices, Field, computed_field
13+
from pydantic import AliasChoices, DirectoryPath, Field, FilePath, PrivateAttr, computed_field
1214
from 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

Comments
 (0)