Add YAPF style + ignore, and format tracked Python files
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from typing import List, Dict, Any
|
||||
|
||||
from cmdlet._shared import Cmdlet, CmdletArg
|
||||
from config import load_config, save_config
|
||||
from SYS.config import load_config, save_config
|
||||
|
||||
CMDLET = Cmdlet(
|
||||
name=".config",
|
||||
@@ -9,16 +9,24 @@ CMDLET = Cmdlet(
|
||||
usage=".config [key] [value]",
|
||||
arg=[
|
||||
CmdletArg(
|
||||
name="key", description="Configuration key to update (dot-separated)", required=False
|
||||
name="key",
|
||||
description="Configuration key to update (dot-separated)",
|
||||
required=False
|
||||
),
|
||||
CmdletArg(
|
||||
name="value",
|
||||
description="New value for the configuration key",
|
||||
required=False
|
||||
),
|
||||
CmdletArg(name="value", description="New value for the configuration key", required=False),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
def flatten_config(
|
||||
config: Dict[str, Any], parent_key: str = "", sep: str = "."
|
||||
) -> List[Dict[str, Any]]:
|
||||
def flatten_config(config: Dict[str,
|
||||
Any],
|
||||
parent_key: str = "",
|
||||
sep: str = ".") -> List[Dict[str,
|
||||
Any]]:
|
||||
items = []
|
||||
for k, v in config.items():
|
||||
if k.startswith("_"): # Skip internal keys
|
||||
@@ -126,9 +134,8 @@ def _run(piped_result: Any, args: List[str], config: Dict[str, Any]) -> int:
|
||||
value = " ".join(args[1:])
|
||||
|
||||
# Remove quotes if present
|
||||
if (value.startswith('"') and value.endswith('"')) or (
|
||||
value.startswith("'") and value.endswith("'")
|
||||
):
|
||||
if (value.startswith('"') and value.endswith('"')) or (value.startswith("'")
|
||||
and value.endswith("'")):
|
||||
value = value[1:-1]
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user