def build_dscl_command(attribs, dir_info)
      # allow :recordname to be passed-in if using dscl directly
      attribs[:record_name] = attribs[:record_name] || attribs[:recordname]
      # /usr/bin/dscl -u diradmin -P "BigSecret" /LDAPv3/127.0.0.1 -append /Users/$UID_USERNAME apple-keyword "$VALUE"
      # "/usr/bin/dscl -plist -u #{od_username} -P #{od_password} #{od_dsclpath} -#{command} #{resource} #{params}"
      ans  = %Q[#{dir_info[:dscl]}]
      unless attribs[:format].nil?
        ans += ' -plist'                           if attribs[:format].eql? 'plist' or
                                                      attribs[:format].eql? 'xml'
      end
      ans += %Q[ -u #{dir_info[:username]}]    unless dir_info[:username].nil? or
                                                      dir_info[:username].empty? or
                                                      attribs[:action].eql? 'auth'
      ans += %Q[ -P "#{dir_info[:password]}"]  unless dir_info[:password].nil? or
                                                      dir_info[:password].empty? or
                                                      attribs[:action].eql? 'auth'
      ans += " #{dir_info[:data_path]}"

      ans += %Q[ -#{attribs[:action]}]
      ans += %Q[ #{attribs[:record_name]}]         if attribs[:action].eql? 'auth'
      ans += %Q[ /#{attribs[:scope]}/#{attribs[:record_name]}] unless
                                                      attribs[:action].eql? 'auth'
      ans += %Q[ #{attribs[:attribute]}]       unless attribs[:attribute].nil? or
                                                      attribs[:attribute].empty?
      ans += %Q[ "#{attribs[:value]}"]         unless attribs[:value].nil? or
                                                      attribs[:value].empty?
      attribs[:value] = nil
      return ans
    end
def build_dscl_command(attribs, dir_info)
      # allow :recordname to be passed-in if using dscl directly
      attribs[:record_name] = attribs[:record_name] || attribs[:recordname]
      # /usr/bin/dscl -u diradmin -P "BigSecret" /LDAPv3/127.0.0.1 -append /Users/$UID_USERNAME apple-keyword "$VALUE"
      # "/usr/bin/dscl -plist -u #{od_username} -P #{od_password} #{od_dsclpath} -#{command} #{resource} #{params}"
      ans  = %Q[#{dir_info[:dscl]}]
      unless attribs[:format].nil?
        ans += ' -plist'                           if attribs[:format].eql? 'plist' or
                                                      attribs[:format].eql? 'xml'
      end
      ans += %Q[ -u #{dir_info[:username]}]    unless dir_info[:username].nil? or
                                                      dir_info[:username].empty? or
                                                      attribs[:action].eql? 'auth'
      ans += %Q[ -P "#{dir_info[:password]}"]  unless dir_info[:password].nil? or
                                                      dir_info[:password].empty? or
                                                      attribs[:action].eql? 'auth'
      ans += " #{dir_info[:data_path]}"

      ans += %Q[ -#{attribs[:action]}]
      ans += %Q[ #{attribs[:record_name]}]         if attribs[:action].eql? 'auth'
      ans += %Q[ /#{attribs[:scope]}/#{attribs[:record_name]}] unless
                                                      attribs[:action].eql? 'auth'
      ans += %Q[ #{attribs[:attribute]}]       unless attribs[:attribute].nil? or
                                                      attribs[:attribute].empty?
      ans += %Q[ "#{attribs[:value]}"]         unless attribs[:value].nil? or
                                                      attribs[:value].empty?
      attribs[:value] = nil
      return ans
    end
TODO: switch to template pattern