Project

General

Profile

Revision f8ecc788

Added by Thomas McKay almost 9 years ago

csv-scope - lots of cleanup

View differences:

lib/hammer_cli_csv/users.rb
71 71

  
72 72
        roles = CSV.parse_line(line[ROLES], {:skip_blanks => true}).collect do |role|
73 73
          foreman_role(:name => namify(role, number))
74
        end if line[ROLES]
74
        end if line[ROLES] && !line[ROLES].empty?
75 75
        organizations = CSV.parse_line(line[ORGANIZATIONS], {:skip_blanks => true}).collect do |organization|
76 76
          foreman_organization(:name => organization)
77
        end if line[ORGANIZATIONS]
77
        end if line[ORGANIZATIONS] && !line[ORGANIZATIONS].empty?
78 78
        locations = CSV.parse_line(line[LOCATIONS], {:skip_blanks => true}).collect do |location|
79 79
          foreman_location(:name => location)
80
        end if line[LOCATIONS]
80
        end if line[LOCATIONS] && !line[LOCATIONS].empty?
81 81

  
82 82
        if !@existing.include? name
83 83
          create_user(line, name, roles, organizations, locations)
......
125 125
    end
126 126
  end
127 127

  
128
  HammerCLI::MainCommand.subcommand('csv:users',
129
                                    'import or export users as CSV',
130
                                    HammerCLICsv::UsersCommand)
128
  HammerCLICsv::CsvCommand.subcommand('users',
129
                                      'import or export users',
130
                                      HammerCLICsv::UsersCommand)
131 131
end

Also available in: Unified diff