summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0xAB <0xAB@protonmail.com>2017-08-20 17:36:21 +0100
committer0xAB <0xAB@protonmail.com>2017-08-20 17:36:21 +0100
commit7ab051420926a06f8bf7743b75d18a264c3e57ad (patch)
treec86e85d63f04cdc23f2b27a440f1226922b38dcc
parent4a4ab2958c5364f5344364023865b5d0ec2c51f5 (diff)
downloadpry-7ab051420926a06f8bf7743b75d18a264c3e57ad.tar.gz
add clear-screen command.
-rw-r--r--lib/pry/commands/clear_screen.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/pry/commands/clear_screen.rb b/lib/pry/commands/clear_screen.rb
new file mode 100644
index 00000000..45f20ee7
--- /dev/null
+++ b/lib/pry/commands/clear_screen.rb
@@ -0,0 +1,15 @@
+class Pry::Command::ClearScreen < Pry::ClassCommand
+
+ match 'clear-screen'
+ group 'Input and Output'
+ description 'Clear the contents of the screen/window Pry is running in.'
+
+ def process
+ if windows?
+ _pry_.config.system.call(_pry_.output, 'cls')
+ else
+ _pry_.config.system.call(_pry_.output, 'clear')
+ end
+ end
+ Pry::Commands.add_command(self)
+end