Class: Safeguard::Command
- Inherits:
-
Acclaim::Command
- Object
- Acclaim::Command
- Safeguard::Command
- Defined in:
- lib/safeguard/command.rb,
lib/safeguard/command/add.rb,
lib/safeguard/command/hash.rb,
lib/safeguard/command/init.rb,
lib/safeguard/command/verify.rb,
lib/safeguard/command/add/hash.rb
Overview
Main Safeguard command. Currently just invokes the init command.
$ safeguard .
Defined Under Namespace
Classes: Add, Hash, Init, Verify
Class Method Summary collapse
-
.add_supported_algorithms_as_options! ⇒ Object
An option will be made for every element in Digest::SUPPORTED_ALGORITHMS.
Class Method Details
.add_supported_algorithms_as_options! ⇒ Object
An option will be made for every element in Digest::SUPPORTED_ALGORITHMS. They may be used together and always append to the function array, bound to the :functions
key.
However, due to the lack of a formally defined functions
option, the Acclaim option parser will not set that option to anything. Therefore, calling options.functions
will return an empty ribbon if the user doesn’t specify any functions on the command line.
options.functions?
should ALWAYS be called, preferably while providing an empty array as fallback.
42 43 44 45 46 47 48 |
# File 'lib/safeguard/command.rb', line 42 def Digest::SUPPORTED_ALGORITHMS.each do |algorithm| option algorithm, "Use #{algorithm.to_s.upcase}." do || .functions = (.functions? []) << algorithm end end end |