Module: Kreuzberg::CLI
- Defined in:
- lib/kreuzberg/cli.rb
Overview
Class Method Summary collapse
-
.detect(path_or_nil = nil, path: nil) ⇒ String
Detect MIME type of a file using the CLI.
-
.extract(path_or_nil = nil, path: nil, output: 'text', ocr: false) ⇒ String
Extract content from a file using the CLI.
-
.help ⇒ String
Get CLI help text.
-
.version ⇒ String
Get CLI version.
Class Method Details
.detect(path_or_nil = nil, path: nil) ⇒ String
Detect MIME type of a file using the CLI
33 34 35 36 37 38 39 |
# File 'lib/kreuzberg/cli.rb', line 33 def detect(path_or_nil = nil, path: nil) # Support both positional and keyword argument for path (backward compatibility) actual_path = path_or_nil || path raise ArgumentError, 'path is required' if actual_path.nil? CLIProxy.call(['detect', actual_path]).strip end |
.extract(path_or_nil = nil, path: nil, output: 'text', ocr: false) ⇒ String
Extract content from a file using the CLI
17 18 19 20 21 22 23 24 25 |
# File 'lib/kreuzberg/cli.rb', line 17 def extract(path_or_nil = nil, path: nil, output: 'text', ocr: false) # Support both positional and keyword argument for path (backward compatibility) actual_path = path_or_nil || path raise ArgumentError, 'path is required' if actual_path.nil? args = ['extract', actual_path, '--format', output] args.push('--ocr', ocr ? 'true' : 'false') CLIProxy.call(args) end |