Command Line

From OSDev.wiki
Revision as of 12:28, 6 July 2019 by osdev>Eekee (→‎Disadvantages: +Serial bugs; +Usability stub)
Jump to navigation Jump to search
This page is a stub.
You can help the wiki by accurately adding more contents to it.

The Command Line Interface or CLI is an interface which accepts commands from the user, similar to Windows Command Prompt or Linux Terminal. Check also Text UI.

Implementation

To implement a minimal CLI, an operating systems needs at least:

  • Access to video memory
  • Keyboard driver
  • String input and comparison
  • Some functions to execute on commands

Because of their ease of implementation, CLI's are popular in hobby OS projects.

Advantages

  • Speed and control
  • Less resources needed
  • Scripts to automate tasks
  • No need for mouse devices and drivers
  • Easily made compatible with serial lines and tcp sockets, so you can get your normal command environment when debugging display drivers or window system

Disadvantages

Serial-related bugs

Use over a serial line, real or simulated, restricts available key combinations and usually introduces some bugs. Even the newest terminal emulators for POSIX systems operate over a simulated serial line. These bugs stem from 4 causes: in-band signalling, state mismatch, protocol incompatibilities, and unprintable characters.

State mismatch and in-band signalling issues impact smart command line interfaces more than 2D TUI because many programs use the same serial line without adequate multiplexing. See for example bash's behaviour when you start vi, resize the xterm, then quit vi. bash doesn't know about the changed size.

Protocol mismatch generally concerns the keyboard these days: few ANSI terminals implement the required VT-102 keyboard, but some do. Output incompatibilities are relatively common in terminal emulators from before about 2003-5, notably XTerm. Physical terminals may, of course, have bugs in ROM.

All these bugs could be mitigated by a proper terminal driver architecture, but this isn't how things are done in POSIX systems. Dumb terminals also mitigate the bugs by having no state and few control codes, and generally aren't entirely dumb. Most support backspace, allowing surprisingly good command-line editing with a bit of software support.

Usability Issues

This page is a stub.
You can help the wiki by accurately adding more contents to it.

Some users simply have problems getting comfortable with CLIs. The reasons vary.

Typing ToDo: spelling of commands (especially abbreviations), ...

Knowledge ToDo: familiar design vs. help, online help, hiding vs showing possibilities (hiding good for the easily overwhelmed but has negatives for everyone), ...