File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 88import sys
99import typing
1010
11- from rich import print
11+ from rich . console import Console
1212
1313import re3data
1414from re3data ._client import ReturnType
2121 logger .error ("`typer` is missing. Please run 'pip install python-re3data[cli]' to use the CLI." )
2222 sys .exit (1 )
2323
24+ console = Console ()
25+
2426CONTEXT_SETTINGS = {"help_option_names" : ["-h" , "--help" ]}
2527
2628app = typer .Typer (no_args_is_help = True , context_settings = CONTEXT_SETTINGS )
@@ -33,8 +35,8 @@ def _version_callback(show_version: bool) -> None:
3335 from re3data import __version__
3436
3537 if show_version :
36- typer . echo ( f" { __version__ } " )
37- raise typer .Exit
38+ console . print ( __version__ )
39+ raise typer .Exit ( code = 0 )
3840
3941
4042@app .callback (context_settings = CONTEXT_SETTINGS )
@@ -57,11 +59,11 @@ def callback(
5759def list_repositories (return_type : ReturnType = ReturnType .xml ) -> None :
5860 """List the metadata of all repositories in the re3data API."""
5961 response = re3data .repositories .list (return_type = return_type .value )
60- print (response )
62+ console . print (response )
6163
6264
6365@repositories_app .command ("get" )
6466def get_repository (repository_id : str , return_type : ReturnType = ReturnType .xml ) -> None :
6567 """Get the metadata of a specific repository."""
6668 response = re3data .repositories .get (repository_id , return_type = return_type .value )
67- print (response )
69+ console . print (response )
You can’t perform that action at this time.
0 commit comments