log in

Command line questions

Luke Breuer
2007-05-01 22:37 UTC
tags: question

  • Is there a document somewhere that describes command line principles?
  • How should command line info be stored in the executable?
    • Perhaps an array like {short_switch, long_switch, data_type, short_description, long_description, default_value, sample_value} ?
  • What should the standard switches be? (see the GNU CoreUtils Common Options for examples)
    • One common option could be --explain, which will take a given command string and list each argument along with its [calculated] value and the short_description from above.
    • Another could be --noaction or --donothing, where validation routines are run on the arguments but no actual changes are made.
  • Might intellisense for a shell be useful, if parameter info is stored as described above?
  • What is the standard for passing a list of filenames to a CLI app which are more than a simple "*.txt"? stdin?
  • standard ways of getting data in and out of a CLI program?
    • first we have the pipeline, but that typically allows only one input stream and two output streams (stdout and stderr)
    • backticks for executing commands and dumping their contents
      • insane escaping when one nests these
  • argtable is a C utility to parse GNU-style command line arguments.
  • aliasing of commands
  • wildard matching
  • start other programs easily
  • command history retrieval and modification
  • handling of multiple line input
  • redirection to file (>, >>, stdout & stderr)
There are switch arguments, like -file a.txt, as well as positional arguments, which either immediately follow a program name or otherwise aren't valid switch arguments (any the switch already would already have an argument).