dub.dhover×300all
#!/usr/bin/env dub
/+ dub.sdl:
    name "dub"
    dependency "sparkles:core-cli" path="../../../../.."
    targetPath "build"
    // Optimised, assertions live, `debug {}` blocks out — the build every nix
    // artifact uses. Neither `debug` (which compiles those blocks in) nor
    // `release` (which deletes assert *expressions*, side effects included).
    buildType "checked" {
        buildOptions "optimize" "inline" "debugInfo"
    }
+/
// ci: run --help

import 
(package) sparkles
sparkles
.
(package) sparkles.core_cli
core_cli
.
(module) sparkles.core_cli.args
args
;
import
(package) sparkles
sparkles
.
(package) sparkles.base
base
.
(module) sparkles.base.prettyprint
prettyprint
:
(alias template) dub.prettyPrint = sparkles.base.prettyprint.prettyPrint(T, Hook = void)(in T value, in PrettyPrintOptions!Hook opt = PrettyPrintOptions!Hook())

Convenience overload that returns a string.

prettyPrint
;
import
(package) sparkles
sparkles
.
(package) sparkles.base
base
.
(module) sparkles.base.styled_template

Style template processing for IES (Interpolated Expression Sequences).

Provides a template syntax for applying terminal styles to IES strings:

import sparkles.base.styled_template;

int cpu = 75;
styledWriteln(i"CPU: {red $(cpu)%} Status: {green OK}");

Supported syntax:

  • {red text} — Apply single style

  • {bold.red text} — Chain multiple styles

  • {bold outer {red nested}} — Nested blocks (inner inherits outer)

  • {red text {~red normal}} — Negation with ~ removes a style

  • #{ — Escaped literal {

  • #} — Escaped literal }

styled_template
:
(alias template) dub.styledWriteln = sparkles.base.styled_template.styledWriteln(Args...)(ColorDepth depth, InterpolationHeader header, Args args, InterpolationFooter footer)

Write styled IES to stdout with newline.

styledWriteln
;
import
(package) std
std
.
(module) std.sumtype

SumType is a generic discriminated union implementation that uses design-by-introspection to generate safe and efficient code. Its features include:

  • Pattern matching.

  • Support for self-referential types.

  • Full attribute correctness (pure, @safe, @nogc, and nothrow are inferred whenever possible).

  • A type-safe and memory-safe API compatible with DIP 1000 (scope).

  • No dependency on runtime type information (TypeInfo).

  • Compatibility with BetterC.

List of examples

Source

std/sumtype.d

Examples

Basic usage

import std.math.operations : isClose;

struct Fahrenheit { double value; }
struct Celsius { double value; }
struct Kelvin { double value; }

alias Temperature = SumType!(Fahrenheit, Celsius, Kelvin);

// Construct from any of the member types.
Temperature t1 = Fahrenheit(98.6);
Temperature t2 = Celsius(100);
Temperature t3 = Kelvin(273);

// Use pattern matching to access the value.
Fahrenheit toFahrenheit(Temperature t)
{
    return Fahrenheit(
        t.match!(
            (Fahrenheit f) => f.value,
            (Celsius c) => c.value * 9.0/5 + 32,
            (Kelvin k) => k.value * 9.0/5 - 459.4
        )
    );
}

assert(toFahrenheit(t1).value.isClose(98.6));
assert(toFahrenheit(t2).value.isClose(212));
assert(toFahrenheit(t3).value.isClose(32));

// Use ref to modify the value in place.
void freeze(ref Temperature t)
{
    t.match!(
        (ref Fahrenheit f) => f.value = 32,
        (ref Celsius c) => c.value = 0,
        (ref Kelvin k) => k.value = 273
    );
}

freeze(t1);
assert(toFahrenheit(t1).value.isClose(32));

// Use a catch-all handler to give a default result.
bool isFahrenheit(Temperature t)
{
    return t.match!(
        (Fahrenheit f) => true,
        _ => false
    );
}

assert(isFahrenheit(t1));
assert(!isFahrenheit(t2));
assert(!isFahrenheit(t3));

Matching with an overload set

Instead of writing match handlers inline as lambdas, you can write them as overloads of a function. An alias can be used to create an additional overload for the SumType itself.

For example, with this overload set:

string handle(int n) { return "got an int"; }
string handle(string s) { return "got a string"; }
string handle(double d) { return "got a double"; }
alias handle = match!handle;

Usage would look like this:

