Skip to content
ConsoleMonster

API Reference

Class

CommandLine

Namespace ConsoleMonster.Interactive
Assembly ConsoleMonster
Modifiers static

Builds the command line equivalent to a set of answers, from each field's parameter name, so every interactive run teaches the non-interactive form. Values are quoted for the chosen style; switches appear only when on.

Inheritance

  • Object
  • CommandLine

Methods

public static String Argument(String name, Object? value, CommandStyle style) #
Returns: String

Formats one argument: -Name value, a list, or a switch.

Parameters

name System.String requiredposition: 0
The parameter name.
value System.Object? requiredposition: 1
A string, number, bool (switch) or list.
style ConsoleMonster.Interactive.CommandStyle requiredposition: 2
The style.

Returns

The argument, or an empty string for an off switch or an empty value.

public static String Join(String command, IEnumerable<String> arguments) #
Returns: String

Joins a command and its arguments, skipping empty ones.

Parameters

command System.String requiredposition: 0
The command.
arguments System.Collections.Generic.IEnumerable<System.String> requiredposition: 1
The arguments.

Returns

The command line.

public static String Parameter(String name, CommandStyle style) #
Returns: String

Formats a parameter name for a style (Domain → -Domain, --domain or /domain).

Parameters

name System.String requiredposition: 0
The name, with or without its prefix.
style ConsoleMonster.Interactive.CommandStyle requiredposition: 1
The style.

Returns

The parameter as written on the command line.

public static String Quote(String value, CommandStyle style) #
Returns: String

Quotes a value when the style needs it.

Parameters

value System.String requiredposition: 0
The value.
style ConsoleMonster.Interactive.CommandStyle requiredposition: 1
The style.

Returns

The value as written on the command line.

public static IReadOnlyList<String> Wrap(String command, Int32 width) #
Returns: IReadOnlyList<String>

Wraps a command line for display, breaking between arguments (a parameter stays with its value) and only inside an argument when it alone is wider than the line.

Parameters

command System.String requiredposition: 0
The command line.
width System.Int32 requiredposition: 1
The line width.

Returns

The lines.