(show_enterprise=False, show_shell=False, show_legacy=False, show_nested_share_folder=True)
| 73 | |
| 74 | |
| 75 | def display_command_help(show_enterprise=False, show_shell=False, show_legacy=False, show_nested_share_folder=True): |
| 76 | from .command_categories import get_command_category, get_category_order |
| 77 | from .display import bcolors |
| 78 | from colorama import Fore, Style |
| 79 | import shutil |
| 80 | |
| 81 | # Build a lookup of command -> list of aliases |
| 82 | alias_lookup = {} |
| 83 | for alias, command in aliases.items(): |
| 84 | if command not in alias_lookup: |
| 85 | alias_lookup[command] = [] |
| 86 | alias_lookup[command].append(alias) |
| 87 | DIM = Fore.WHITE # Use white for better readability (not too bright, not too dim) |
| 88 | |
| 89 | # Get terminal width |
| 90 | try: |
| 91 | terminal_width = shutil.get_terminal_size(fallback=(80, 24)).columns |
| 92 | except: |
| 93 | terminal_width = 80 |
| 94 | |
| 95 | def clean_description(desc): |
| 96 | """Remove trailing period from description""" |
| 97 | if desc and desc.endswith('.'): |
| 98 | return desc[:-1] |
| 99 | return desc |
| 100 | |
| 101 | # Collect all commands from all sources |
| 102 | all_commands = {} |
| 103 | all_commands.update(command_info) |
| 104 | if show_enterprise: |
| 105 | all_commands.update(enterprise_command_info) |
| 106 | all_commands.update(msp_command_info) |
| 107 | |
| 108 | # Group commands by category and build display info |
| 109 | categorized_commands = {} |
| 110 | for cmd, description in all_commands.items(): |
| 111 | category = get_command_category(cmd) |
| 112 | if category not in categorized_commands: |
| 113 | categorized_commands[category] = [] |
| 114 | categorized_commands[category].append((cmd, clean_description(description))) |
| 115 | |
| 116 | # Pre-compute all command display strings and find global max width |
| 117 | # This allows alignment across all categories when terminal is wide enough |
| 118 | all_cmd_displays = [] # List of (category, cmd_display, description) |
| 119 | global_max_width = 0 |
| 120 | |
| 121 | # Special subcommands for certain categories |
| 122 | pam_subcommands = [ |
| 123 | ('pam action', 'Execute action on the Gateway'), |
| 124 | ('pam config', 'Manage PAM Configurations'), |
| 125 | ('pam connection', 'Manage Connections'), |
| 126 | ('pam gateway', 'Manage Gateways'), |
| 127 | ('pam legacy', 'Switch to legacy PAM commands'), |
| 128 | ('pam project', 'PAM Project Import/Export'), |
| 129 | ('pam rbi', 'Manage Remote Browser Isolation'), |
| 130 | ('pam rotation', 'Manage Rotations'), |
| 131 | ('pam split', 'Split credentials from legacy PAM Machine'), |
| 132 | ('pam tunnel', 'Manage Tunnels'), |
no test coverage detected