Class: HmxClient::Command::Fn

Inherits:
Base
  • Object
show all
Defined in:
lib/hmx/command/fn.rb

Overview

Load and Save functions in hmx

Constant Summary

Constants inherited from Base

Base::FILE

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#hmx, #initialize, #loadConfig!, namespace, #removeConfig, #storeConfig, #writeConfig

Methods included from Helpers

#display, #display_row, #display_table, #error, #getFromUser, #longest

Constructor Details

This class inherits a constructor from HmxClient::Command::Base

Instance Method Details

#indexObject

fn

Manipulate HMX functions



14
15
16
17
18
19
# File 'lib/hmx/command/fn.rb', line 14

def index
  unless args.size > 0
    raise CommandFailed, "Usage: hmx fn <fnName>" 
  end
  dout hmx.getFn([args.shift])
end

#listObject

fn:list

List all functions in HMX



25
26
27
28
29
30
# File 'lib/hmx/command/fn.rb', line 25

def list
   fns = hmx.query("fn", nil)
   fns.each { | f |
                display f.rpartition('/')[2]
            }
end

#putObject

fn:put

Create or update a function



36
37
38
39
40
41
# File 'lib/hmx/command/fn.rb', line 36

def put
   unless args.size > 0
     raise CommandFailed, "Usage: hmx fn:put <fnName> <f:function>" 
   end
   dout hmx.putFn(args)
end