mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-13 06:50:08 +01:00
better output for pycalver grep
This commit is contained in:
parent
8ab1644962
commit
b466ca9d39
2 changed files with 52 additions and 30 deletions
|
|
@ -401,7 +401,7 @@ def _parse_raw_config(ctx: ProjectContext) -> RawConfig:
|
|||
return raw_cfg
|
||||
|
||||
|
||||
def parse(ctx: ProjectContext) -> MaybeConfig:
|
||||
def parse(ctx: ProjectContext, cfg_missing_ok: bool = False) -> MaybeConfig:
|
||||
"""Parse config file if available."""
|
||||
if ctx.config_filepath.exists():
|
||||
try:
|
||||
|
|
@ -411,15 +411,17 @@ def parse(ctx: ProjectContext) -> MaybeConfig:
|
|||
logger.warning(f"Couldn't parse {ctx.config_rel_path}: {str(ex)}")
|
||||
return None
|
||||
else:
|
||||
logger.warning(f"File not found: {ctx.config_rel_path}")
|
||||
if not cfg_missing_ok:
|
||||
logger.warning(f"File not found: {ctx.config_rel_path}")
|
||||
return None
|
||||
|
||||
|
||||
def init(
|
||||
project_path: typ.Union[str, pl.Path, None] = "."
|
||||
project_path: typ.Union[str, pl.Path, None] = ".",
|
||||
cfg_missing_ok: bool = False,
|
||||
) -> typ.Tuple[ProjectContext, MaybeConfig]:
|
||||
ctx = init_project_ctx(project_path)
|
||||
cfg = parse(ctx)
|
||||
cfg = parse(ctx, cfg_missing_ok)
|
||||
return (ctx, cfg)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue