Universal Command Line Environment for AWS.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Comprehensive help system providing contextual documentation for AWS CLI commands, services, and operations. The help system renders documentation in multiple formats and integrates with platform-specific viewers for optimal user experience.
Base help command infrastructure for rendering documentation at different command hierarchy levels.
class HelpCommand:
def __init__(self, session, command_table, arg_table, name, event_class=None):
"""
Base help command class.
Parameters:
session: botocore.session.Session, AWS session
command_table: dict, available commands
arg_table: dict, command arguments
name: str, command name
event_class: str, event class for customization
"""
def create_help_command(self):
"""Create help command instance."""
def __call__(self, args, parsed_globals):
"""Execute help command."""
class ProviderHelpCommand(HelpCommand):
"""
Top-level AWS CLI help command (aws help).
Provides overview of AWS CLI and available services.
"""
class ServiceHelpCommand(HelpCommand):
"""
Service-level help command (aws s3 help).
Provides service overview and available operations.
"""
class OperationHelpCommand(HelpCommand):
"""
Operation-level help command (aws s3 ls help).
Provides detailed operation documentation and parameter descriptions.
"""Platform-aware help rendering with support for multiple output formats and viewers.
def get_renderer():
"""
Get platform-appropriate help renderer.
Returns:
Help renderer instance for current platform
"""
class PosixHelpRenderer:
"""
Unix/Linux help renderer using less or similar pagers.
Supports color output and interactive navigation.
"""
def render(self, contents):
"""
Render help content using system pager.
Parameters:
contents: str, help content to render
"""
class WindowsHelpRenderer:
"""
Windows help renderer with fallback to console output.
Handles Windows-specific paging and display considerations.
"""
def render(self, contents):
"""
Render help content on Windows platform.
Parameters:
contents: str, help content to render
"""Documentation generation from AWS service models and command definitions.
class HelpRenderer:
"""Base class for help content rendering."""
def render_to_text(self, help_command):
"""
Render help command to text format.
Parameters:
help_command: HelpCommand instance
Returns:
str: Formatted help text
"""
class OperationDocumentEventHandler:
"""
Event handler for operation documentation generation.
Processes service models to generate help content.
"""
def doc_description(self, help_command, **kwargs):
"""Generate operation description."""
def doc_synopsis(self, help_command, **kwargs):
"""Generate operation synopsis."""
def doc_options(self, help_command, **kwargs):
"""Generate operation options documentation."""Usage Example:
from awscli.help import ProviderHelpCommand, ServiceHelpCommand
import botocore.session
# Create help for top-level AWS CLI
session = botocore.session.Session()
help_cmd = ProviderHelpCommand(
session=session,
command_table={}, # Would be populated with actual commands
arg_table={},
name='aws'
)
# Execute help command
help_cmd([], {}) # Shows top-level AWS CLI help
# Create service-level help
service_help = ServiceHelpCommand(
session=session,
command_table={},
arg_table={},
name='s3'
)
service_help([], {}) # Shows S3 service helpSpecialized exceptions for help rendering and display issues.
class ExecutableNotFoundError(Exception):
"""
Raised when required executable for help rendering is not found.
Typically occurs when system pager is not available.
"""Custom commands can provide their own help documentation:
from awscli.customizations.commands import BasicCommand
class MyCommand(BasicCommand):
NAME = 'my-command'
DESCRIPTION = 'Custom command description'
SYNOPSIS = 'aws my-command [options]'
EXAMPLES = '''
Examples:
aws my-command --input file.txt
Process input file
aws my-command --format json --output results.json
Process with JSON output format
'''
def create_help_command(self):
"""Create custom help command with enhanced documentation."""
help_command = super().create_help_command()
# Add custom help sections
return help_commandThe help system integrates with the AWS CLI event system for customization:
# Register custom help handler
session.register('doc-description.s3.cp', custom_help_handler)
def custom_help_handler(help_command, **kwargs):
"""Custom help content handler."""
help_command.doc.style.h2('Custom Section')
help_command.doc.write('Additional documentation content.')Unix/Linux:
less pager with color supportWindows:
Integration Example:
from awscli.help import get_renderer
# Get platform-appropriate renderer
renderer = get_renderer()
# Render help content with platform-specific handling
help_content = """
AWS CLI Help
============
The AWS Command Line Interface...
"""
renderer.render(help_content)Install with Tessl CLI
npx tessl i tessl/pypi-awscli