Class: MetabaseQuerySync::CLI::Sync

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/metabase_query_sync/cli.rb

Instance Method Summary collapse

Instance Method Details

#call(root_collection_id:, paths: nil, dry_run: false, host: nil, user: nil, pass: nil, config_file: nil) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/metabase_query_sync/cli.rb', line 24

def call(root_collection_id:, paths: nil, dry_run: false, host: nil, user: nil, pass: nil, config_file: nil, **)
  config = MetabaseQuerySync::Config.from_file(
    config_file || File.join(Dir.pwd, '.metabase-query-sync.erb.yaml'),
    paths: paths,
    host: host,
    user: user,
    pass: pass,
  )
  sync = MetabaseQuerySync::Sync.from_config(config, Logger.new(STDOUT))
  sync.(MetabaseQuerySync::SyncRequest.new(root_collection_id: root_collection_id.to_i, dry_run: dry_run))
end