prevnext   » WIT: Wiimms ISO Tools » Guides » Command Line Interface (CLI)

Command Line Interface (CLI)

Contents

1.   Console Window

Wiimms ISO Tools is a set of command line tools. The is no native graphical user interface (GUI). The user have to type the commands in a text console. The results are printed to the text console too if not redirected.

The advantage is that frequently needed commands can be stored into shell scripts. The WIT tools terminate with different exit codes that can be anlayzed in shell scripts.

1.1   Linux and other Unix derivates

With Linux and other Unix derivates you have the choice between many shell programs like sh, bash, csh, tcsh, ksh and many more.

If you want access to a USB drive (standard for tool wwt) you need special rights; use one of the following methods:

1.1.1   Access a WBFS drive without root privileges

It's possible to work with already formatted WBFS partitions without root privileges.
  1. Create the file /usr/local/bin/wbfs-chmod:
       #!/bin/bash
       /usr/local/bin/wwt find | while read dev
       do
          echo chmod 666 "$dev"
          chmod 666 "$dev"
       done
    
    Do: chmod a+x /usr/local/bin/wbfs-chmod
  2. Add the following line to /etc/sudoers:
       ALL ALL=NOPASSWD: /usr/local/bin/wbfs-chmod
    

Each user can now call sudo wbfs-chmod to change the mode of every WBFS partition to public read and write access. The command must be entered every time when a WBFS drive is plugged in.

1.2   Windows

Windows knows the command prompt/window cmd. It is sometime called DOS Window, but it has nothing to do with DOS.

There are several way to open a command window:

I'm using always the Total Commander and just type cmd to the command line if I want a command window. And the working directory is always the correct one.

If you want access to a USB drive (standard for tool wwt) you need special rights; use one of the following methods:

2.   The command line

The command line is interpreted as a sequence of blank-separated words. BLANK means in general SPACES and TABS, this depends on the used shell.

Each word is interpreted as option (if stating with a minus sign '-') or as parameter else. If the user want that a parameter contains blanks he have to enclose it with single or double quotes: 'one word' or "one word". This removes also the special meaning of certain characters or words to the shell.

Certain characters with special meaning are also different in the different shells. Characters like semicolon (';'), exclamation point ('!'), dollar sign ('$'), percent sign ('%'), number sign ('#'), less sign ('<'), greater sign ('>') and the quotes have very often a special meaning to the shell.

Read your shell documentation for details!

3.   Options

The tools uses the GNU C Library function getopt() to analyze the command line and find out the options.

The WIT tools support short and long options. For example the tools know the options --verbose and --test and the short versions -v and -t. Some options need a parameter like »--source path« (short version: »-s path«). As you see, short options are prefixed with a single minus sign ('-') and long options are prefixed with a double minus sign ('--').

It is normal that every option and every parameter (needed by an option or global) is written as exact one word, but short options can be combined in one word:
--verbose --test is the same as -v -t is the same as -vt.

If a short option takes a parameter it must be the last option of the option list:
-vs path same as -vspath, but -sv path is different.

Long options with parameters can be written in two forms:
--source path same as --source=path.

3.1   Multiple usage of options

If a option is used multiple times the meaning depends of the kind of option. The WIT tools support three kinds of options: Some options cancel the effect of other option. For example only the last appearance of --wdf, --iso, --ciso and --wfs is used to force the output file format.

4.   Global Parameters

All words of the command line, that are not options and not parameters for options, are global parameters.

The order of global parameters is importand. They are analyzed after the options. The tools wit and wwt use the first global parameter as command. All other parameters are used as additional info.

If you want to insert a file, that begins with a minus sign like '-myfile', prefix it with './', because './-myfile' is the same file.

5.   Command Line Expansion

Global parameters and some option parameters allow to read it parameters from files. Just write '@file' instead of 'parameter'.

The cygwin (windows) version interprete '@file' by itself. If using with an option you must prevent this by quoting the option parameter.

6.   Redirect output to a file

If you want to store the output of a comamnd in a file, just append '>path' at the end of the command line. The standard output, but not the error output, is then redirect to the file with the given path.

You can also pipe the output to other tools. Append '| other_command' at the end of the command line. If you append '| tee filename' the output is written to the console and to the file with the given path.