Sha256: 0617d2a62f69d614519c120815202fa405975a0e4bf3c6553110d2d1e68ceba3

Contents?: true

Size: 1 KB

Versions: 40

Compression:

Stored size: 1 KB

Contents

module Brightbox
  command [:accounts] do |cmd|

    cmd.desc I18n.t("accounts.reset_ftp_password.desc")
    cmd.arg_name "account-id..."
    cmd.command [:reset_ftp_password] do |c|

      c.action do |global_options, _options, args|

        if args.empty?
          raise "You must specify the accounts to reset ftp passwords for"
        end

        accounts = Account.find_or_call(args) do |id|
          raise "Couldn't find account #{id}"
        end

        rows = []

        accounts.each do |s|
          info "Resetting ftp password for #{s}"
          new_password = s.reset_ftp_password
          o = s.to_row
          o[:library_ftp_password] = new_password
          rows << o
        end

        table_opts = global_options.merge(
          :vertical => true,
          :fields => [
            :id,
            :name,
            :library_ftp_host,
            :library_ftp_user,
            :library_ftp_password
          ]
        )

        render_table(rows, table_opts)
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
brightbox-cli-3.3.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-3.2.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-3.1.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-3.0.1 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-3.0.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.12.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.11.2 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.11.1 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.11.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.10.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.9.3 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.9.2 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.9.1 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.9.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.8.2 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.8.1 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.8.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.7.1 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.7.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.6.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb