Skip to content

Commit e0025f1

Browse files
authored
Update main.py
1 parent 3626f30 commit e0025f1

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

hackerc/main.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ def init_command(file_path, verbose=False):
129129
f.write(template)
130130
console.print(Panel(f"Initialized template at {file_path}", title="Init Mode", border_style="bold green"))
131131
if verbose:
132-
console.print(Syntax(template, "hacker", theme="dracula", line_numbers=True))
132+
try:
133+
console.print(Syntax(template, "bash", theme="dracula", line_numbers=True))
134+
except ImportError:
135+
console.print(template)
133136
return True
134137
except Exception as e:
135138
console.print(f"[bold red]Initialization failed: {e}[/bold red]")
@@ -217,8 +220,7 @@ def help_command(show_banner=True):
217220
table.add_row(cmd, desc, args)
218221
console.print(table)
219222
console.print("\nSyntax Highlight Example:")
220-
console.print(Syntax(
221-
"""// sudo
223+
example_code = """// sudo
222224
# network-utils
223225
@USER=admin
224226
=2 > echo $USER
@@ -228,12 +230,11 @@ def help_command(show_banner=True):
228230
> sudo apt update
229231
[
230232
Config=Example
231-
]""",
232-
"hacker",
233-
theme="dracula",
234-
line_numbers=True,
235-
background_color="default"
236-
))
233+
]"""
234+
try:
235+
console.print(Syntax(example_code, "bash", theme="dracula", line_numbers=True, background_color="default"))
236+
except ImportError:
237+
console.print(example_code)
237238

238239
def main():
239240
ensure_hacker_dir()

0 commit comments

Comments
 (0)