alias ExampleSumType = SumType!(int, string, double);

ExampleSumType a = 123;
ExampleSumType b = "hello";
ExampleSumType c = 3.14;

assert(a.handle == "got an int");
assert(b.handle == "got a string");
assert(c.handle == "got a double");

Recursive SumTypes

This example makes use of the special placeholder type This to define a recursive data type: an abstract syntax tree for representing simple arithmetic expressions.

import std.functional : partial;
import std.traits : EnumMembers;
import std.typecons : Tuple;

enum Op : string
{
    Plus  = "+",
    Minus = "-",
    Times = "*",
    Div   = "/"
}

// An expression is either
//  - a number,
//  - a variable, or
//  - a binary operation combining two sub-expressions.
alias Expr = SumType!(
    double,
    string,
    Tuple!(Op, "op", This*, "lhs", This*, "rhs")
);

// Shorthand for Tuple!(Op, "op", Expr*, "lhs", Expr*, "rhs"),
// the Tuple type above with Expr substituted for This.
alias BinOp = Expr.Types[2];

// Factory function for number expressions
Expr* num(double value)
{
    return new Expr(value);
}

// Factory function for variable expressions
Expr* var(string name)
{
    return new Expr(name);
}

// Factory function for binary operation expressions
Expr* binOp(Op op, Expr* lhs, Expr* rhs)
{
    return new Expr(BinOp(op, lhs, rhs));
}

// Convenience wrappers for creating BinOp expressions
alias sum  = partial!(binOp, Op.Plus);
alias diff = partial!(binOp, Op.Minus);
alias prod = partial!(binOp, Op.Times);
alias quot = partial!(binOp, Op.Div);

// Evaluate expr, looking up variables in env
double eval(Expr expr, double[string] env)
{
    return expr.match!(
        (double num) => num,
        (string var) => env[var],
        (BinOp bop)
        {
            double lhs = eval(*bop.lhs, env);
            double rhs = eval(*bop.rhs, env);
            final switch (bop.op)
            {
                static foreach (op; EnumMembers!Op)
                {
                    case op:
                        return mixin("lhs" ~ op ~ "rhs");
                }
            }
        }
    );
}

// Return a "pretty-printed" representation of expr
string pprint(Expr expr)
{
    import std.format : format;

    return expr.match!(
        (double num) => "%g".format(num),
        (string var) => var,
        (BinOp bop) => "(%s %s %s)".format(
            pprint(*bop.lhs),
            cast(string) bop.op,
            pprint(*bop.rhs)
        )
    );
}

Expr* myExpr = sum(var("a"), prod(num(2), var("b")));
double[string] myEnv = ["a":3, "b":4, "c":7];

assert(eval(*myExpr, myEnv) == 11);
assert(pprint(*myExpr) == "(a + (2 * b))");
@licenseBoost License 1.0@authorsPaul Backus
sumtype
;
@(
(struct) sparkles.core_cli.args.uda.Command
Command
("build",
aliases: ["b"], shortDescription: "Builds a package (uses the main package in the current working directory by default)", helpSections: ["description"], )) struct
(struct) dub.Build
Build
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`b|build`, allowedValues: [
"debug", "plain", "release", "release-debug", "release-nobounds", "unittest", "profile", "profile-gc", "docs", "ddox", "cov", "unittest-cov", "syntax", ]))
(alias) object.string = string
string
(field) string dub.Build.buildType
buildType
= "debug";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`compiler`, allowedValues: ["dmd", "ldc", "ldc2", "gdc"]))
(alias) object.string = string
string
(field) string dub.Build.compiler
compiler
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`a|arch`))
(alias) object.string = string
string
(field) string dub.Build.arch
arch
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`c|config`))
(alias) object.string = string
string
[]
(field) string[] dub.Build.configs
configs
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`f|force`))
bool
(field) bool dub.Build.force
force
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("combined", description: "Tries to build the whole project in a single compiler run"))
bool
(field) bool dub.Build.combined
combined
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("rdmd", description: "Use rdmd instead of directly invoking the compiler"))
bool
(field) bool dub.Build.rdmd
rdmd
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`build-mode`, allowedValues: ["separate", "allAtOnce", "singleFile"]))
(alias) object.string = string
string
(field) string dub.Build.buildMode
buildMode
= "separate";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("temp-build", description: "Builds the project in the temp folder if possible"))
bool
(field) bool dub.Build.tempBuild
tempBuild
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("package", optional: true))
(alias) object.string = string
string
(field) string dub.Build.packageName
packageName
;
void
void dub.Build.run!(sparkles.core_cli.args.internal.CommandNode!(Dub))(in sparkles.core_cli.args.internal.CommandNode!(Dub) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Dub)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Dub)) program
program
) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold dub build} with params:\n globals: --verbose=", core.interpolation.InterpolatedExpression!"program.value.verbose", const(uint), core.interpolation.InterpolatedLiteral!", --quiet=", core.interpolation.InterpolatedExpression!"program.value.quiet", const(bool), core.interpolation.InterpolatedLiteral!", --color='", core.interpolation.InterpolatedExpression!"program.value.color", string, core.interpolation.InterpolatedLiteral!"'\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold dub build} with params:\n globals: --verbose=" __param_1, core.interpolation.InterpolatedExpression!"program.value.verbose" __param_2, const(uint) __param_3, core.interpolation.InterpolatedLiteral!", --quiet=" __param_4, core.interpolation.InterpolatedExpression!"program.value.quiet" __param_5, const(bool) __param_6, core.interpolation.InterpolatedLiteral!", --color='" __param_7, core.interpolation.InterpolatedExpression!"program.value.color" __param_8, string __param_9, core.interpolation.InterpolatedLiteral!"'\n params: " __param_10, core.interpolation.InterpolatedExpression!"prettyPrint(this)" __param_11, string __param_12, core.interpolation.InterpolationFooter footer) @system

