#!/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) sparklessparkles.(package) sparkles.core_clicore_cli.(module) sparkles.core_cli.argsargs;
import (package) sparklessparkles.(package) sparkles.basebase.(module) sparkles.base.prettyprintprettyprint : (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) sparklessparkles.(package) sparkles.basebase.(module) sparkles.base.styled_templateStyle 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) stdstd.(module) std.sumtypeSumType 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
Memory corruption (why assignment can be @system)
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))");
sumtype;
private enum (alias) object.string = stringstring[] (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.CommandCommand("start",
shortDescription: "Start (activate) one or more units",
helpSections: ["description"],
))
struct (struct) systemctl.StartStart
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool (field) bool systemctl.Start.noBlocknoBlock;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Start.unitsunits;
void void systemctl.Start.run!(sparkles.core_cli.args.internal.CommandNode!(Systemctl))(in sparkles.core_cli.args.internal.CommandNode!(Systemctl) program) @systemrun(Program)(in (alias) Program = sparkles.core_cli.args.internal.CommandNode!(Systemctl)Program (parameter) const(sparkles.core_cli.args.internal.CommandNode!(Systemctl)) programprogram) =>
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) @systemditto — 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.CommandCommand("stop",
shortDescription: "Stop (deactivate) one or more units",
helpSections: ["description"],
))
struct (struct) systemctl.StopStop
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool (field) bool systemctl.Stop.noBlocknoBlock;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Stop.unitsunits;
void void systemctl.Stop.run!(sparkles.core_cli.args.internal.CommandNode!(Systemctl))(in sparkles.core_cli.args.internal.CommandNode!(Systemctl) program) @systemrun(Program)(in (alias) Program = sparkles.core_cli.args.internal.CommandNode!(Systemctl)Program (parameter) const(sparkles.core_cli.args.internal.CommandNode!(Systemctl)) programprogram) =>
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) @systemditto — 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.CommandCommand("restart",
shortDescription: "Start or restart one or more units",
helpSections: ["description"],
))
struct (struct) systemctl.RestartRestart
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool (field) bool systemctl.Restart.noBlocknoBlock;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Restart.unitsunits;
void void systemctl.Restart.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl restart with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("reload",
shortDescription: "Reload one or more units",
helpSections: ["description"],
))
struct (struct) systemctl.ReloadReload
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool (field) bool systemctl.Reload.noBlocknoBlock;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Reload.unitsunits;
void void systemctl.Reload.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl reload with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("enable",
shortDescription: "Enable one or more unit files",
helpSections: ["description"],
))
struct (struct) systemctl.EnableEnable
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`now`, description: "Start the unit(s) immediately after enabling them"))
bool (field) bool systemctl.Enable.nownow;
@((struct) sparkles.core_cli.args.uda.OptionOption(`runtime`, description: "Make changes only temporarily, lost on the next reboot"))
bool (field) bool systemctl.Enable.runtimeruntime;
@((struct) sparkles.core_cli.args.uda.OptionOption(`force`, description: "When linking unit files, override existing symlinks"))
bool (field) bool systemctl.Enable.forceforce;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Enable.unitsunits;
void void systemctl.Enable.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl enable with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("disable",
shortDescription: "Disable one or more unit files",
helpSections: ["description"],
))
struct (struct) systemctl.DisableDisable
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`now`, description: "Stop the unit(s) immediately after disabling them"))
bool (field) bool systemctl.Disable.nownow;
@((struct) sparkles.core_cli.args.uda.OptionOption(`runtime`, description: "Make changes only temporarily, lost on the next reboot"))
bool (field) bool systemctl.Disable.runtimeruntime;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Disable.unitsunits;
void void systemctl.Disable.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl disable with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("mask",
shortDescription: "Mask one or more units, rendering them impossible to start",
helpSections: ["description"],
))
struct (struct) systemctl.MaskMask
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`now`, description: "Stop the unit(s) immediately after masking them"))
bool (field) bool systemctl.Mask.nownow;
@((struct) sparkles.core_cli.args.uda.OptionOption(`runtime`, description: "Make changes only temporarily, lost on the next reboot"))
bool (field) bool systemctl.Mask.runtimeruntime;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Mask.unitsunits;
void void systemctl.Mask.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl mask with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("unmask",
shortDescription: "Unmask one or more units, allowing them to be started again",
helpSections: ["description"],
))
struct (struct) systemctl.UnmaskUnmask
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`runtime`, description: "Make changes only temporarily, lost on the next reboot"))
bool (field) bool systemctl.Unmask.runtimeruntime;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Unmask.unitsunits;
void void systemctl.Unmask.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl unmask with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("status",
shortDescription: "Show runtime status of one or more units",
helpSections: ["description"],
))
struct (struct) systemctl.StatusStatus
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`l|full`, description: "Don't ellipsize unit names or process trees"))
bool (field) bool systemctl.Status.fullfull;
@((struct) sparkles.core_cli.args.uda.OptionOption(`n|lines`, description: "Number of journal lines to show"))
int (field) int systemctl.Status.lineslines = 10;
@((struct) sparkles.core_cli.args.uda.OptionOption(`no-pager`, description: "Do not pipe output into a pager"))
bool (field) bool systemctl.Status.noPagernoPager;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units", optional: true))
(alias) object.string = stringstring[] (field) string[] systemctl.Status.unitsunits;
void void systemctl.Status.run!(sparkles.core_cli.args.internal.CommandNode!(Systemctl))(in sparkles.core_cli.args.internal.CommandNode!(Systemctl) program) @systemrun(Program)(in (alias) Program = sparkles.core_cli.args.internal.CommandNode!(Systemctl)Program (parameter) const(sparkles.core_cli.args.internal.CommandNode!(Systemctl)) programprogram) =>
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) @systemditto — 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.CommandCommand("is-active",
shortDescription: "Check whether units are active",
helpSections: ["description"],
))
struct (struct) systemctl.IsActiveIsActive
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`q|quiet`, description: "Suppress textual output, only signal via exit code"))
bool (field) bool systemctl.IsActive.quietquiet;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.IsActive.unitsunits;
void void systemctl.IsActive.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl is-active with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("is-enabled",
shortDescription: "Check whether unit files are enabled in the system",
helpSections: ["description"],
))
struct (struct) systemctl.IsEnabledIsEnabled
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`q|quiet`, description: "Suppress textual output, only signal via exit code"))
bool (field) bool systemctl.IsEnabled.quietquiet;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.IsEnabled.unitsunits;
void void systemctl.IsEnabled.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl is-enabled with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("list-units",
shortDescription: "List units currently in memory",
helpSections: ["description"],
))
struct (struct) systemctl.ListUnitsListUnits
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`a|all`, description: "Show all loaded units regardless of state"))
bool (field) bool systemctl.ListUnits.allall;
@((struct) sparkles.core_cli.args.uda.OptionOption(`reverse`, description: "Show reverse dependencies"))
bool (field) bool systemctl.ListUnits.reversereverse;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("patterns", optional: true))
(alias) object.string = stringstring[] (field) string[] systemctl.ListUnits.patternspatterns;
void void systemctl.ListUnits.run!(sparkles.core_cli.args.internal.CommandNode!(Systemctl))(in sparkles.core_cli.args.internal.CommandNode!(Systemctl) program) @systemrun(Program)(in (alias) Program = sparkles.core_cli.args.internal.CommandNode!(Systemctl)Program (parameter) const(sparkles.core_cli.args.internal.CommandNode!(Systemctl)) programprogram) =>
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) @systemditto — 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.CommandCommand("list-unit-files",
shortDescription: "List installed unit files",
helpSections: ["description"],
))
struct (struct) systemctl.ListUnitFilesListUnitFiles
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`a|all`, description: "Show all unit files regardless of enabled-state"))
bool (field) bool systemctl.ListUnitFiles.allall;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("patterns", optional: true))
(alias) object.string = stringstring[] (field) string[] systemctl.ListUnitFiles.patternspatterns;
void void systemctl.ListUnitFiles.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl list-unit-files with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("daemon-reload",
shortDescription: "Reload systemd manager configuration",
helpSections: ["description"],
))
struct (struct) systemctl.DaemonReloadDaemonReload
{
void void systemctl.DaemonReload.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl daemon-reload with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("cat",
shortDescription: "Show files and drop-ins of specified units",
helpSections: ["description"],
))
struct (struct) systemctl.CatCat
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`no-pager`, description: "Do not pipe output into a pager"))
bool (field) bool systemctl.Cat.noPagernoPager;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Cat.unitsunits;
void void systemctl.Cat.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl cat with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("show",
shortDescription: "Show properties of one or more units, jobs, or the manager itself",
helpSections: ["description"],
))
struct (struct) systemctl.ShowShow
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`p|property`, description: "Show only properties matching the given name. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] systemctl.Show.propertiesproperties;
@((struct) sparkles.core_cli.args.uda.OptionOption(`a|all`, description: "Show all properties, including those with empty values"))
bool (field) bool systemctl.Show.allall;
@((struct) sparkles.core_cli.args.uda.OptionOption(`value`, description: "Print only the property values, omitting names"))
bool (field) bool systemctl.Show.valuevalue;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units", optional: true))
(alias) object.string = stringstring[] (field) string[] systemctl.Show.unitsunits;
void void systemctl.Show.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl show with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("edit",
shortDescription: "Edit one or more unit files",
helpSections: ["description"],
))
struct (struct) systemctl.EditEdit
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`full`, description: "Edit the full unit file rather than creating an override drop-in"))
bool (field) bool systemctl.Edit.fullfull;
@((struct) sparkles.core_cli.args.uda.OptionOption(`force`, description: "Create the unit file even if it does not exist"))
bool (field) bool systemctl.Edit.forceforce;
@((struct) sparkles.core_cli.args.uda.OptionOption(`runtime`, description: "Apply edits only at runtime, lost on the next reboot"))
bool (field) bool systemctl.Edit.runtimeruntime;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Edit.unitsunits;
void void systemctl.Edit.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl edit with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("kill",
shortDescription: "Send a signal to processes of a unit",
helpSections: ["description"],
))
struct (struct) systemctl.KillKill
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`s|signal`, description: "Signal name to send (default: SIGTERM)"))
(alias) object.string = stringstring (field) string systemctl.Kill.signalsignal = "SIGTERM";
@((struct) sparkles.core_cli.args.uda.OptionOption(`kill-whom`, allowedValues: ["main", "control", "all"]))
(alias) object.string = stringstring (field) string systemctl.Kill.killWhomkillWhom = "all";
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("units"))
(alias) object.string = stringstring[] (field) string[] systemctl.Kill.unitsunits;
void void systemctl.Kill.run()run()
{
import (package) stdstd.(module) std.stdioCategory 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:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
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) @safeEquivalent 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);
}
}
writeln("Running systemctl kill with params:");
void std.stdio.writeln!string(string __param_0) @safeEquivalent 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);
}
}
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 @safeConvenience overload that returns a string.
prettyPrint(this));
}
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("systemctl",
shortDescription: "Control the systemd system and service manager",
helpSections: ["description", "examples"],
))
struct (struct) systemctl.SystemctlSystemctl
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`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.OptionOption(`user`, description: "Operate on the user service manager of the calling user"))
bool (field) bool systemctl.Systemctl.useruser;
@((struct) sparkles.core_cli.args.uda.OptionOption(`global`, description: "Operate on the global default user-unit configuration"))
bool (field) bool systemctl.Systemctl.globalglobal;
@((struct) sparkles.core_cli.args.uda.OptionOption(`t|type`, allowedValues: (constant) string[] systemctl.unitTypes = ["service", "socket", "target", "device", "mount", "automount", "swap", "timer", "path", "slice", "scope", "snapshot"]unitTypes))
(alias) object.string = stringstring (field) string systemctl.Systemctl.typetype;
@((struct) sparkles.core_cli.args.uda.OptionOption(`state`, description: "Filter units by load/sub/active state, e.g. 'failed' or 'active,running'"))
(alias) object.string = stringstring (field) string systemctl.Systemctl.statestate;
@((struct) sparkles.core_cli.args.uda.OptionOption(`no-pager`, description: "Do not pipe output into a pager"))
bool (field) bool systemctl.Systemctl.noPagernoPager;
@((struct) sparkles.core_cli.args.uda.OptionOption(`no-block`, description: "Do not synchronously wait for the requested operation to finish"))
bool (field) bool systemctl.Systemctl.noBlocknoBlock;
@((struct) sparkles.core_cli.args.uda.OptionOption(`q|quiet`, description: "Suppress informational output, only print errors"))
bool (field) bool systemctl.Systemctl.quietquiet;
@((struct) sparkles.core_cli.args.uda.OptionOption(`v|verbose`, counter: true))
uint (field) uint systemctl.Systemctl.verboseverbose;
@(struct) sparkles.core_cli.args.uda.SubcommandsSubcommands
SumType!(
(struct) systemctl.CatCat,
(struct) systemctl.DaemonReloadDaemonReload,
(struct) systemctl.DisableDisable,
(struct) systemctl.EditEdit,
(struct) systemctl.EnableEnable,
(struct) systemctl.IsActiveIsActive,
(struct) systemctl.IsEnabledIsEnabled,
(struct) systemctl.KillKill,
(struct) systemctl.ListUnitFilesListUnitFiles,
(struct) systemctl.ListUnitsListUnits,
(struct) systemctl.MaskMask,
(struct) systemctl.ReloadReload,
(struct) systemctl.RestartRestart,
(struct) systemctl.ShowShow,
(struct) systemctl.StartStart,
(struct) systemctl.StatusStatus,
(struct) systemctl.StopStop,
(struct) systemctl.UnmaskUnmask,
) (field) std.sumtype.SumType!(Cat, DaemonReload, Disable, Edit, Enable, IsActive, IsEnabled, Kill, ListUnitFiles, ListUnits, Mask, Reload, Restart, Show, Start, Status, Stop, Unmask) systemctl.Systemctl.commandcommand;
}
int int D main(string[] args)main((alias) object.string = stringstring[] (parameter) string[] argsargs)
{
return int sparkles.core_cli.args.internal.runCli!(systemctl.Systemctl)(string[] argv) @systemrunCli!(struct) systemctl.SystemctlSystemctl((parameter) string[] argsargs);
}