Class: Basketcase::Command
- Inherits:
-
Object
- Object
- Basketcase::Command
show all
- Extended by:
- Forwardable
- Includes:
- Utils
- Defined in:
- lib/basketcase.rb
Overview
Direct Known Subclasses
AutoCommand, CheckinCommand, CheckoutCommand, DiffCommand, DirectoryModificationCommand, HelpCommand, LogCommand, LsCoCommand, LsCommand, UncheckoutCommand, UpdateCommand, VersionTreeCommand
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Utils
#mkpath
Constructor Details
#initialize(basketcase) ⇒ Command
Returns a new instance of Command.
177
178
179
180
181
182
|
# File 'lib/basketcase.rb', line 177
def initialize(basketcase)
@basketcase = basketcase
@listener = DefaultListener
@recursive = false
@graphical = false
end
|
Instance Attribute Details
Returns the value of attribute comment.
209
210
211
|
# File 'lib/basketcase.rb', line 209
def
@comment
end
|
#listener=(value) ⇒ Object
Sets the attribute listener
184
185
186
|
# File 'lib/basketcase.rb', line 184
def listener=(value)
@listener = value
end
|
#targets=(value) ⇒ Object
Sets the attribute targets
185
186
187
|
# File 'lib/basketcase.rb', line 185
def targets=(value)
@targets = value
end
|
Instance Method Details
#accept_args(args) ⇒ Object
Handle command-line arguments:
- For option arguments of the form "-X", call the corresponding
option_X() method.
- Remaining arguments are stored in @targets
215
216
217
218
219
220
221
222
223
224
225
226
227
|
# File 'lib/basketcase.rb', line 215
def accept_args(args)
while /^-+(.+)/ === args[0]
option = args.shift
option_method_name = "option_#{$1}"
unless respond_to?(option_method_name)
raise UsageException, "Unrecognised option: #{option}"
end
option_method = method(option_method_name)
option_method.call(*args.shift(option_method.arity))
end
@targets = args
self
end
|
#effective_targets ⇒ Object
229
230
231
|
# File 'lib/basketcase.rb', line 229
def effective_targets
TargetList.new(@targets.empty? ? ['.'] : @targets)
end
|
#help ⇒ Object
173
174
175
|
# File 'lib/basketcase.rb', line 173
def help
"Sorry, no help provided ..."
end
|
203
204
205
|
# File 'lib/basketcase.rb', line 203
def ()
@comment =
end
|
#option_graphical ⇒ Object
Also known as:
option_g
197
198
199
|
# File 'lib/basketcase.rb', line 197
def option_graphical
@graphical = true
end
|
#option_recurse ⇒ Object
Also known as:
option_r
191
192
193
|
# File 'lib/basketcase.rb', line 191
def option_recurse
@recursive = true
end
|
#report(status, path, version = nil) ⇒ Object
187
188
189
|
# File 'lib/basketcase.rb', line 187
def report(status, path, version = nil)
@listener.call(ElementStatus.new(path, status, version))
end
|
#specified_targets ⇒ Object
233
234
235
236
|
# File 'lib/basketcase.rb', line 233
def specified_targets
raise UsageException, "No target specified" if @targets.empty?
TargetList.new(@targets)
end
|
#synopsis ⇒ Object
169
170
171
|
# File 'lib/basketcase.rb', line 169
def synopsis
""
end
|