feat: dont list datasets if there are many
This commit is contained in:
parent
6afbddc9ce
commit
de64c6d4d5
@ -159,6 +159,27 @@ class PDGSnapshot:
|
|||||||
print(f"{Colors.RED}✗ No ZFS datasets found{Colors.ENDC}")
|
print(f"{Colors.RED}✗ No ZFS datasets found{Colors.ENDC}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# If too many datasets, ask for manual input
|
||||||
|
if len(datasets) > 100:
|
||||||
|
print(f"\n{Colors.YELLOW}Found {len(datasets)} datasets - too many to list{Colors.ENDC}")
|
||||||
|
print(f"{Colors.DIM}Tip: Use 'zfs list' to see all available datasets{Colors.ENDC}")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
dataset = input(f"\n{Colors.BOLD}Enter dataset name: {Colors.ENDC}").strip()
|
||||||
|
if not dataset:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Check if dataset exists
|
||||||
|
success, _ = self.run_command(f"zfs list {dataset}")
|
||||||
|
if success:
|
||||||
|
return dataset
|
||||||
|
else:
|
||||||
|
print(f"{Colors.RED}✗ Dataset '{dataset}' not found{Colors.ENDC}")
|
||||||
|
retry = input(f"{Colors.DIM}Try again? (y/n): {Colors.ENDC}").lower()
|
||||||
|
if retry != 'y':
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
# Show numbered list for reasonable amount of datasets
|
||||||
print(f"\n{Colors.BOLD}Available ZFS Datasets:{Colors.ENDC}")
|
print(f"\n{Colors.BOLD}Available ZFS Datasets:{Colors.ENDC}")
|
||||||
for i, dataset in enumerate(datasets, 1):
|
for i, dataset in enumerate(datasets, 1):
|
||||||
print(f"{Colors.CYAN}{i:2d}.{Colors.ENDC} {dataset}")
|
print(f"{Colors.CYAN}{i:2d}.{Colors.ENDC} {dataset}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user