the inbuilt terminal kinda works now, .gitignore files also have syntax highlighting now
This commit is contained in:
@@ -12,5 +12,6 @@ theme_mappings = {
|
|||||||
"go": "go",
|
"go": "go",
|
||||||
"sh": "bash",
|
"sh": "bash",
|
||||||
"yaml": "yaml",
|
"yaml": "yaml",
|
||||||
"md": "markdown"
|
"md": "markdown",
|
||||||
|
"gitignore": "markdown"
|
||||||
}
|
}
|
||||||
8
main.py
8
main.py
@@ -51,9 +51,17 @@ class Berry(App):
|
|||||||
|
|
||||||
yield Footer()
|
yield Footer()
|
||||||
|
|
||||||
|
def on_input_submitted(self, event: Input.Submitted):
|
||||||
|
if event.input.id != "console-input":
|
||||||
|
return
|
||||||
|
|
||||||
|
self.run_command(event.input.value)
|
||||||
|
event.input.clear()
|
||||||
|
|
||||||
def run_command(self, command: str):
|
def run_command(self, command: str):
|
||||||
console = self.query_one("#console")
|
console = self.query_one("#console")
|
||||||
|
|
||||||
|
console.write(f"> {command}")
|
||||||
result = subprocess.check_output(command, shell=True, text=True)
|
result = subprocess.check_output(command, shell=True, text=True)
|
||||||
console.write(result)
|
console.write(result)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user