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