Skip to content

Commit 290b70b

Browse files
committed
Renamed silent_startup_script to silence_startup_script for clarity
1 parent bdd8316 commit 290b70b

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Removed `--silent` flag from `alias/macro create` since startup scripts can be run silently.
1717
* Removed `--with_silent` flag from `alias/macro list` since startup scripts can be run silently.
1818
* Removed `with_argparser_and_unknown_args` since it was deprecated in 1.3.0.
19+
* Renamed `silent_startup_script` to `silence_startup_script` for clarity.
1920
* Replaced `cmd2.Cmd.completion_header` with `cmd2.Cmd.formatted_completions`. See Enhancements
2021
for description of this new class member.
2122
* Settables now have new initialization parameters. It is now a required parameter to supply the reference to the

cmd2/cmd2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def __init__(
219219
persistent_history_file: str = '',
220220
persistent_history_length: int = 1000,
221221
startup_script: str = '',
222-
silent_startup_script: bool = False,
222+
silence_startup_script: bool = False,
223223
include_py: bool = False,
224224
include_ipy: bool = False,
225225
allow_cli_args: bool = True,
@@ -241,8 +241,8 @@ def __init__(
241241
:param persistent_history_length: max number of history items to write
242242
to the persistent history file
243243
:param startup_script: file path to a script to execute at startup
244-
:param silent_startup_script: if ``True``, then the startup script's output will be
245-
suppressed. Anything written to stderr will still display.
244+
:param silence_startup_script: if ``True``, then the startup script's output will be
245+
suppressed. Anything written to stderr will still display.
246246
:param include_py: should the "py" command be included for an embedded Python shell
247247
:param include_ipy: should the "ipy" command be included for an embedded IPython shell
248248
:param allow_cli_args: if ``True``, then :meth:`cmd2.Cmd.__init__` will process command
@@ -398,7 +398,7 @@ def __init__(
398398
startup_script = os.path.abspath(os.path.expanduser(startup_script))
399399
if os.path.exists(startup_script):
400400
script_cmd = f"run_script {utils.quote_string(startup_script)}"
401-
if silent_startup_script:
401+
if silence_startup_script:
402402
script_cmd += f" {constants.REDIRECTION_OUTPUT} {os.devnull}"
403403
self._startup_commands.append(script_cmd)
404404

docs/features/startup_commands.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ This text file should contain a :ref:`Command Script
6565
<features/scripting:Command Scripts>`. See the AliasStartup_ example for a
6666
demonstration.
6767

68-
You can silence a startup script's output by setting ``silent_startup_script``
68+
You can silence a startup script's output by setting ``silence_startup_script``
6969
to True::
7070

71-
cmd2.Cmd.__init__(self, startup_script='.cmd2rc', silent_startup_script=True)
71+
cmd2.Cmd.__init__(self, startup_script='.cmd2rc', silence_startup_script=True)
7272

7373
Anything written to stderr will still print. Additionally, a startup script
7474
cannot be silenced if ``allow_redirection`` is False since silencing works

tests/test_cmd2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,17 +2667,17 @@ def test_disabled_message_command_name(disable_commands_app):
26672667
assert err[0].startswith('has_helper_funcs is currently disabled')
26682668

26692669

2670-
@pytest.mark.parametrize('silent_startup_script', [True, False])
2671-
def test_startup_script(request, capsys, silent_startup_script):
2670+
@pytest.mark.parametrize('silence_startup_script', [True, False])
2671+
def test_startup_script(request, capsys, silence_startup_script):
26722672
test_dir = os.path.dirname(request.module.__file__)
26732673
startup_script = os.path.join(test_dir, '.cmd2rc')
2674-
app = cmd2.Cmd(allow_cli_args=False, startup_script=startup_script, silent_startup_script=silent_startup_script)
2674+
app = cmd2.Cmd(allow_cli_args=False, startup_script=startup_script, silence_startup_script=silence_startup_script)
26752675
assert len(app._startup_commands) == 1
26762676
app._startup_commands.append('quit')
26772677
app.cmdloop()
26782678

26792679
out, err = capsys.readouterr()
2680-
if silent_startup_script:
2680+
if silence_startup_script:
26812681
assert not out
26822682
else:
26832683
assert out

0 commit comments

Comments
 (0)