ditto — defaults to ColorDepth.trueColor.

styledWriteln
(i"Running {bold dub build} with params:
globals: --verbose=$(program.value.verbose), --quiet=$(program.value.quiet), --color='$(program.value.color)' params: $(prettyPrint(this))"); } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("run",
aliases: ["r"], shortDescription: "Builds and runs a package", helpSections: ["description"], )) struct
(struct) dub.Run
Run
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`b|build`, allowedValues: [
"debug", "plain", "release", "release-debug", "release-nobounds", "unittest", "profile", "profile-gc", "cov", ]))
(alias) object.string = string
string
(field) string dub.Run.buildType
buildType
= "debug";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`compiler`, allowedValues: ["dmd", "ldc", "ldc2", "gdc"]))
(alias) object.string = string
string
(field) string dub.Run.compiler
compiler
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`c|config`))
(alias) object.string = string
string
[]
(field) string[] dub.Run.configs
configs
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`f|force`))
bool
(field) bool dub.Run.force
force
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("temp-build", description: "Builds in temp directory and runs from there"))
bool
(field) bool dub.Run.tempBuild
tempBuild
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("package", optional: true))
(alias) object.string = string
string
(field) string dub.Run.packageName
packageName
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("program-args", optional: true))
(alias) object.string = string
string
[]
(field) string[] dub.Run.programArgs
programArgs
;
void
void dub.Run.run!(sparkles.core_cli.args.internal.CommandNode!(Dub))(in sparkles.core_cli.args.internal.CommandNode!(Dub) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Dub)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Dub)) program
program
) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold dub run} with params:\n globals: --verbose=", core.interpolation.InterpolatedExpression!"program.value.verbose", const(uint), core.interpolation.InterpolatedLiteral!", --quiet=", core.interpolation.InterpolatedExpression!"program.value.quiet", const(bool), core.interpolation.InterpolatedLiteral!", --color='", core.interpolation.InterpolatedExpression!"program.value.color", string, core.interpolation.InterpolatedLiteral!"'\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold dub run} with params:\n globals: --verbose=" __param_1, core.interpolation.InterpolatedExpression!"program.value.verbose" __param_2, const(uint) __param_3, core.interpolation.InterpolatedLiteral!", --quiet=" __param_4, core.interpolation.InterpolatedExpression!"program.value.quiet" __param_5, const(bool) __param_6, core.interpolation.InterpolatedLiteral!", --color='" __param_7, core.interpolation.InterpolatedExpression!"program.value.color" __param_8, string __param_9, core.interpolation.InterpolatedLiteral!"'\n params: " __param_10, core.interpolation.InterpolatedExpression!"prettyPrint(this)" __param_11, string __param_12, core.interpolation.InterpolationFooter footer) @system

ditto — defaults to ColorDepth.trueColor.

