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 error_ext::SubXErrorExt;
pub use output::OutputMode;
pub use output::SCHEMA_VERSION;
pub use reporter::TerminalReporter;
pub use reporter::terminal_reporter;
pub use reporter::terminal_reporter_with_progress_bar;
pub use sync_args::SyncArgs;
pub use sync_args::SyncMethod;
pub use sync_args::SyncMethodArg;
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§

error_ext
Binary-owned presentation extensions for SubXError.
output
Machine-readable output renderer for SubX-CLI.
reporter
The CLI’s terminal implementation of the core reporting seam.
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
Legacy re-export. InputPathHandler and CollectedFiles now live in subx_core::core::input; prefer that path. These aliases exist so that consumers written against subx_cli::cli::… keep compiling across the subx-core split and will be removed once they have migrated. 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
Legacy re-export. InputPathHandler and CollectedFiles now live in subx_core::core::input; prefer that path. These aliases exist so that consumers written against subx_cli::cli::… keep compiling across the subx-core split and will be removed once they have migrated. 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.
SyncMode
Legacy re-export. SyncMode now lives in subx_core::core::sync; prefer that path. The alias exists so that consumers written against subx_cli::cli::SyncMode keep compiling across the subx-core split and will be removed once they have migrated. Sync mode: single file or batch.

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.