#!/usr/bin/env ruby # frozen_string_literal: true # rubocop:disable all require 'cli-tree' # require File.expand_path('lib/legion.rb') # Legion.setup require 'legion/json' require 'legion/logging' require 'legion/settings' require 'legion/data' Legion::Logging.setup(level: 'debug') Legion::Settings.load Legion::Settings.merge_settings('data', Legion::Data::Settings.default) Legion::Data.setup extensions = {name: 'extensions', children: []} Legion::Data::Model::Extension.each do | extension| runners = [] extension.runners.each do |runner| functions = [] runner.functions.each do |function| functions.push function.values[:name] end # runners.push runner.values[:name] runners.push({name: runner.values[:name], children: functions}) end child = {name: extension.values[:name], children: runners} # extensions[:children].push extension.values[:name] extensions[:children].push child end tree = TreeNode.from_h(extensions) tree.print