styledWriteln
(i"Running {bold dub run} with params:
globals: --verbose=$(program.value.verbose), --quiet=$(program.value.quiet), --color='$(program.value.color)' params: $(prettyPrint(this))"); } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("test",
aliases: ["t"], shortDescription: "Executes the tests of the selected package", helpSections: ["description"], )) struct
(struct) dub.Test
Test
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`b|build`, allowedValues: [
"unittest", "unittest-cov", "unittest-cov-ctfe", "debug", ]))
(alias) object.string = string
string
(field) string dub.Test.buildType
buildType
= "unittest";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`compiler`, allowedValues: ["dmd", "ldc", "ldc2", "gdc"]))
(alias) object.string = string
string
(field) string dub.Test.compiler
compiler
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`c|config`))
(alias) object.string = string
string
[]
(field) string[] dub.Test.configs
configs
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`f|force`))
bool
(field) bool dub.Test.force
force
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("combined", description: "Tries to build the whole project in a single compiler run"))
bool
(field) bool dub.Test.combined
combined
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("parallel", description: "Runs multiple compiler instances in parallel, if possible"))
bool
(field) bool dub.Test.parallel_
parallel_
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("test", description: "Execute the built test binary after compilation. Pass --no-test to compile without running, e.g. for cross-compilation pipelines."))
bool
(field) bool dub.Test.test_
test_
= true;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("coverage", description: "Enables code coverage statistics to be generated"))
bool
(field) bool dub.Test.coverage
coverage
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("coverage-ctfe", description: "Enables code coverage (including CTFE) statistics to be generated"))
bool
(field) bool dub.Test.coverageCtfe
coverageCtfe
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("main-file", description: "Specifies a custom file containing the main() function to use for running the tests"))
(alias) object.string = string
string
(field) string dub.Test.mainFile
mainFile
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("package", optional: true))
(alias) object.string = string
string
(field) string dub.Test.packageName
packageName
;
void
void dub.Test.run!(sparkles.core_cli.args.internal.CommandNode!(Dub))(in sparkles.core_cli.args.internal.CommandNode!(Dub) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Dub)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Dub)) program
program
) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold dub test} with params:\n globals: --verbose=", core.interpolation.InterpolatedExpression!"program.value.verbose", const(uint), core.interpolation.InterpolatedLiteral!", --quiet=", core.interpolation.InterpolatedExpression!"program.value.quiet", const(bool), core.interpolation.InterpolatedLiteral!", --color='", core.interpolation.InterpolatedExpression!"program.value.color", string, core.interpolation.InterpolatedLiteral!"'\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold dub test} with params:\n globals: --verbose=" __param_1, core.interpolation.InterpolatedExpression!"program.value.verbose" __param_2, const(uint) __param_3, core.interpolation.InterpolatedLiteral!", --quiet=" __param_4, core.interpolation.InterpolatedExpression!"program.value.quiet" __param_5, const(bool) __param_6, core.interpolation.InterpolatedLiteral!", --color='" __param_7, core.interpolation.InterpolatedExpression!"program.value.color" __param_8, string __param_9, core.interpolation.InterpolatedLiteral!"'\n params: " __param_10, core.interpolation.InterpolatedExpression!"prettyPrint(this)" __param_11, string __param_12, core.interpolation.InterpolationFooter footer) @system

ditto — defaults to ColorDepth.trueColor.

