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!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With