# Custom CLI

**URL:** <https://www.ruby-forum.com/t/custom-cli/88786>\
**Category:** Ruby\
**Created:** [March 14, 2007, 12:00pm UTC](https://www.ruby-forum.com/t/custom-cli/88786 "2007-03-14T12:00:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesper\_Andersen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@Jesper\_Andersen](https://www.ruby-forum.com/u/Jesper_Andersen)\
**Post date:** [March 14, 2007, 12:00pm UTC](https://www.ruby-forum.com/t/custom-cli/88786/1 "2007-03-14T12:00:18Z")

</div>

I have to create an interface to allow several users to perform various  
tasks over ssh. The users will have different permissions.

I want to create a custom shell/CLI to be set as the users shell when  
they  
log in. The interface should have scroll back, command line editing and  
history like a normal shell. The commands would be custom commands, i.e.  
no relation to system commands.  
Is there any library, framework or something to make this easy with  
ruby?

---

<div class="post-metadata">

**Author:** ![Jesper\_Andersen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@Jesper\_Andersen](https://www.ruby-forum.com/u/Jesper_Andersen)\
**Post date:** [March 14, 2007, 12:13pm UTC](https://www.ruby-forum.com/t/custom-cli/88786/2 "2007-03-14T12:13:20Z")

</div>

`readline` is part of the stdlib. It’s not documented in rdoc, but  
more or less trivial to use once you’ve looked at the examples in the  
distribution.  
-Tim

---

<div class="post-metadata">

**Author:** ![Jesper\_Andersen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@Jesper\_Andersen](https://www.ruby-forum.com/u/Jesper_Andersen)\
**Post date:** [March 14, 2007, 2:56pm UTC](https://www.ruby-forum.com/t/custom-cli/88786/3 "2007-03-14T14:56:01Z")

</div>

On Wed, 14 Mar 2007, Jesper Andersen wrote:

> I have to create an interface to allow several users to perform various  
> tasks over ssh. The users will have different permissions.
> 
> I want to create a custom shell/CLI to be set as the users shell when they  
> log in. The interface should have scroll back, command line editing and  
> history like a normal shell. The commands would be custom commands, i.e.  
> no relation to system commands.  
> Is there any library, framework or something to make this easy with ruby?

i would customize irb. for example

harp:~ \> cat a.rb  
def ls g = ‘\*’  
Dir.glob(g){|entry| puts entry}  
end

def cd d = File.expand\_path(’~’)  
Dir.chdir d  
end

irb:~ \> irb -r ./a.rb  
irb(main):001:0\> ls ‘skype\*’  
skype-1.2.0.18  
skype-1.3.0.53  
skype\_staticQT-1.3.0.53-generic.tar.bz2  
=\> nil

irb(main):002:0\> cd ‘/tmp’  
=\> 0

others have done this extensively - check out the raa

cheers

-a
