Sha256: a6d6cf79aedc3b4daff9270baabbd8049a57545ab2bf6cf987eabd2c5bb09a5e

Contents?: true

Size: 1.72 KB

Versions: 17

Compression:

Stored size: 1.72 KB

Contents

require 'build-tool/commands'

module BuildTool; module Commands; module Modules

    #
    # BuildCommand
    #
    class List < Standard

        name        "list"
        description "list modules"
        long_description [ "Shows a list of modules. Without a parameter all modules are show. With",
                           "parameters list all modules matching them." ]
        cmdalias    "lsmods"

        def initialize_options
            @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} [MODULE|GROUP]..."

            @template = false

            @options.separator "Options:"

            options.on( "--all", "Include inactive modules." ) {
                @all = true
                }

            options.on( "--template", "Include template modules." ) {
                @template = true
                }

            super
        end

        def do_execute( args )
            # *TODO* listing local and remote recipes
            if args.length == 0
                configuration.modules.each do |mod|
                    if @template or not mod.is_template?
                        say "%-30s : %s" % [ mod.name, mod.description || "No description specified" ] if ( mod.active? || @all )
                    end
                end
            else
                args.each do |arg|
                    mods = complete_modules( arg, @template )
                    next if !mods
                    mods.each do |mod|
                        say "%-30s : %s" % [ mod.name, mod.description || "No description specified" ] if ( mod.active? || @all )
                    end
                end
            end

            return 0
        end

    end # class

end; end; end # module BuildTool::Commands::Modules

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
build-tool-0.5.7 lib/build-tool/commands/modules/list.rb
build-tool-0.5.6 lib/build-tool/commands/modules/list.rb
build-tool-0.5.5 lib/build-tool/commands/modules/list.rb
build-tool-0.5.4 lib/build-tool/commands/modules/list.rb
build-tool-0.5.3 lib/build-tool/commands/modules/list.rb
build-tool-0.5.2 lib/build-tool/commands/modules/list.rb
build-tool-0.4.6 lib/build-tool/commands/modules/list.rb
build-tool-0.5.1 lib/build-tool/commands/modules/list.rb
build-tool-0.4.5 lib/build-tool/commands/modules/list.rb
build-tool-0.5.0 lib/build-tool/commands/modules/list.rb
build-tool-0.4.4 lib/build-tool/commands/modules/list.rb
build-tool-0.4.3 lib/build-tool/commands/modules/list.rb
build-tool-0.4.2 lib/build-tool/commands/modules/list.rb
build-tool-0.4.1 lib/build-tool/commands/modules/list.rb
build-tool-0.4.0 lib/build-tool/commands/modules/list.rb
build-tool-0.3.3 lib/build-tool/commands/modules/list.rb
build-tool-0.3.2 lib/build-tool/commands/modules/list.rb