Skip to content

Commit fcc8a8b

Browse files
committed
fixup! 492fd69
1 parent 492fd69 commit fcc8a8b

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

docs/git-draft.1.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ If a bot needs more information, its question will be persisted and displayed wh
6666
Set bot name.
6767
The default is to use the first bot defined in the configuration.
6868

69+
-o OPTION::
70+
--bot-option=OPTION::
71+
Set bot option.
72+
Each option has the format `<key>[=<value>]` (if the value is omitted, it will default to true).
73+
This will override any option set in configuration files.
74+
6975
-e::
7076
--edit::
7177
Enable interactive editing of draft prompts and templates.

tests/git_draft/bots/__init___test.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99

1010
class FakeBot(sut.Bot):
11-
pass
11+
def __init__(self, key: str="default", switch: bool=False) -> None:
12+
self.key = key
13+
self.switch = switch
1214

1315

1416
class TestLoadBot:
@@ -20,8 +22,17 @@ def import_module(name):
2022
monkeypatch.setattr(importlib, "import_module", import_module)
2123

2224
config = BotConfig(factory="fake_module:FakeBot")
23-
bot = sut.load_bot(config)
24-
assert isinstance(bot, FakeBot)
25+
26+
bot0 = sut.load_bot(config)
27+
assert isinstance(bot0, FakeBot)
28+
assert bot0.key == "default"
29+
assert not bot0.switch
30+
31+
bot1 = sut.load_bot(config, overrides=["key=one", "switch"])
32+
assert isinstance(bot1, FakeBot)
33+
assert bot1.key == "one"
34+
assert bot1.switch
35+
2536

2637
def test_non_existing_factory(self) -> None:
2738
config = BotConfig("git_draft:unknown_factory")

0 commit comments

Comments
 (0)