Restart a Python CLI

A simple snippet to restart a Python CLI from within the CLI. import os import sys import click @click.command() def cli(): click.echo("CLI is running.") # Logic that determines when to restart if click.confirm("Do you want to restart the CLI?"): click.echo("Restarting CLI...") executable = sys.executable args = sys.argv os.execv(executable, [executable] + args) else: click.echo("Exiting CLI.") if __name__ == '__main__': cli() os.execv is the system call that can replace the current process with a new one....

January 4, 2025 · 1 min

Ghostty Terminal

I got beta access to Ghostty and set it up on my MacOS (Sonoma) laptop. The terminal is nice out of the box. It has tab support and splits. The default color theme is pleasing. I still needed to adjust the configuration to make some changes to match my taste. The configuration file is located in ~/.config/ghostty/config, there is no UI based preference dialog (planned for the future). This is my config:...

November 28, 2024 · 1 min