Sha256: 70bf96532bb53d74ebd75a74000f7985906948994f044b6646fc76a0af72fb04

Contents?: true

Size: 1.51 KB

Versions: 40

Compression:

Stored size: 1.51 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 "Converts a tagtree into 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 full path of 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

    add_option("-file-as-source", "Use a file as locations input (rather than the live locations)") do |options|
      file = SCR.get_file("-file-as-source", required: true, should_exist: true)
      options.deep_merge!(source: {file: file})
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
eco-helpers-3.0.21 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.20 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.19 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.18 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.17 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.16 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.15 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.14 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.13 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.12 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.11 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.10 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.9 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.8 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.7 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.6 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.5 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.4 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.3 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb
eco-helpers-3.0.2 lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb