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-2.5.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.4.1 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.4.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.3.4 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.3.3 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.3.2 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.3.1 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.3.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.2.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.1.2 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.1.1 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.1.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-2.0.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-1.6.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-1.5.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-1.4.3 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-1.4.2 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-1.4.1 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-1.4.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb
brightbox-cli-1.3.0 lib/brightbox-cli/commands/accounts/reset-ftp-password.rb