Class: Uniword::FontsCLI

Inherits:
Thor
  • Object
show all
Includes:
CLIHelpers
Defined in:
lib/uniword/cli/fonts_cli.rb

Overview

Fonts subcommands for Uniword CLI.

Rewrites font families inside document content — the CLI equivalent of Word's Home → Replace → Replace Fonts, across styles, defaults, body, headers/footers, notes, comments, and numbering in one pass.

Instance Method Summary collapse

Methods included from CLIHelpers

included

Instance Method Details

#replace(input_path, output_path) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/uniword/cli/fonts_cli.rb', line 30

def replace(input_path, output_path)
  say "Loading document #{input_path}...", :green if options[:verbose]

  count = replace_in_file(input_path, output_path)
  say "Replaced #{count} font reference(s) " \
      "('#{options[:from]}' → '#{options[:to]}') in #{output_path}",
      :green
rescue Uniword::Error => e
  handle_error(e)
rescue StandardError => e
  handle_error(e, verbose: options[:verbose])
end