Class: PackageCommand

Inherits:
Command show all
Defined in:
lib/replicant/commands/package_command.rb

Constant Summary

Constants included from Styles

Styles::CONSOLE_WIDTH, Styles::REPL_OUT, Styles::STYLES

Instance Attribute Summary

Attributes inherited from Command

#args

Instance Method Summary collapse

Methods inherited from Command

all, #execute, inherited, #initialize, load, #name

Methods included from Styles

#create_style, #end_style, #styled_text

Constructor Details

This class inherits a constructor from Command

Instance Method Details

#descriptionObject



3
4
5
# File 'lib/replicant/commands/package_command.rb', line 3

def description
  "set a default package to work with"
end

#runObject



15
16
17
18
# File 'lib/replicant/commands/package_command.rb', line 15

def run
  output "Setting default package to #{args.inspect}"
  @repl.default_package = args
end

#usageObject



7
8
9
# File 'lib/replicant/commands/package_command.rb', line 7

def usage
  "#{name} com.mydomain.mypackage"
end

#valid_args?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/replicant/commands/package_command.rb', line 11

def valid_args?
  args.present? && /^\w+(\.\w+)*$/ =~ args
end