From 506f345a9d46a844c7f7e1142ea761ef1615d030 Mon Sep 17 00:00:00 2001 From: Azalea Date: Tue, 6 Jun 2023 20:05:28 -0700 Subject: [PATCH] [+] Add option to disable pride month animation Closes #134 --- hyfetch/main.py | 5 +++-- hyfetch/models.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hyfetch/main.py b/hyfetch/main.py index ee9e1bdd..f0a30234 100755 --- a/hyfetch/main.py +++ b/hyfetch/main.py @@ -379,13 +379,14 @@ def run(): if now.month == 6 and now.year not in config.pride_month_shown and os.isatty(sys.stdout.fileno()): args.june = True - if args.june: + if args.june and not config.pride_month_disable: pride_month.start_animation() print() print("Happy pride month!") print("(You can always view the animation again with `hyfetch --june`)") print() - config.pride_month_shown.append(now.year) + if now.year not in config.pride_month_shown: + config.pride_month_shown.append(now.year) config.save() # Use a custom distro diff --git a/hyfetch/models.py b/hyfetch/models.py index 22882442..6974ccae 100644 --- a/hyfetch/models.py +++ b/hyfetch/models.py @@ -18,6 +18,7 @@ class Config: backend: BackendLiteral = "neofetch" distro: str | None = None pride_month_shown: list[int] = field(default_factory=list) + pride_month_disable: bool = False @classmethod def from_dict(cls, d: dict): @@ -26,4 +27,4 @@ class Config: def save(self): CONFIG_PATH.parent.mkdir(exist_ok=True, parents=True) - CONFIG_PATH.write_text(json_stringify(self), 'utf-8') + CONFIG_PATH.write_text(json_stringify(self, indent=4), 'utf-8')