lib/sample_cmdlet_patterns/commands/cursor_clear_move.rb
# Execute CursorClearMove subcommand taking input from
# a input stream and writing to output stream
#
# sample: output.puts 'OK'
Execute CursorClearMove subcommand taking input from
a input stream and writing to output stream


Execute CursorClearMove subcommand taking input from a input stream and writing to output stream
def execute(input: $stdin, output: $stdout)
        cursor = TTY::Cursor
        cursor.clear_screen
        process('Clear screen') { puts cursor.clear_screen }
        process('Clear 11 lines down') { puts cursor.clear_lines(11, :down) }
        process('Move to 1, 13/14 and clear line after') do
          puts cursor.move_to(1, 13)
          puts cursor.clear_line_after
          puts cursor.move_to(1, 14)
          puts cursor.clear_line_after
        end
        process('Move to 1, 15 and clear everything down') do
          puts cursor.move_to(1, 15)
          puts cursor.clear_screen_down
        end
        process('Move to 1, 15 and clear everything up') do
          puts cursor.move_to(1, 15)
          puts cursor.clear_screen_up
        end
        process('Scroll up') do
          prompt.warn @text
          prompt.keypress('', timeout: 2)
          puts cursor.scroll_up
          prompt.error @text
          prompt.keypress('', timeout: 2)
          puts cursor.scroll_up
          prompt.ok @text
          prompt.keypress('', timeout: 2)
          puts cursor.scroll_up
          prompt.warn @text
          prompt.keypress('', timeout: 2)
          puts cursor.scroll_up
          prompt.error @text
          puts cursor.scroll_up
        end
        :gui
      end
def execute ( input : $stdin , output : $stdout ) cursor = TTY :: Cursor cursor . clear_screen process ( 'Clear screen' ) { puts cursor . clear_screen } process ( 'Clear 11 lines down' ) { puts cursor . clear_lines ( 11 , :down ) } process ( 'Move to 1, 13/14 and clear line after' ) do puts cursor . move_to ( 1 , 13 ) puts cursor . clear_line_after puts cursor . move_to ( 1 , 14 ) puts cursor . clear_line_after end process ( 'Move to 1, 15 and clear everything down' ) do puts cursor . move_to ( 1 , 15 ) puts cursor . clear_screen_down end process ( 'Move to 1, 15 and clear everything up' ) do puts cursor . move_to ( 1 , 15 ) puts cursor . clear_screen_up end process ( 'Scroll up' ) do prompt . warn @text prompt . keypress ( '' , timeout : 2 ) puts cursor . scroll_up prompt . error @text prompt . keypress ( '' , timeout : 2 ) puts cursor . scroll_up prompt . ok @text prompt . keypress ( '' , timeout : 2 ) puts cursor . scroll_up prompt . warn @text prompt . keypress ( '' , timeout : 2 ) puts cursor . scroll_up prompt . error @text puts cursor . scroll_up end :gui end
Execute CursorClearMove subcommand taking input from
a input stream and writing to output stream
Execute CursorClearMove subcommand taking input from a input stream and writing to output stream
input
output