@@ -78,14 +78,12 @@ def isatty(self) -> bool:
7878
7979
8080class _CreationOutput (io .StringIO ):
81- def __init__ (self , * , pretty : bool = False ) -> None :
81+ def __init__ (self ) -> None :
8282 super ().__init__ ()
83- self .pretty = pretty
84- self .checks = 0
83+ self .interactive = True
8584
8685 def isatty (self ) -> bool :
87- self .checks += 1
88- return self .pretty or self .checks == 1
86+ return self .interactive
8987
9088
9189@dataclass
@@ -151,12 +149,16 @@ def _invoke_terminal(args: list[str], *lines: str) -> _Result:
151149def _invoke_confirmed_create (
152150 args : list [str ],
153151 * lines : str ,
154- terminal_output : bool = False ,
155152 core : _FakeBitcoinCore | None = None ,
156153) -> _Result :
157154 stdin = _TTYInput ("\n " .join (lines ) + "\n " )
158- stdout = _CreationOutput (pretty = terminal_output )
155+ stdout = _CreationOutput ()
159156 stderr = io .StringIO ()
157+ selected_core = core or _FakeBitcoinCore ()
158+
159+ def connect (* _args : object , ** _kwargs : object ) -> _FakeBitcoinCore :
160+ stdout .interactive = False
161+ return selected_core
160162
161163 def confirm_card (
162164 artifact : Share | Secret ,
@@ -169,7 +171,7 @@ def confirm_card(
169171 with (
170172 patch .object (sys , "stdin" , stdin ),
171173 patch ("codex32.cli._confirm_card" , confirm_card ),
172- patch ("codex32.cli.BitcoinCore.connect" , return_value = core or _FakeBitcoinCore () ),
174+ patch ("codex32.cli.BitcoinCore.connect" , side_effect = connect ),
173175 contextlib .redirect_stdout (stdout ),
174176 contextlib .redirect_stderr (stderr ),
175177 ):
0 commit comments