# frozen_string_literal: true # # frozen_string_literal: true module Wayfarer module CLI class Route < Base desc "result JOB URL", "Invoke JOB's router with URL" def result(job, url) load_environment url = Addressable::URI.parse(url) job = job.classify.constantize job.router.invoke(url, job.new.steer) say Wayfarer::Routing::PathFinder.result(job.router.root, url) end desc "tree JOB URL", "Visualize JOB's routing tree for URL" def tree(job, url) load_environment url = Addressable::URI.parse(url) job = job.classify.constantize job.router.invoke(url, job.new.steer) Wayfarer::CLI::RoutePrinter.print(job.router.root, url) end end end end