systemctl.dhover×326all
#!/usr/bin/env dub
/+ dub.sdl:
    name "systemctl"
    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) systemctl.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) systemctl.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
;
private enum
(alias) object.string = string
string
[]
(constant) string[] systemctl.unitTypes = ["service", "socket", "target", "device", "mount", "automount", "swap", "timer", "path", "slice", "scope", "snapshot"]
unitTypes
= [
"service", "socket", "target", "device", "mount", "automount", "swap", "timer", "path", "slice", "scope", "snapshot", ]; @(
(struct) sparkles.core_cli.args.uda.Command
Command
("start",
shortDescription: "Start (activate) one or more units", helpSections: ["description"], )) struct
(struct) systemctl.Start
Start
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool
(field) bool systemctl.Start.noBlock
noBlock
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Start.units
units
;
void
void systemctl.Start.run!(sparkles.core_cli.args.internal.CommandNode!(Systemctl))(in sparkles.core_cli.args.internal.CommandNode!(Systemctl) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Systemctl)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Systemctl)) program
program
) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold systemctl start} with params:\n globals: --system=", core.interpolation.InterpolatedExpression!"program.value.system_", const(bool), core.interpolation.InterpolatedLiteral!", --user=", core.interpolation.InterpolatedExpression!"program.value.user", const(bool), core.interpolation.InterpolatedLiteral!", --quiet=", core.interpolation.InterpolatedExpression!"program.value.quiet", const(bool), core.interpolation.InterpolatedLiteral!", --verbose=", core.interpolation.InterpolatedExpression!"program.value.verbose", const(uint), core.interpolation.InterpolatedLiteral!"\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold systemctl start} with params:\n globals: --system=" __param_1, core.interpolation.InterpolatedExpression!"program.value.system_" __param_2, const(bool) __param_3, core.interpolation.InterpolatedLiteral!", --user=" __param_4, core.interpolation.InterpolatedExpression!"program.value.user" __param_5, const(bool) __param_6, core.interpolation.InterpolatedLiteral!", --quiet=" __param_7, core.interpolation.InterpolatedExpression!"program.value.quiet" __param_8, const(bool) __param_9, core.interpolation.InterpolatedLiteral!", --verbose=" __param_10, core.interpolation.InterpolatedExpression!"program.value.verbose" __param_11, const(uint) __param_12, core.interpolation.InterpolatedLiteral!"\n params: " __param_13, core.interpolation.InterpolatedExpression!"prettyPrint(this)" __param_14, string __param_15, core.interpolation.InterpolationFooter footer) @system

ditto — defaults to ColorDepth.trueColor.

styledWriteln
(i"Running {bold systemctl start} with params:
globals: --system=$(program.value.system_), --user=$(program.value.user), --quiet=$(program.value.quiet), --verbose=$(program.value.verbose) params: $(prettyPrint(this))"); } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("stop",
shortDescription: "Stop (deactivate) one or more units", helpSections: ["description"], )) struct
(struct) systemctl.Stop
Stop
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool
(field) bool systemctl.Stop.noBlock
noBlock
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Stop.units
units
;
void
void systemctl.Stop.run!(sparkles.core_cli.args.internal.CommandNode!(Systemctl))(in sparkles.core_cli.args.internal.CommandNode!(Systemctl) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Systemctl)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Systemctl)) program
program
) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold systemctl stop} with params:\n globals: --system=", core.interpolation.InterpolatedExpression!"program.value.system_", const(bool), core.interpolation.InterpolatedLiteral!", --user=", core.interpolation.InterpolatedExpression!"program.value.user", const(bool), core.interpolation.InterpolatedLiteral!", --quiet=", core.interpolation.InterpolatedExpression!"program.value.quiet", const(bool), core.interpolation.InterpolatedLiteral!", --verbose=", core.interpolation.InterpolatedExpression!"program.value.verbose", const(uint), core.interpolation.InterpolatedLiteral!"\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold systemctl stop} with params:\n globals: --system=" __param_1, core.interpolation.InterpolatedExpression!"program.value.system_" __param_2, const(bool) __param_3, core.interpolation.InterpolatedLiteral!", --user=" __param_4, core.interpolation.InterpolatedExpression!"program.value.user" __param_5, const(bool) __param_6, core.interpolation.InterpolatedLiteral!", --quiet=" __param_7, core.interpolation.InterpolatedExpression!"program.value.quiet" __param_8, const(bool) __param_9, core.interpolation.InterpolatedLiteral!", --verbose=" __param_10, core.interpolation.InterpolatedExpression!"program.value.verbose" __param_11, const(uint) __param_12, core.interpolation.InterpolatedLiteral!"\n params: " __param_13, core.interpolation.InterpolatedExpression!"prettyPrint(this)" __param_14, string __param_15, core.interpolation.InterpolationFooter footer) @system

