3
3
4
4
from . import __version__
5
5
from .utils import DebugOption , VerboseOption , QuietOption , verbose_args_processor
6
+
6
7
logger = logging .getLogger ('base' )
7
8
8
9
9
10
cli_base = typer .Typer (
10
- no_args_is_help = True ,
11
- rich_markup_mode = 'rich' ,
12
- context_settings = {
13
- 'help_option_names' : ['-h' , '--help' , 'help' ]
14
- }
11
+ no_args_is_help = True ,
12
+ rich_markup_mode = 'rich' ,
13
+ context_settings = {'help_option_names' : ['-h' , '--help' , 'help' ]},
15
14
)
16
15
17
16
@@ -21,19 +20,19 @@ def version_callback(value: bool):
21
20
raise typer .Exit ()
22
21
23
22
24
- @cli_base .callback (invoke_without_command = True )
23
+ @cli_base .callback (invoke_without_command = True )
25
24
def callback (
26
25
version : bool = typer .Option (
27
- None , '--version' ,
28
- callback = version_callback ,
29
- help = 'Get the current installed version' ,
30
- is_eager = True
26
+ None ,
27
+ '--version' ,
28
+ callback = version_callback ,
29
+ help = 'Get the current installed version' ,
30
+ is_eager = True ,
31
31
),
32
-
33
32
debug : bool = DebugOption ,
34
33
verbose : bool = VerboseOption ,
35
- quiet : bool = QuietOption
36
- ):
34
+ quiet : bool = QuietOption ,
35
+ ):
37
36
"""
38
37
[b]Thread CLI[/b]\b \n
39
38
[white]Use thread from the terminal![/white]
@@ -45,20 +44,17 @@ def callback(
45
44
verbose_args_processor (debug , verbose , quiet )
46
45
47
46
48
-
49
47
# Help and Others
50
- @cli_base .command (rich_help_panel = 'Help and Others' )
48
+ @cli_base .command (rich_help_panel = 'Help and Others' )
51
49
def help ():
52
50
"""Get [yellow]help[/yellow] from the community. :question:"""
53
51
typer .echo ('Feel free to search for or ask questions here!' )
54
52
try :
55
53
logger .info ('Attempting to open in web browser...' )
56
54
57
55
import webbrowser
58
- webbrowser .open (
59
- 'https://github.com/python-thread/thread/issues' ,
60
- new = 2
61
- )
56
+
57
+ webbrowser .open ('https://github.com/python-thread/thread/issues' , new = 2 )
62
58
typer .echo ('Opening in web browser!' )
63
59
64
60
except Exception as e :
@@ -67,17 +63,16 @@ def help():
67
63
typer .echo ('https://github.com/python-thread/thread/issues' )
68
64
69
65
70
-
71
- @cli_base .command (rich_help_panel = 'Help and Others' )
66
+ @cli_base .command (rich_help_panel = 'Help and Others' )
72
67
def docs ():
73
68
"""View our [yellow]documentation.[/yellow] :book:"""
74
69
typer .echo ('Thanks for using Thread, here is our documentation!' )
75
70
try :
76
71
logger .info ('Attempting to open in web browser...' )
77
72
import webbrowser
73
+
78
74
webbrowser .open (
79
- 'https://github.com/python-thread/thread/blob/main/docs/command-line.md' ,
80
- new = 2
75
+ 'https://github.com/python-thread/thread/blob/main/docs/command-line.md' , new = 2
81
76
)
82
77
typer .echo ('Opening in web browser!' )
83
78
@@ -87,18 +82,15 @@ def docs():
87
82
typer .echo ('https://github.com/python-thread/thread/blob/main/docs/command-line.md' )
88
83
89
84
90
-
91
- @cli_base .command (rich_help_panel = 'Help and Others' )
85
+ @cli_base .command (rich_help_panel = 'Help and Others' )
92
86
def report ():
93
87
"""[yellow]Report[/yellow] an issue. :bug:"""
94
88
typer .echo ('Sorry you run into an issue, report it here!' )
95
89
try :
96
90
logger .info ('Attempting to open in web browser...' )
97
91
import webbrowser
98
- webbrowser .open (
99
- 'https://github.com/python-thread/thread/issues' ,
100
- new = 2
101
- )
92
+
93
+ webbrowser .open ('https://github.com/python-thread/thread/issues' , new = 2 )
102
94
typer .echo ('Opening in web browser!' )
103
95
104
96
except Exception as e :
@@ -107,11 +99,10 @@ def report():
107
99
typer .echo ('https://github.com/python-thread/thread/issues' )
108
100
109
101
110
-
111
102
# Utils and Configs
112
- @cli_base .command (rich_help_panel = 'Utils and Configs' )
103
+ @cli_base .command (rich_help_panel = 'Utils and Configs' )
113
104
def config (configuration : str ):
114
105
"""
115
106
[blue]Configure[/blue] the system. :wrench:
116
107
"""
117
- typer .echo ('Coming soon!' )
108
+ typer .echo ('Coming soon!' )
0 commit comments