lib/gitlab/cli_helpers.rb
# Table for a single record.
#
# @return [String]
Table for a single record.
Table for a single record .
def single_record_table(data, cmd, args)
      hash = data.to_h
      keys = hash.keys.sort {|x, y| x.to_s <=> y.to_s }
      keys = keys & required_fields(args) if required_fields(args).any?
      keys = keys - excluded_fields(args)
      table do |t|
        t.title = "Gitlab.#{cmd} #{args.join(', ')}"
        keys.each_with_index do |key, index|
          case value = hash[key]
          when Hash
            value = 'Hash'
          when nil
            value = 'null'
          end
          t.add_row [key, value]
          t.add_separator unless keys.size - 1 == index
        end
      end
    end
def single_record_table ( data , cmd , args ) hash = data . to_h keys = hash . keys . sort { | x , y | x . to_s <=> y . to_s } keys = keys & required_fields ( args ) if required_fields ( args ) . any? keys = keys - excluded_fields ( args ) table do | t | t . title = "Gitlab.#{cmd} #{args.join(', ')}" keys . each_with_index do | key , index | case value = hash [ key ] when Hash value = 'Hash' when nil value = 'null' end t . add_row [ key , value ] t . add_separator unless keys . size - 1 == index end end end
Table for a single record.
Table for a single record .
None
String
data
<not_specific>
cmd
<not_specific>
args
<not_specific>