Skip to content

Commit 70d4bf7

Browse files
feat: print logo when --version (#50)
1 parent 9f43044 commit 70d4bf7

File tree

1 file changed

+55
-48
lines changed

1 file changed

+55
-48
lines changed

src/mcpm/cli.py

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,67 @@
3030
CONTEXT_SETTINGS = dict(help_option_names=[])
3131

3232

33+
def print_logo():
34+
# Create bold ASCII art with thicker characters for a more striking appearance
35+
logo = [
36+
" ███╗ ███╗ ██████╗██████╗ ███╗ ███╗ ",
37+
" ████╗ ████║██╔════╝██╔══██╗████╗ ████║ ",
38+
" ██╔████╔██║██║ ██████╔╝██╔████╔██║ ",
39+
" ██║╚██╔╝██║██║ ██╔═══╝ ██║╚██╔╝██║ ",
40+
" ██║ ╚═╝ ██║╚██████╗██║ ██║ ╚═╝ ██║ ",
41+
" ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ",
42+
"",
43+
f"v{__version__}",
44+
"Open Source. Forever Free.",
45+
"Built with ❤️ by Path Integral Institute",
46+
]
47+
48+
# Define terminal width for centering
49+
terminal_width = 80 # Standard terminal width
50+
51+
# Print separator line
52+
console.print("[bold cyan]" + "=" * terminal_width + "[/]")
53+
54+
# Calculate base padding for ASCII art
55+
base_padding = " " * ((terminal_width - len(logo[0])) // 2)
56+
57+
# Center the ASCII art (except last line)
58+
for i in range(5): # First 5 lines of the ASCII art
59+
console.print(f"{base_padding}[bold green]{logo[i]}[/]")
60+
61+
# Print last line with version, using the same base padding
62+
version_text = f"v{__version__}"
63+
console.print(f"{base_padding}[bold green]{logo[5]}[/] [bold yellow]{version_text}[/]")
64+
65+
# Center the taglines
66+
tagline1 = logo[8] # "Open Source. Forever Free."
67+
tagline2 = logo[9] # "Built with ❤️ by Path Integral Institute"
68+
69+
# Calculate center padding for each tagline
70+
tagline1_padding = " " * ((terminal_width - len(tagline1)) // 2)
71+
tagline2_padding = " " * ((terminal_width - len(tagline2)) // 2)
72+
73+
# Print centered taglines
74+
console.print(tagline1_padding + "[bold magenta]" + tagline1 + "[/]")
75+
console.print(tagline2_padding + "[bold cyan]" + tagline2 + "[/]")
76+
77+
# Print separator line
78+
console.print("[bold cyan]" + "=" * terminal_width + "[/]")
79+
80+
3381
@click.group(context_settings=CONTEXT_SETTINGS, invoke_without_command=True)
3482
@click.option("-h", "--help", "help_flag", is_flag=True, help="Show this message and exit.")
35-
@click.version_option(version=__version__)
83+
@click.option("-v", "--version", is_flag=True, help="Show version and exit.")
3684
@click.pass_context
37-
def main(ctx, help_flag):
85+
def main(ctx, help_flag, version):
3886
"""MCPM - Model Context Protocol Manager.
3987
4088
A tool for managing MCP servers across various clients.
4189
"""
90+
if version:
91+
print_logo()
92+
return
93+
4294
# Check if a command is being executed (and it's not help, no command, or the client command)
4395
if ctx.invoked_subcommand and ctx.invoked_subcommand != "client" and not help_flag:
4496
# Check if active client is set
@@ -61,52 +113,7 @@ def main(ctx, help_flag):
61113
# Get active client
62114
active_client = client_config_manager.get_active_client()
63115

64-
# Create bold ASCII art with thicker characters for a more striking appearance
65-
logo = [
66-
" ███╗ ███╗ ██████╗██████╗ ███╗ ███╗ ",
67-
" ████╗ ████║██╔════╝██╔══██╗████╗ ████║ ",
68-
" ██╔████╔██║██║ ██████╔╝██╔████╔██║ ",
69-
" ██║╚██╔╝██║██║ ██╔═══╝ ██║╚██╔╝██║ ",
70-
" ██║ ╚═╝ ██║╚██████╗██║ ██║ ╚═╝ ██║ ",
71-
" ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ",
72-
"",
73-
f"v{__version__}",
74-
"Open Source. Forever Free.",
75-
"Built with ❤️ by Path Integral Institute",
76-
]
77-
78-
# Define terminal width for centering
79-
terminal_width = 80 # Standard terminal width
80-
81-
# Print separator line
82-
console.print("[bold cyan]" + "=" * terminal_width + "[/]")
83-
84-
# Calculate base padding for ASCII art
85-
base_padding = " " * ((terminal_width - len(logo[0])) // 2)
86-
87-
# Center the ASCII art (except last line)
88-
for i in range(5): # First 5 lines of the ASCII art
89-
console.print(f"{base_padding}[bold green]{logo[i]}[/]")
90-
91-
# Print last line with version, using the same base padding
92-
version_text = f"v{__version__}"
93-
console.print(f"{base_padding}[bold green]{logo[5]}[/] [bold yellow]{version_text}[/]")
94-
95-
# Center the taglines
96-
tagline1 = logo[8] # "Open Source. Forever Free."
97-
tagline2 = logo[9] # "Built with ❤️ by Path Integral Institute"
98-
99-
# Calculate center padding for each tagline
100-
tagline1_padding = " " * ((terminal_width - len(tagline1)) // 2)
101-
tagline2_padding = " " * ((terminal_width - len(tagline2)) // 2)
102-
103-
# Print centered taglines
104-
console.print(tagline1_padding + "[bold magenta]" + tagline1 + "[/]")
105-
console.print(tagline2_padding + "[bold cyan]" + tagline2 + "[/]")
106-
107-
# Print separator line
108-
console.print("[bold cyan]" + "=" * terminal_width + "[/]")
109-
116+
print_logo()
110117
# Get information about installed clients
111118
from mcpm.clients.client_registry import ClientRegistry
112119

0 commit comments

Comments
 (0)