styledWriteln
(i"Running {bold dub test} with params:
globals: --verbose=$(program.value.verbose), --quiet=$(program.value.quiet), --color='$(program.value.color)' params: $(prettyPrint(this))"); } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("clean",
shortDescription: "Removes intermediate build files and cached build results", helpSections: ["description"], )) struct
(struct) dub.Clean
Clean
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
("all-packages", description: "Cleans all known packages, regardless of whether they are used by the current package or not"))
bool
(field) bool dub.Clean.allPackages
allPackages
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`root`))
(alias) object.string = string
string
(field) string dub.Clean.rootPath
rootPath
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("package", optional: true))
(alias) object.string = string
string
(field) string dub.Clean.packageName
packageName
;
void
void dub.Clean.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("Running dub clean with params:");
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(dub.Clean, void)(in dub.Clean value, in sparkles.base.prettyprint.PrettyPrintOptions!void opt = PrettyPrintOptions(cast(ushort)2u, cast(ushort)8u, 32u, 80u, true, false)) pure nothrow @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("init",
shortDescription: "Initializes an empty package skeleton", helpSections: ["description"], )) struct
(struct) dub.Init
Init
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(
`t|type`, required: true, allowedValues: ["minimal", "vibe.d", "deimos", "custom"], ))
(alias) object.string = string
string
(field) string dub.Init.type
type
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`f|format`, allowedValues: ["json", "sdl"]))
(alias) object.string = string
string
(field) string dub.Init.format
format
= "json";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`n|non-interactive`))
bool
(field) bool dub.Init.nonInteractive
nonInteractive
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("directory", optional: true))
(alias) object.string = string
string
(field) string dub.Init.directory
directory
;
void
void dub.Init.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("Running dub init with params:");
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(dub.Init, void)(in dub.Init value, in sparkles.base.prettyprint.PrettyPrintOptions!void opt = PrettyPrintOptions(cast(ushort)2u, cast(ushort)8u, 32u, 80u, true, false)) pure nothrow @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("fetch",
shortDescription: "Explicitly retrieves and caches packages", helpSections: ["description"], )) struct
(struct) dub.Fetch
Fetch
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`r|recursive`, description: "Also fetches dependencies of specified packages"))
bool
(field) bool dub.Fetch.recursive
recursive
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`cache`, allowedValues: ["local", "user", "system"]))
(alias) object.string = string
string
(field) string dub.Fetch.cache
cache
= "user";
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("package"))
(alias) object.string = string
string
(field) string dub.Fetch.packageName
packageName
;
void
void dub.Fetch.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("Running dub fetch with params:");
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(dub.Fetch, void)(in dub.Fetch value, in sparkles.base.prettyprint.PrettyPrintOptions!void opt = PrettyPrintOptions(cast(ushort)2u, cast(ushort)8u, 32u, 80u, true, false)) pure nothrow @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("add",
shortDescription: "Adds dependencies to the package file", helpSections: ["description"], )) struct
(struct) dub.Add
Add
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
("recipe", description: "Override path to recipe file (dub.sdl/dub.json)"))
(alias) object.string = string
string
(field) string dub.Add.recipe
recipe
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("packages"))
(alias) object.string = string
string
[]
(field) string[] dub.Add.packages
packages
;
void
void dub.Add.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("Running dub add with params:");
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(dub.Add, void)(in dub.Add value, in sparkles.base.prettyprint.PrettyPrintOptions!void opt = PrettyPrintOptions(cast(ushort)2u, cast(ushort)8u, 32u, 80u, true, false)) pure nothrow @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("remove",
aliases: ["uninstall"], shortDescription: "Removes a cached package", helpSections: ["description"], )) struct
(struct) dub.Remove
Remove
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`n|non-interactive`, description: "Don't enter interactive mode"))
bool
(field) bool dub.Remove.nonInteractive
nonInteractive
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("package"))
(alias) object.string = string
string
(field) string dub.Remove.packageName
packageName
;
void
void dub.Remove.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("Running dub remove with params:");
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(dub.Remove, void)(in dub.Remove value, in sparkles.base.prettyprint.PrettyPrintOptions!void opt = PrettyPrintOptions(cast(ushort)2u, cast(ushort)8u, 32u, 80u, true, false)) pure nothrow @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("upgrade",
shortDescription: "Forces an upgrade of the dependencies", helpSections: ["description"], )) struct
(struct) dub.Upgrade
Upgrade
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`prerelease`, description: "Uses the latest pre-release version, even if release versions are available"))
bool
(field) bool dub.Upgrade.prerelease
prerelease
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`s|sub-packages`, description: "Also upgrades dependencies of all directory based sub packages"))
bool
(field) bool dub.Upgrade.subPackages
subPackages
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`verify`, description: "Updates the project and performs a build; if successful, rewrites the selected versions file"))
bool
(field) bool dub.Upgrade.verify
verify
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`dry-run`, description: "Only print what would be upgraded, but don't actually upgrade anything"))
bool
(field) bool dub.Upgrade.dryRun
dryRun
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("packages", optional: true))
(alias) object.string = string
string
[]
(field) string[] dub.Upgrade.packages
packages
;
void
void dub.Upgrade.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("Running dub upgrade with params:");
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(dub.Upgrade, void)(in dub.Upgrade value, in sparkles.base.prettyprint.PrettyPrintOptions!void opt = PrettyPrintOptions(cast(ushort)2u, cast(ushort)8u, 32u, 80u, true, false)) pure nothrow @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("describe",
shortDescription: "Prints a JSON description of the project and its dependencies", helpSections: ["description"], )) struct
(struct) dub.Describe
Describe
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`data`))
(alias) object.string = string
string
[]
(field) string[] dub.Describe.data
data
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
("data-list", description: "Output --data information separated by newlines instead of spaces"))
bool
(field) bool dub.Describe.dataList
dataList
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`compiler`, allowedValues: ["dmd", "ldc", "ldc2", "gdc"]))
(alias) object.string = string
string
(field) string dub.Describe.compiler
compiler
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`c|config`))
(alias) object.string = string
string
(field) string dub.Describe.config
config
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("package", optional: true))
(alias) object.string = string
string
(field) string dub.Describe.packageName
packageName
;
void
void dub.Describe.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("Running dub describe with params:");
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(dub.Describe, void)(in dub.Describe value, in sparkles.base.prettyprint.PrettyPrintOptions!void opt = PrettyPrintOptions(cast(ushort)2u, cast(ushort)8u, 32u, 80u, true, false)) pure nothrow @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("lint",
shortDescription: "Executes the linter tests of the selected package", helpSections: ["description"], )) struct
(struct) dub.Lint
Lint
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`syntax-check`))
bool
(field) bool dub.Lint.syntaxCheck
syntaxCheck
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`style-check`))
bool
(field) bool dub.Lint.styleCheck
styleCheck
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`report-format`, allowedValues: ["default", "checkstyle", "github"]))
(alias) object.string = string
string
(field) string dub.Lint.reportFormat
reportFormat
= "default";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`report-file`))
(alias) object.string = string
string
(field) string dub.Lint.reportFile
reportFile
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("package", optional: true))
(alias) object.string = string
string
(field) string dub.Lint.packageName
packageName
;
void
void dub.Lint.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("Running dub lint with params:");
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(dub.Lint, void)(in dub.Lint value, in sparkles.base.prettyprint.PrettyPrintOptions!void opt = PrettyPrintOptions(cast(ushort)2u, cast(ushort)8u, 32u, 80u, true, false)) pure nothrow @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("search",
shortDescription: "Search for available packages", helpSections: ["description"], )) struct
(struct) dub.Search
Search
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`skip-registry`, allowedValues: ["none", "standard", "configured", "all"]))
(alias) object.string = string
string
(field) string dub.Search.skipRegistry
skipRegistry
= "none";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`registry`))
(alias) object.string = string
string
(field) string dub.Search.registry
registry
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("query"))
(alias) object.string = string
string
(field) string dub.Search.query
query
;
void
void dub.Search.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
("Running dub search with params:");
void std.stdio.writeln!string(string __param_0) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(dub.Search, void)(in dub.Search value, in sparkles.base.prettyprint.PrettyPrintOptions!void opt = PrettyPrintOptions(cast(ushort)2u, cast(ushort)8u, 32u, 80u, true, false)) pure nothrow @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("dub",
shortDescription: "Package manager and build tool for the D programming language", helpSections: ["description", "examples"], )) struct
(struct) dub.Dub
Dub
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`v|verbose`, counter: true))
uint
(field) uint dub.Dub.verbose
verbose
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`q|quiet`))
bool
(field) bool dub.Dub.quiet
quiet
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`vquiet`))
bool
(field) bool dub.Dub.vquiet
vquiet
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`color`, allowedValues: ["auto", "always", "never"]))
(alias) object.string = string
string
(field) string dub.Dub.color
color
= "auto";
@
(struct) sparkles.core_cli.args.uda.Subcommands
Subcommands
SumType!(
(struct) dub.Add
Add
,
(struct) dub.Build
Build
,
(struct) dub.Clean
Clean
,
(struct) dub.Describe
Describe
,
(struct) dub.Fetch
Fetch
,
(struct) dub.Init
Init
,
(struct) dub.Lint
Lint
,
(struct) dub.Remove
Remove
,
(struct) dub.Run
Run
,
(struct) dub.Search
Search
,
(struct) dub.Test
Test
,
(struct) dub.Upgrade
Upgrade
,
)
(field) std.sumtype.SumType!(Add, Build, Clean, Describe, Fetch, Init, Lint, Remove, Run, Search, Test, Upgrade) dub.Dub.command
command
;
} int
int D main(string[] args)
main
(
(alias) object.string = string
string
[]
(parameter) string[] args
args
)
{ return
int sparkles.core_cli.args.internal.runCli!(dub.Dub)(string[] argv) @system
runCli
!
(struct) dub.Dub
Dub
(
(parameter) string[] args
args
);
}