views:

57

answers:

1

Say that I have a system service, and I want to offer a low-level maintenance access to it.

For that purpose, I'd like to create a standalone, console application that somehow connects to server process and lets user type in commands, allow it to use auto-completion and auto-suggestion on single/double TAB press (just like linux bash shell, mysql cli, cmd.exe, and countless others), allow command line editing capabilities (history, cursor keys to move around text..), etc.

Now, it's not that much of a problem to create something like that by rolling my own from scratch, handling user input, scanning pressed keys, and doing correct actions. But, why reinvent the wheel? Is there some library/framework that helps with this kind of problems, just like readline library that offers improved command-line editing capabilities under linux?

Of course, this new "shell" would respond only to valid, domain-specific commands, and would suggest valid arguments, options, switches...

Any ideas? Thanks!

+1  A: 

This sounds like a fit for PowerShell. It is a fully fledged shell, you can create custom shells that host a set of snapins for your domain specific commands (which can be developed in C#), and it also allows remote execution of commands.

On the downside, implementing something for your specific case is not going to be free, as in little work.

Many MS server products now have custom PowerShell "Shells", e.g.

Exchange - http://technet.microsoft.com/en-us/library/dd297939.aspx

Update

The downside is learning a new shell and how to customize it, and one particularly that is object oriented. The rabbit hole goes deep on this, but hand-rolling your own shell functionality can obviously be quite time consuming in itself.

Some linkage:

The book: Windows PowerShell in Action

General: http://www.computerperformance.co.uk/powershell/index.htm

Intro custom command\span-in: http://msdn.microsoft.com/en-us/magazine/cc163293.aspx

chibacity
Can you tell me where to look for more information on the subject? Also, if you don't mind elaborating that downside a little bit - did you mean that if I go down roll-my-own route, or if I try implementing what I want using PS?
mr.b
@mr.b Sorry yes, I meant the downside would be getting to grips with the whole PS thing.
chibacity
Thanks, you were really helpful!
mr.b
PowerShell has also been integrated in Visual Studio: http://visualstudiogallery.msdn.microsoft.com/en-us/67620d8c-93dd-4e57-aa86-c9404acbd7b3
Ozan