Compare commits

..

3 Commits

Author SHA1 Message Date
janishutz 72b477381f chore: more ideas 2026-05-15 17:00:41 +02:00
janishutz e8d8429bc9 feat(config): Prepare for more metadata 2026-05-15 16:58:19 +02:00
janishutz afe8d29340 feat(cli): More argument handling 2026-05-15 16:58:00 +02:00
5 changed files with 31 additions and 9 deletions
+1
View File
@@ -8,5 +8,6 @@ def add_parser(sp: ap._SubParsersAction[ap.ArgumentParser]):
dest="show", dest="show",
required=True, required=True,
) )
show_sp.add_parser("config", help="show details about your configuration. Alias of config show")
pkgs = show_sp.add_parser("pkgs", help="show details on package presets") pkgs = show_sp.add_parser("pkgs", help="show details on package presets")
pkgs.add_argument("show_pkg") pkgs.add_argument("show_pkg")
+3
View File
@@ -8,3 +8,6 @@ def config(args: argparse.Namespace, config: ArchMgrConfig):
Your config can be found at Your config can be found at
""") """)
print(config) print(config)
elif args.conf_update == "pkgs":
print("Updating config's package list")
# TODO: Config saver
+10 -2
View File
@@ -58,11 +58,15 @@ def default_config() -> ArchMgrConfig:
"font": "Comfortaa 11", "font": "Comfortaa 11",
"gtk": "Adaptive-Theme", "gtk": "Adaptive-Theme",
"qt": "gtk3", "qt": "gtk3",
"icon_theme": "candy-icons" "icon_theme": "candy-icons",
}, },
} }
requires_list: list[str] = []
source_list = {} # for each setting, in which files it appears
def load_config(file: str) -> ArchMgrConfig: def load_config(file: str) -> ArchMgrConfig:
"""Load the configuration from the specified file path """Load the configuration from the specified file path
@@ -72,6 +76,7 @@ def load_config(file: str) -> ArchMgrConfig:
Returns: Returns:
The loaded, validated and parsed config The loaded, validated and parsed config
""" """
global requires_list, source_list
# Load and validate initial config # Load and validate initial config
try: try:
loaded_conf = _load_config_file(file) loaded_conf = _load_config_file(file)
@@ -82,6 +87,9 @@ def load_config(file: str) -> ArchMgrConfig:
configuration = cast(dict[str, Any], loaded_conf) configuration = cast(dict[str, Any], loaded_conf)
requires = cast(list[str], configuration.pop("requires")) requires = cast(list[str], configuration.pop("requires"))
# Keep track of all files
requires_list += requires
conf = cast(ArchMgrConfig, configuration) conf = cast(ArchMgrConfig, configuration)
# Recursively load files # Recursively load files
+2
View File
@@ -0,0 +1,2 @@
def update_users_and_groups():
pass
+11 -3
View File
@@ -8,18 +8,26 @@
- Retrieve explicitly installed packages and remove those that are not present in goal and install those that are not present in current state - Retrieve explicitly installed packages and remove those that are not present in goal and install those that are not present in current state
# Concept for updating config automatically
1. Track which files contain the setting
2. If there are multiple and is no array, then simply overwrite the last
3. If there are multiple and is array, then remove from the file where it is present and add to last file in requires list
-> To enable this, update the loader to keep more metadata (list of all requires, list of files for each setting)
# Ideas # Ideas
- [ ] function to collect new configs - [X] function to collect new configs -> Not smart because templates
- [ ] config options for users and groups - [X] config options for users and groups
- [ ] presets for things like desktops (like Hyprland) - [ ] presets for things like desktops (like Hyprland)
- [ ] config options for the template rendering - [ ] config options for the template rendering
- [ ] config options for themes - [ ] config options for themes
- [ ] grub config - [ ] grub config
- [ ] Dynamic selection of more configs (i.e. require syntax) - [ ] Dynamic selection of more configs (i.e. require syntax)
- [ ] Own config syntax? - [X] Own config syntax? -> just use yaml
- [ ] Autocompletion - [ ] Autocompletion
- [ ] Basic arch install how? -> Probably manual (or semi-automatic) - [ ] Basic arch install how? -> Probably manual (or semi-automatic)
- [ ] Mounts? - [ ] Mounts?
- [ ] Conditional require
# REGEX # REGEX