Skip to main content

Module cli

Module cli 

Source
Expand description

Command-line interface for the SubX subtitle processing tool.

This module provides the top-level CLI application structure and subcommands for AI-powered matching, subtitle format conversion, audio synchronization, encoding detection, configuration management, cache operations, and shell completion generation.

§Architecture

The CLI is built using clap and follows a subcommand pattern:

  • match - AI-powered subtitle file matching and renaming
  • convert - Subtitle format conversion between standards
  • sync - Audio-subtitle synchronization and timing adjustment
  • detect-encoding - Character encoding detection and conversion
  • config - Configuration management and inspection
  • cache - Cache inspection and dry-run management
  • generate-completion - Shell completion script generation

§Examples

# Basic subtitle matching
subx match /path/to/videos /path/to/subtitles

# Convert SRT to ASS format
subx convert --input file.srt --output file.ass --format ass

# Detect file encoding
subx detect-encoding *.srt

Re-exports§

pub use output::OutputMode;
pub use output::SCHEMA_VERSION;
pub use sync_args::SyncArgs;
pub use sync_args::SyncMethod;
pub use sync_args::SyncMethodArg;
pub use sync_args::SyncMode;
pub use ui::create_progress_bar;
pub use ui::display_ai_usage;
pub use ui::display_match_results;
pub use ui::print_error;
pub use ui::print_success;
pub use ui::print_warning;

Modules§

output
Machine-readable output renderer for SubX-CLI.
sync_args
Refactored sync command CLI argument definitions.
table
Table formatting utilities for displaying structured CLI output.
ui
User interface utilities and display helpers for SubX CLI.

Structs§

ApplyArgs
Arguments for the cache apply subcommand.
CacheArgs
Command-line arguments for cache management operations.
ClearArgs
Arguments for the cache clear subcommand.
Cli
Main CLI application structure defining the top-level interface.
CollectedFiles
Result of collecting files from input paths, including any temporary directories created during archive extraction.
ConfigArgs
Command-line arguments for configuration management operations.
ConvertArgs
Command-line arguments for subtitle format conversion.
DetectEncodingArgs
Command-line arguments for file encoding detection.
GenerateCompletionArgs
Command-line arguments for generating shell completion scripts.
InputPathHandler
Universal input path processing structure for CLI commands.
MatchArgs
Arguments for AI-powered subtitle file matching and renaming.
RollbackArgs
Arguments for the cache rollback subcommand.
RunOutcome
Outcome of a CLI invocation, surfaced to main.rs so it can render the final envelope without re-parsing argv.
StatusArgs
Arguments for the cache status subcommand.
TranslateArgs
Command-line arguments for AI-assisted subtitle translation.

Enums§

CacheAction
Cache management operations and subcommands.
ClearType
Types of cache data that can be cleared.
Commands
Available subcommands for the SubX CLI application.
ConfigAction
Configuration management operations and subcommands.
OutputSubtitleFormat
Supported output subtitle formats for conversion operations.

Functions§

command_name
Return the stable kebab-cased command name for a parsed subcommand.
resolve_output_mode
Resolve the active output mode from a parsed Cli plus the SUBX_OUTPUT environment variable.
run
Executes the SubX CLI application with the production configuration.
run_with_config
Run the CLI with a provided configuration service.