Sha256: bbb8765d2c68514a2ebe0214d45435041fd1022966cf5c461a4505b7a0433d98

Contents?: true

Size: 1.31 KB

Versions: 10

Compression:

Stored size: 1.31 KB

Contents

# -*- encoding: utf-8 -*-

require 'webgen/cli/utils'

module Webgen
  module CLI

    # The CLI command for showing dependencies (tracked items) of paths.
    class ShowDependenciesCommand < CmdParse::Command

      def initialize # :nodoc:
        super('deps', takes_commands: false)
        short_desc('Show dependencies for all paths')
        long_desc(<<DESC)
Shows the dependencies (i.e. tracked items) for each path. This is only useful
after webgen has generated the website at least once so that this information
is available.

If an argument is given, only those paths that have the argument in their name
are displayed with their dependencies.

Hint: The global verbosity option enables additional output.
DESC
      end

      def execute(selector = nil) # :nodoc:
        data = command_parser.website.ext.item_tracker.cached_items(command_parser.verbose)
        if data.empty?
          puts "No data available, you need to generate the website first!"
          return
        end

        data.select! {|alcn, _| alcn.include?(selector) } if selector
        data.sort.each do |alcn, items|
          if items.length > 0 || command_parser.verbose
            puts("#{Utils.light(Utils.blue(alcn))}: ")
            items.each {|d| puts("  #{[d].flatten.join("\n    ")}")}
          end
        end
      end

    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
webgen-1.7.3 lib/webgen/cli/commands/show_dependencies.rb
webgen-1.7.2 lib/webgen/cli/commands/show_dependencies.rb
webgen-1.7.1 lib/webgen/cli/commands/show_dependencies.rb
webgen-1.7.0 lib/webgen/cli/commands/show_dependencies.rb
webgen-1.6.0 lib/webgen/cli/commands/show_dependencies.rb
webgen-1.5.2 lib/webgen/cli/commands/show_dependencies.rb
webgen-1.5.1 lib/webgen/cli/commands/show_dependencies.rb
webgen-1.5.0 lib/webgen/cli/commands/show_dependencies.rb
webgen-1.4.1 lib/webgen/cli/commands/show_dependencies.rb
webgen-1.4.0 lib/webgen/cli/commands/show_dependencies.rb