Programming a CLI

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
RevivalDBM
Member
Member
Posts: 34
Joined: Sun Aug 03, 2008 5:38 am

Programming a CLI

Post by RevivalDBM »

Hello,
Having followed several tutorials I found, and eventually recoding from the start, I've managed to program a basic kernel based on James Molloy's tutorials, with keyboard input. However, I can't work out how the best way to make a CLI is. I have several ideas, but I can't choose which would work best and how to properly implement it without a standard library that I'm used to. Has anyone got any ideas?

Also, I adjusted some of the monitor-related functions which were heavily based on James's tutorials to print "shell>" every time return(the key) is pressed if a variable called climode=1. For some reason, when it starts scrolling off the screen, the first letter, "s" in the "shell>" isn't show and instead there is a blank space. Anyone know what's up with that?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Programming a CLI

Post by Solar »

RevivalDBM wrote:...I can't choose which would work best and how to properly implement it without a standard library that I'm used to.
A shell / CLI is a user-space application. In the timeline of OS development, having some kind of standard library / user-space API available should come first - IMHO.
Every good solution is obvious once you've found it.
RevivalDBM
Member
Member
Posts: 34
Joined: Sun Aug 03, 2008 5:38 am

Re: Programming a CLI

Post by RevivalDBM »

Solar wrote:
RevivalDBM wrote:...I can't choose which would work best and how to properly implement it without a standard library that I'm used to.
A shell / CLI is a user-space application. In the timeline of OS development, having some kind of standard library / user-space API available should come first - IMHO.
Come to think of it, you're probably right. However, I think that a basic CLI within the kernel supporting only some basic commands would help until my kernel evolves to the point the CLI can be removed from the kernel and become just a user mode application.
Last edited by RevivalDBM on Tue Aug 12, 2008 5:14 am, edited 1 time in total.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Programming a CLI

Post by AJ »

Hi,

A CLI can be a useful debugging tool. My own plan is to add a basic kernel "debug mode" CLI early on - with built in debugger. The next stage is to write user mode services. At this point, the "debug CLI" becomes a user mode app and is stripped out of the kernel. Of course, this requires some careful interface planning to ensure that not too much of the kernel/CLI need rewriting once the debugger becomes a separate binary.

Cheers,
Adam
Post Reply