Last active
September 21, 2018 09:45
-
-
Save emad-elsaid/b259894caa9a78863b582ecc7a31811a to your computer and use it in GitHub Desktop.
this script uses 'command_tree' gem to define a tree of commands for the terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'command_tree' | |
t = CommandTree::Tree.new | |
# You register functions here to be executed with characters sequence | |
t.register('a', 'Greetings') | |
t.register('ag', 'Greeting') { puts 'hello' } | |
t.register('aG', 'Greeting special') { puts 'hello man.' } # character are case sensitive | |
t.register('as', 'Sup') { puts 'Sup man' } | |
t.register('g', 'Goodbyes') | |
t.register('gg', 'Salam') { puts "Salam man" } | |
t.register('gu', 'See you') { puts "See you tomorrow" } | |
t.show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment