Class: Fontisan::Commands::LsCommand
- Inherits:
-
Object
- Object
- Fontisan::Commands::LsCommand
- Defined in:
- lib/fontisan/commands/ls_command.rb
Overview
Command to list contents of font files (collections or individual fonts).
This command provides a universal "ls" interface that auto-detects whether the input is a collection (TTC/OTC) or individual font (TTF/OTF) and returns the appropriate listing:
- For collections: Lists all fonts in the collection
- For individual fonts: Shows a quick summary
Instance Method Summary collapse
-
#initialize(file_path, options = {}) ⇒ LsCommand
constructor
Initialize ls command.
-
#run ⇒ CollectionListInfo, FontSummary
Execute the ls command.
Constructor Details
#initialize(file_path, options = {}) ⇒ LsCommand
Initialize ls command
28 29 30 31 |
# File 'lib/fontisan/commands/ls_command.rb', line 28 def initialize(file_path, = {}) @file_path = file_path @options = end |
Instance Method Details
#run ⇒ CollectionListInfo, FontSummary
Execute the ls command
Auto-detects file type and returns appropriate model:
- CollectionListInfo for TTC/OTC files
- FontSummary for TTF/OTF files
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fontisan/commands/ls_command.rb', line 42 def run if FontLoader.collection?(@file_path) list_collection else font_summary end rescue Errno::ENOENT raise rescue StandardError => e raise Error, "Failed to list file contents: #{e.}" end |