Sha256: 5f9594821ed380e8d284878f0a5611b863a9215804c695f2c429f94e53855f39

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

module Pione
  module Command
    # PioneActionList is a command definition of "pione action:list" for listing
    # literate actions.
    class PioneActionList < BasicCommand
      #
      # basic informations
      #

      command_name "pione action:list"
      command_banner "show list of action names in document"
      PioneCommand.add_subcommand("action:list", self)

      #
      # options
      #

      use_option :color

      #
      # command lifecycle: setup phase
      #

      setup :target

      # Setup location of literate action document and action name.
      def setup_target
        abort("There are no literate action documents or packages.")  if @argv[0].nil?
        @location = Location[@argv[0]]
      end

      #
      # command lifecycle: execution phase
      #

      execute :show_list

      # Show list of action names.
      def execute_show_list
        names = LiterateAction::Document.load(@location).action_names.sort
        if names.empty?
          abort("no action names in %s" % @location.address)
        else
          names.each {|name| puts name}
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pione-0.3.2 lib/pione/command/pione-action-list.rb