lib/sample_cmdlet_patterns/commands/table_align.rb
def execute(input: $stdin, output: $stdout)
        heading 'column alignment'
        table = TTY::Table.new ['header1','header2','header3'], [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3'], ['b1', 'c2', 'c3']]

        puts table.render :unicode, alignments: [:left, :center, :right]

        heading 'custom alignment'
        table = TTY::Table.new header: ['header1', 'header2']
        table << [{value: 'a1', alignment: :right}, 'a2']
        table << ['b1', {value: 'b2', alignment: :center}]

        puts table.render :unicode

        :gui
      end
# Execute TableAlign subcommand taking input from
# a input stream and writing to output stream
#
# sample: output.puts 'OK'
Execute TableAlign subcommand taking input from
a input stream and writing to output stream


Execute TableAlign subcommand taking input from a input stream and writing to output stream
def execute(input: $stdin, output: $stdout)
        heading 'column alignment'
        table = TTY::Table.new ['header1','header2','header3'], [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3'], ['b1', 'c2', 'c3']]
        puts table.render :unicode, alignments: [:left, :center, :right]
        heading 'custom alignment'
        table = TTY::Table.new header: ['header1', 'header2']
        table << [{value: 'a1', alignment: :right}, 'a2']
        table << ['b1', {value: 'b2', alignment: :center}]
        puts table.render :unicode
        :gui
      end
def execute ( input : $stdin , output : $stdout ) heading 'column alignment' table = TTY :: Table . new [ 'header1' , 'header2' , 'header3' ] , [ [ 'a1' , 'a2' , 'a3' ] , [ 'b1' , 'b2' , 'b3' ] , [ 'b1' , 'c2' , 'c3' ] ] puts table . render :unicode , alignments : [ :left , :center , :right ] heading 'custom alignment' table = TTY :: Table . new header : [ 'header1' , 'header2' ] table << [ { value : 'a1' , alignment : :right } , 'a2' ] table << [ 'b1' , { value : 'b2' , alignment : :center } ] puts table . render :unicode :gui end
Execute TableAlign subcommand taking input from
a input stream and writing to output stream
Execute TableAlign subcommand taking input from a input stream and writing to output stream
input
output