Sha256: eb54a70857a62365383f9c1a41857b32d2b6f6a13683ebd88a6ccca098a48c8f

Contents?: true

Size: 436 Bytes

Versions: 6

Compression:

Stored size: 436 Bytes

Contents

require 'readline'

module Commando
  module Action
    # Action that prints out command history
    module History
      def self.perform(args:, output: $stdout)
        max_digits = Math.log(Readline::HISTORY.size, 10).ceil
        Readline::HISTORY.each.with_index do |history, index|
          line_no = (index + 1).to_s.rjust(max_digits, ' ')
          output.puts " #{line_no}\t#{history}"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tcollier-commando-1.0.0 lib/commando/action/history.rb
tcollier-commando-0.2.1 lib/commando/action/history.rb
tcollier-commando-0.2.0 lib/commando/action/history.rb
tcollier-commando-0.1.2 lib/commando/action/history.rb
tcollier-commando-0.1.1 lib/commando/action/history.rb
tcollier-commando-0.1.0 lib/commando/action/history.rb