feat: release v1.1.1 - host sorting by name/IP, sync destination overrides, and ~ expansion
Build and Publish Release / Build Packages and Publish (push) Successful in 25s

This commit is contained in:
soda64 committed 2026-10-03 22:05:00 +02:00
1 parent 598e5d7397
commit 62710d8bb7
19 files changed
+190 -34

No files matched your search

+36 -2
View File
@@ -116,6 +116,28 @@ def build_parser() -> argparse.ArgumentParser:
dest="filter_source",
help="Filter hosts by source provider (e.g. 'proxmox', 'static', 'file', 'k3s')."
)
parser.add_argument(
"--sort", "--sort-by",
dest="sort_by",
choices=["name", "ip"],
default="name",
help="Sort hosts by 'name' or 'ip' (default: name)."
)
parser.add_argument(
"-r", "--reverse",
action="store_true",
help="Reverse the sort order."
)
parser.add_argument(
"--ansible-dest",
type=Path,
help="Target output path for Ansible inventory in --sync mode (overrides config)."
)
parser.add_argument(
"--lc-dest",
type=Path,
help="Target output path for linux-connector inventory in --sync mode (overrides config)."
)
return parser
def main(argv: Optional[List[str]] = None) -> int:
@@ -205,6 +227,9 @@ def main(argv: Optional[List[str]] = None) -> int:
source=args.filter_source
)
# 4c. Sort inventory by name or IP
inv = inv.sort(sort_by=args.sort_by, reverse=args.reverse)
# 5. Inspection / Dry-run Mode
if args.dry_run:
filter_desc = []
@@ -231,8 +256,17 @@ def main(argv: Optional[List[str]] = None) -> int:
# 7. Simultaneous Synchronization Mode (--sync)
if args.sync:
ansible_dest = app_config.output_ansible or Path("inventory/hosts.yaml")
lc_dest = (app_config.output_linux_connector or Path("~/.config/linux-connector/hosts.yaml")).expanduser()
ansible_dest = (
args.ansible_dest
or (args.output if args.output else None)
or app_config.output_ansible
or Path("inventory/hosts.yaml")
).expanduser()
lc_dest = (
args.lc_dest
or app_config.output_linux_connector
or Path("~/.config/linux-connector/hosts.yaml")
).expanduser()
AnsibleYamlExporter().write_to_file(inv, ansible_dest)
if not is_quiet: