lib/onering/cli.rb in onering-client-0.2.1 vs lib/onering/cli.rb in onering-client-0.2.3
- old
+ new
@@ -3,9 +3,33 @@
require 'yaml'
require 'multi_json'
@_args = {}
+ class Plugin
+ def self.default_format(output_value=nil, args=nil)
+ if output_value.is_a?(Hash) or
+ (output_value.is_a?(Array) and output_value.compact.first.is_a?(Hash))
+ then
+ return 'yaml'
+ end
+
+ return nil
+
+ rescue Exception
+ return nil
+ end
+
+ def self.inherited(subsclass)
+ @_subclasses ||= []
+ @_subclasses << subsclass unless @_subclasses.include?(subsclass)
+ end
+
+ def self.registered_plugins()
+ @_subclasses || []
+ end
+ end
+
def self.connect(cliargs)
@_args = cliargs
return Onering::API.new({
'autoconnect' => cliargs[:autoconnect],