Skip to content

Commit

Permalink
sort session by name
Browse files Browse the repository at this point in the history
  • Loading branch information
Ido Abramovich committed Mar 8, 2016
1 parent 87e810c commit cc6f064
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/canals/cli/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def show
require 'terminal-table'
require 'canals/core_ext/string'
columns = ["up", "pid", "name", "local_port", "socket"]
rows = Canals.session.map{ |s| columns.map{ |c| session_col_val(s, c) } }
rows = Canals.session.sort{ |a,b| a[:name] <=> b[:name] }
.map { |s| columns.map{ |c| session_col_val(s, c) } }
table = Terminal::Table.new :headings => columns.map{|c| session_col_title(c) }, :rows => rows
table.align_column(3, :right)
say table
Expand Down

0 comments on commit cc6f064

Please sign in to comment.