smjg.libs.util.commandline

The smjg.libs.util.commandline module provides functions to construct command lines from argument arrays and vice versa.

These functions involve conversion of arguments between two forms:

Since:
0.02
string buildCommandLine(const(immutable(char)[])[] args);

Builds a command line string from an array of arguments.

Params:
const(immutable(char)[])[] args array of arguments in application form.
Returns:
a representation of the arguments that can be entered on the OS command line.
string wcharzToUTF8(const(wchar)* s);

Converts a null-terminated UTF-16 string into a UTF-8 D string.

This is used by the Windows implementation of the command line functions, hence its inclusion here.

Params:
const(wchar)* s a pointer to a null-terminated UTF-16 string.
Returns:
the string converted into UTF-8.
string formatArgument(string arg);

Converts a single argument from application form to command line form.

Todo:
finish implementing on platforms other than Windows.
string[] parseCommandLine(const(char)[] line);

Parses a command line into an argument list.

Params:
const(char)[] line the command line.
Returns:
an array of the arguments in application form.
Todo:
implement on platforms other than Windows.
string[] parseCommandLine();

Parses the current application's command line into an argument list.

Returns:
an array of the arguments in application form. The first element will be the pathname of the executable.
BUGS:
tends to return the MS-DOS form of the application path.
Todo:
implement on platforms other than Windows.
string[] parseCommandLine(const(wchar)* line);

Parses a command line given as a null-terminated UTF-16 string into an argument list.

Params:
const(wchar)* line the command line.
Returns:
an array of the arguments.
Todo:
implement on platforms other than Windows (if necessary).