Skip to content

Commit 0bb6c2f

Browse files
committed
Fix getting config from git config
Currently the CLI will store to the Config object values from the argument parsing regardless of whether they are None or not. But if config.xxx is created, even with a None value the __getattr__ will never get called and thus will never lookup the git config value. The fix is to only store non-None values from the argument parsing to the Config object.
1 parent 063f130 commit 0bb6c2f

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

‎git_pw/shell.py‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@click.group()
1717
@click.option(
1818
'--debug',
19-
default=False,
19+
default=None,
2020
is_flag=True,
2121
help="Output more information about what's going on.",
2222
)
@@ -65,7 +65,7 @@
6565
)
6666
@click.version_option()
6767
def cli(
68-
debug: bool,
68+
debug: bool | None,
6969
token: str | None,
7070
username: str | None,
7171
password: str | None,
@@ -97,12 +97,18 @@ def cli(
9797
"""
9898
logger.configure_verbosity(debug)
9999

100-
CONF.debug = debug
101-
CONF.token = token
102-
CONF.username = username
103-
CONF.password = password
104-
CONF.server = server
105-
CONF.project = project
100+
if debug is not None:
101+
CONF.debug = debug
102+
if token is not None:
103+
CONF.token = token
104+
if username is not None:
105+
CONF.username = username
106+
if password is not None:
107+
CONF.password = password
108+
if server is not None:
109+
CONF.server = server
110+
if project is not None:
111+
CONF.project = project
106112

107113

108114
@cli.group()

0 commit comments

Comments
 (0)