Skip to content

Add --quiet and --simple-prompt command line arguments #39901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/sage/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ def main() -> int:
default=False,
help="print additional information",
)
parser.add_argument(
"-q",
"--quiet",
action="store_true",
default=False,
help="do not display the banner",
)
parser.add_argument(
"--simple-prompt",
action="store_true",
default=False,
help="use simple prompt IPython mode",
)

VersionCmd.extend_parser(parser)
JupyterNotebookCmd.extend_parser(parser)
Expand Down
9 changes: 6 additions & 3 deletions src/sage/cli/interactive_shell_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ def run(self) -> int:
"""
# Display startup banner. Do this before anything else to give the user
# early feedback that Sage is starting.
from sage.misc.banner import banner

banner()
if not self.options.quiet:
from sage.misc.banner import banner
banner()

from sage.repl.interpreter import SageTerminalApp

app = SageTerminalApp.instance()
if self.options.simple_prompt:
app.config['InteractiveShell']['simple_prompt'] = True
app.config['InteractiveShell']['colors'] = 'nocolor'
app.initialize([])
return app.start() # type: ignore
6 changes: 6 additions & 0 deletions src/sage/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ class CliOptions:
"""Indicates whether verbose output is enabled."""
verbose: bool = False

"""Indicates whether the banner should be displayed."""
quiet: bool = False

"""Indicates whether the IPython simple prompt should be used."""
simple_prompt: bool = False

"""The notebook type to start."""
notebook: str = "jupyter"

Expand Down
Loading