Sha256: 8742444db1fb14718950a83ae6dc4bcae0187ae197583a0e2b9688c0ffe6df7f

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

class Eco::API::UseCases::Default::Locations::TagtreeExtract
  # Class to define the CLI integration of a usecase anywhere it suits.
  class Cli < Eco::API::UseCases::Cli
    desc "Exports the tagtree in a specific format"

    add_option("-include-archived", "Whether the archived nodes should be included") do |options|
      options.deep_merge!(output: {include: {archived: true}})
    end

    add_option("-format", "Kind of extract (list | json | nodes | csv_tree | excel_tree | excel_nodes )") do |options|
      format = SCR.get_arg("-format", with_param: true)
      options.deep_merge!(output: {format: format})
    end

    add_option("-node-attrs", "Attributes to be dumped (i.e. name|id ). Default: id") do |options|
      attrs = SCR.get_arg("-node-attrs", with_param: true)
      options.deep_merge!(output: {attrs: attrs.split('|').map(&:to_sym)})
    end

    add_option("-with-ancestors", "Include ancestors in tree csv/excel_tree") do |options|
      options.deep_merge!(output: {include: {ancestors: true}})
    end

    add_option("-indent", "Custom indentation (i.e. \"++\")") do |options|
      indent = SCR.get_arg("-indent", with_param: true) || ""
      options.deep_merge!(output: {indent: indent})
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eco-helpers-2.6.4 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-2.6.3 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-2.6.2 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-2.6.1 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb