浏览代码

[+] Run command

Azalea (on HyDEV-Daisy) 3 年之前
父节点
当前提交
86ad1b5ad2
共有 2 个文件被更改,包括 11 次插入4 次删除
  1. 10 3
      hyfetch/main.py
  2. 1 1
      hyfetch/neofetch_util.py

+ 10 - 3
hyfetch/main.py

@@ -8,6 +8,7 @@ from typing import Literal, Iterable
 
 from hypy_utils import printc, json_stringify
 
+from .neofetch_util import run_neofetch
 from .presets import PRESETS
 
 
@@ -110,13 +111,19 @@ def create_config() -> Config:
     tmp = PRESETS['rainbow'].color_text('preset')
     preset = literal_input(f'Which {tmp} do you want to use?', PRESETS.keys(), 'rainbow')
 
-    # Save and return
+    # Create config
     c = Config(preset, color_system)
-    c.save()
+
+    # Save config
+    save = literal_input(f'Save config?', ['y', 'n'], 'y')
+    if save == 'y':
+        c.save()
+
     return c
 
 
 def run():
     parser = argparse.ArgumentParser(description='neofetch with flags <3')
+    # TODO: Param overwrite config
     config = check_config()
-    # TODO: --setup command
+    run_neofetch(PRESETS.get(config.preset))

+ 1 - 1
hyfetch/neofetch_util.py

@@ -27,7 +27,7 @@ def get_distro_ascii() -> str:
     return check_output([get_command_path(), "print_ascii"]).decode().strip()
 
 
-def run(preset: ColorProfile):
+def run_neofetch(preset: ColorProfile):
     # Get existing ascii
     asc = get_distro_ascii()