Class: SafariBookmarksParser::Commands::EmptyCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/safari_bookmarks_parser/commands/empty_command.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#output_format, #output_path, #plist_path

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Constructor Details

This class inherits a constructor from SafariBookmarksParser::Commands::BaseCommand

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/safari_bookmarks_parser/commands/empty_command.rb', line 6

def run
  plist_parser = Parser.parse(@plist_path)

  empty_folders = Services::FindEmptyFolders.call(root_folder: plist_parser.root_folder)

  return if empty_folders.empty?

  text = format_to_text(empty_folders.map(&:to_h))

  output_text(text)
end