Removing find_git_repo

This commit is contained in:
Qubasa
2023-10-25 19:23:28 +02:00
parent 0378e01cbb
commit f9b1a8fa89
11 changed files with 68 additions and 75 deletions

View File

@@ -1,6 +1,7 @@
# !/usr/bin/env python3
import argparse
import json
import logging
import os
import re
import shlex
@@ -17,6 +18,8 @@ from clan_cli.types import FlakeName
script_dir = Path(__file__).parent
log = logging.getLogger(__name__)
# nixos option type description to python type
def map_type(type: str) -> Any:
@@ -287,6 +290,7 @@ def set_option(
current_config = json.load(f)
else:
current_config = {}
# merge and save the new config file
new_config = merge(current_config, result)
settings_file.parent.mkdir(parents=True, exist_ok=True)
@@ -295,7 +299,11 @@ def set_option(
print(file=f) # add newline at the end of the file to make git happy
if settings_file.resolve().is_relative_to(specific_flake_dir(flake_name)):
commit_file(settings_file, commit_message=f"Set option {option_description}")
commit_file(
settings_file,
repo_dir=specific_flake_dir(flake_name),
commit_message=f"Set option {option_description}",
)
# takes a (sub)parser and configures it

View File

@@ -12,7 +12,7 @@ from clan_cli.dirs import (
specific_flake_dir,
specific_machine_dir,
)
from clan_cli.git import commit_file, find_git_repo_root
from clan_cli.git import commit_file
from clan_cli.nix import nix_eval
from ..types import FlakeName
@@ -82,7 +82,7 @@ def set_config_for_machine(
settings_path.parent.mkdir(parents=True, exist_ok=True)
with open(settings_path, "w") as f:
json.dump(config, f)
repo_dir = find_git_repo_root()
repo_dir = specific_flake_dir(flake_name)
if repo_dir is not None:
commit_file(settings_path, repo_dir)