ditto — defaults to ColorDepth.trueColor.

styledWriteln
(i"Running {bold systemctl stop} with params:
globals: --system=$(program.value.system_), --user=$(program.value.user), --quiet=$(program.value.quiet), --verbose=$(program.value.verbose) params: $(prettyPrint(this))"); } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("restart",
shortDescription: "Start or restart one or more units", helpSections: ["description"], )) struct
(struct) systemctl.Restart
Restart
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool
(field) bool systemctl.Restart.noBlock
noBlock
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Restart.units
units
;
void
void systemctl.Restart.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 systemctl restart 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!(systemctl.Restart, void)(in systemctl.Restart 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
("reload",
shortDescription: "Reload one or more units", helpSections: ["description"], )) struct
(struct) systemctl.Reload
Reload
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool
(field) bool systemctl.Reload.noBlock
noBlock
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Reload.units
units
;
void
void systemctl.Reload.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 systemctl reload 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!(systemctl.Reload, void)(in systemctl.Reload 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
("enable",
shortDescription: "Enable one or more unit files", helpSections: ["description"], )) struct
(struct) systemctl.Enable
Enable
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`now`, description: "Start the unit(s) immediately after enabling them"))
bool
(field) bool systemctl.Enable.now
now
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`runtime`, description: "Make changes only temporarily, lost on the next reboot"))
bool
(field) bool systemctl.Enable.runtime
runtime
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`force`, description: "When linking unit files, override existing symlinks"))
bool
(field) bool systemctl.Enable.force
force
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Enable.units
units
;
void
void systemctl.Enable.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 systemctl enable 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!(systemctl.Enable, void)(in systemctl.Enable 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
("disable",
shortDescription: "Disable one or more unit files", helpSections: ["description"], )) struct
(struct) systemctl.Disable
Disable
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`now`, description: "Stop the unit(s) immediately after disabling them"))
bool
(field) bool systemctl.Disable.now
now
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`runtime`, description: "Make changes only temporarily, lost on the next reboot"))
bool
(field) bool systemctl.Disable.runtime
runtime
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Disable.units
units
;
void
void systemctl.Disable.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 systemctl disable 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!(systemctl.Disable, void)(in systemctl.Disable 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
("mask",
shortDescription: "Mask one or more units, rendering them impossible to start", helpSections: ["description"], )) struct
(struct) systemctl.Mask
Mask
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`now`, description: "Stop the unit(s) immediately after masking them"))
bool
(field) bool systemctl.Mask.now
now
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`runtime`, description: "Make changes only temporarily, lost on the next reboot"))
bool
(field) bool systemctl.Mask.runtime
runtime
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Mask.units
units
;
void
void systemctl.Mask.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 systemctl mask 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!(systemctl.Mask, void)(in systemctl.Mask 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
("unmask",
shortDescription: "Unmask one or more units, allowing them to be started again", helpSections: ["description"], )) struct
(struct) systemctl.Unmask
Unmask
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`runtime`, description: "Make changes only temporarily, lost on the next reboot"))
bool
(field) bool systemctl.Unmask.runtime
runtime
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Unmask.units
units
;
void
void systemctl.Unmask.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 systemctl unmask 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!(systemctl.Unmask, void)(in systemctl.Unmask 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
("status",
shortDescription: "Show runtime status of one or more units", helpSections: ["description"], )) struct
(struct) systemctl.Status
Status
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`l|full`, description: "Don't ellipsize unit names or process trees"))
bool
(field) bool systemctl.Status.full
full
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`n|lines`, description: "Number of journal lines to show"))
int
(field) int systemctl.Status.lines
lines
= 10;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`no-pager`, description: "Do not pipe output into a pager"))
bool
(field) bool systemctl.Status.noPager
noPager
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units", optional: true))
(alias) object.string = string
string
[]
(field) string[] systemctl.Status.units
units
;
void
void systemctl.Status.run!(sparkles.core_cli.args.internal.CommandNode!(Systemctl))(in sparkles.core_cli.args.internal.CommandNode!(Systemctl) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Systemctl)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Systemctl)) program
program
) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold systemctl status} with params:\n globals: --system=", core.interpolation.InterpolatedExpression!"program.value.system_", const(bool), core.interpolation.InterpolatedLiteral!", --user=", core.interpolation.InterpolatedExpression!"program.value.user", const(bool), core.interpolation.InterpolatedLiteral!", --no-pager=", core.interpolation.InterpolatedExpression!"program.value.noPager", const(bool), core.interpolation.InterpolatedLiteral!"\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold systemctl status} with params:\n globals: --system=" __param_1, core.interpolation.InterpolatedExpression!"program.value.system_" __param_2, const(bool) __param_3, core.interpolation.InterpolatedLiteral!", --user=" __param_4, core.interpolation.InterpolatedExpression!"program.value.user" __param_5, const(bool) __param_6, core.interpolation.InterpolatedLiteral!", --no-pager=" __param_7, core.interpolation.InterpolatedExpression!"program.value.noPager" __param_8, const(bool) __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 systemctl status} with params:
globals: --system=$(program.value.system_), --user=$(program.value.user), --no-pager=$(program.value.noPager) params: $(prettyPrint(this))"); } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("is-active",
shortDescription: "Check whether units are active", helpSections: ["description"], )) struct
(struct) systemctl.IsActive
IsActive
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`q|quiet`, description: "Suppress textual output, only signal via exit code"))
bool
(field) bool systemctl.IsActive.quiet
quiet
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.IsActive.units
units
;
void
void systemctl.IsActive.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 systemctl is-active 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!(systemctl.IsActive, void)(in systemctl.IsActive 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
("is-enabled",
shortDescription: "Check whether unit files are enabled in the system", helpSections: ["description"], )) struct
(struct) systemctl.IsEnabled
IsEnabled
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`q|quiet`, description: "Suppress textual output, only signal via exit code"))
bool
(field) bool systemctl.IsEnabled.quiet
quiet
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.IsEnabled.units
units
;
void
void systemctl.IsEnabled.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 systemctl is-enabled 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!(systemctl.IsEnabled, void)(in systemctl.IsEnabled 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
("list-units",
shortDescription: "List units currently in memory", helpSections: ["description"], )) struct
(struct) systemctl.ListUnits
ListUnits
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`a|all`, description: "Show all loaded units regardless of state"))
bool
(field) bool systemctl.ListUnits.all
all
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`reverse`, description: "Show reverse dependencies"))
bool
(field) bool systemctl.ListUnits.reverse
reverse
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("patterns", optional: true))
(alias) object.string = string
string
[]
(field) string[] systemctl.ListUnits.patterns
patterns
;
void
void systemctl.ListUnits.run!(sparkles.core_cli.args.internal.CommandNode!(Systemctl))(in sparkles.core_cli.args.internal.CommandNode!(Systemctl) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Systemctl)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Systemctl)) program
program
) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold systemctl list-units} with params:\n globals: --type='", core.interpolation.InterpolatedExpression!"program.value.type", string, core.interpolation.InterpolatedLiteral!"', --state='", core.interpolation.InterpolatedExpression!"program.value.state", string, core.interpolation.InterpolatedLiteral!"', --no-pager=", core.interpolation.InterpolatedExpression!"program.value.noPager", const(bool), core.interpolation.InterpolatedLiteral!"\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold systemctl list-units} with params:\n globals: --type='" __param_1, core.interpolation.InterpolatedExpression!"program.value.type" __param_2, string __param_3, core.interpolation.InterpolatedLiteral!"', --state='" __param_4, core.interpolation.InterpolatedExpression!"program.value.state" __param_5, string __param_6, core.interpolation.InterpolatedLiteral!"', --no-pager=" __param_7, core.interpolation.InterpolatedExpression!"program.value.noPager" __param_8, const(bool) __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 systemctl list-units} with params:
globals: --type='$(program.value.type)', --state='$(program.value.state)', --no-pager=$(program.value.noPager) params: $(prettyPrint(this))"); } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("list-unit-files",
shortDescription: "List installed unit files", helpSections: ["description"], )) struct
(struct) systemctl.ListUnitFiles
ListUnitFiles
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`a|all`, description: "Show all unit files regardless of enabled-state"))
bool
(field) bool systemctl.ListUnitFiles.all
all
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("patterns", optional: true))
(alias) object.string = string
string
[]
(field) string[] systemctl.ListUnitFiles.patterns
patterns
;
void
void systemctl.ListUnitFiles.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 systemctl list-unit-files 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!(systemctl.ListUnitFiles, void)(in systemctl.ListUnitFiles 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
("daemon-reload",
shortDescription: "Reload systemd manager configuration", helpSections: ["description"], )) struct
(struct) systemctl.DaemonReload
DaemonReload
{ void
void systemctl.DaemonReload.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 systemctl daemon-reload 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!(systemctl.DaemonReload, void)(in systemctl.DaemonReload 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
("cat",
shortDescription: "Show files and drop-ins of specified units", helpSections: ["description"], )) struct
(struct) systemctl.Cat
Cat
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`no-pager`, description: "Do not pipe output into a pager"))
bool
(field) bool systemctl.Cat.noPager
noPager
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Cat.units
units
;
void
void systemctl.Cat.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 systemctl cat 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!(systemctl.Cat, void)(in systemctl.Cat 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
("show",
shortDescription: "Show properties of one or more units, jobs, or the manager itself", helpSections: ["description"], )) struct
(struct) systemctl.Show
Show
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`p|property`, description: "Show only properties matching the given name. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] systemctl.Show.properties
properties
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`a|all`, description: "Show all properties, including those with empty values"))
bool
(field) bool systemctl.Show.all
all
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`value`, description: "Print only the property values, omitting names"))
bool
(field) bool systemctl.Show.value
value
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units", optional: true))
(alias) object.string = string
string
[]
(field) string[] systemctl.Show.units
units
;
void
void systemctl.Show.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 systemctl show 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!(systemctl.Show, void)(in systemctl.Show 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
("edit",
shortDescription: "Edit one or more unit files", helpSections: ["description"], )) struct
(struct) systemctl.Edit
Edit
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`full`, description: "Edit the full unit file rather than creating an override drop-in"))
bool
(field) bool systemctl.Edit.full
full
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`force`, description: "Create the unit file even if it does not exist"))
bool
(field) bool systemctl.Edit.force
force
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`runtime`, description: "Apply edits only at runtime, lost on the next reboot"))
bool
(field) bool systemctl.Edit.runtime
runtime
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Edit.units
units
;
void
void systemctl.Edit.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 systemctl edit 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!(systemctl.Edit, void)(in systemctl.Edit 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
("kill",
shortDescription: "Send a signal to processes of a unit", helpSections: ["description"], )) struct
(struct) systemctl.Kill
Kill
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`s|signal`, description: "Signal name to send (default: SIGTERM)"))
(alias) object.string = string
string
(field) string systemctl.Kill.signal
signal
= "SIGTERM";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`kill-whom`, allowedValues: ["main", "control", "all"]))
(alias) object.string = string
string
(field) string systemctl.Kill.killWhom
killWhom
= "all";
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("units"))
(alias) object.string = string
string
[]
(field) string[] systemctl.Kill.units
units
;
void
void systemctl.Kill.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 systemctl kill 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!(systemctl.Kill, void)(in systemctl.Kill 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
("systemctl",
shortDescription: "Control the systemd system and service manager", helpSections: ["description", "examples"], )) struct
(struct) systemctl.Systemctl
Systemctl
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`system`, description: "Operate on the system service manager (the default when run as root)"))
bool
(field) bool systemctl.Systemctl.system_
system_
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`user`, description: "Operate on the user service manager of the calling user"))
bool
(field) bool systemctl.Systemctl.user
user
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`global`, description: "Operate on the global default user-unit configuration"))
bool
(field) bool systemctl.Systemctl.global
global
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`t|type`, allowedValues:
(constant) string[] systemctl.unitTypes = ["service", "socket", "target", "device", "mount", "automount", "swap", "timer", "path", "slice", "scope", "snapshot"]
unitTypes
))
(alias) object.string = string
string
(field) string systemctl.Systemctl.type
type
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`state`, description: "Filter units by load/sub/active state, e.g. 'failed' or 'active,running'"))
(alias) object.string = string
string
(field) string systemctl.Systemctl.state
state
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`no-pager`, description: "Do not pipe output into a pager"))
bool
(field) bool systemctl.Systemctl.noPager
noPager
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool
(field) bool systemctl.Systemctl.noBlock
noBlock
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`q|quiet`, description: "Suppress informational output, only print errors"))
bool
(field) bool systemctl.Systemctl.quiet
quiet
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`v|verbose`, counter: true))
uint
(field) uint systemctl.Systemctl.verbose
verbose
;
@
(struct) sparkles.core_cli.args.uda.Subcommands
Subcommands
SumType!(
(struct) systemctl.Cat
Cat
,
(struct) systemctl.DaemonReload
DaemonReload
,
(struct) systemctl.Disable
Disable
,
(struct) systemctl.Edit
Edit
,
(struct) systemctl.Enable
Enable
,
(struct) systemctl.IsActive
IsActive
,
(struct) systemctl.IsEnabled
IsEnabled
,
(struct) systemctl.Kill
Kill
,
(struct) systemctl.ListUnitFiles
ListUnitFiles
,
(struct) systemctl.ListUnits
ListUnits
,
(struct) systemctl.Mask
Mask
,
(struct) systemctl.Reload
Reload
,
(struct) systemctl.Restart
Restart
,
(struct) systemctl.Show
Show
,
(struct) systemctl.Start
Start
,
(struct) systemctl.Status
Status
,
(struct) systemctl.Stop
Stop
,
(struct) systemctl.Unmask
Unmask
,
)
(field) std.sumtype.SumType!(Cat, DaemonReload, Disable, Edit, Enable, IsActive, IsEnabled, Kill, ListUnitFiles, ListUnits, Mask, Reload, Restart, Show, Start, Status, Stop, Unmask) systemctl.Systemctl.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!(systemctl.Systemctl)(string[] argv) @system
runCli
!
(struct) systemctl.Systemctl
Systemctl
(
(parameter) string[] args
args
);
}