#!/usr/bin/env dub
/+ dub.sdl:
name "gh"
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) gh.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) gh.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;
// ─── auth ────────────────────────────────────────────────────────────────
@((struct) sparkles.core_cli.args.uda.CommandCommand("login",
shortDescription: "Authenticate with a GitHub host",
helpSections: ["description"],
))
struct (struct) gh.AuthLoginAuthLogin
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`h|hostname`, description: "Hostname of the GitHub instance to authenticate with"))
(alias) object.string = stringstring (field) string gh.AuthLogin.hostnamehostname = "github.com";
@((struct) sparkles.core_cli.args.uda.OptionOption(`s|scopes`, description: "Additional OAuth scopes to request. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] gh.AuthLogin.scopesscopes;
@((struct) sparkles.core_cli.args.uda.OptionOption(`p|git-protocol`, allowedValues: ["https", "ssh"]))
(alias) object.string = stringstring (field) string gh.AuthLogin.gitProtocolgitProtocol = "https";
@((struct) sparkles.core_cli.args.uda.OptionOption(`w|web`, description: "Open a browser to authenticate"))
bool (field) bool gh.AuthLogin.webweb;
@((struct) sparkles.core_cli.args.uda.OptionOption(`with-token`, description: "Read token from standard input"))
bool (field) bool gh.AuthLogin.withTokenwithToken;
void void gh.AuthLogin.run!(sparkles.core_cli.args.internal.CommandNode!(Gh))(in sparkles.core_cli.args.internal.CommandNode!(Gh) program) @systemrun(Program)(in (alias) Program = sparkles.core_cli.args.internal.CommandNode!(Gh)Program (parameter) const(sparkles.core_cli.args.internal.CommandNode!(Gh)) programprogram) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold gh auth login} with params:\n globals: --repo='", core.interpolation.InterpolatedExpression!"program.value.repo", string, core.interpolation.InterpolatedLiteral!"', --hostname='", core.interpolation.InterpolatedExpression!"program.value.hostname", string, core.interpolation.InterpolatedLiteral!"'\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold gh auth login} with params:\n globals: --repo='" __param_1, core.interpolation.InterpolatedExpression!"program.value.repo" __param_2, string __param_3, core.interpolation.InterpolatedLiteral!"', --hostname='" __param_4, core.interpolation.InterpolatedExpression!"program.value.hostname" __param_5, string __param_6, core.interpolation.InterpolatedLiteral!"'\n params: " __param_7, core.interpolation.InterpolatedExpression!"prettyPrint(this)" __param_8, string __param_9, core.interpolation.InterpolationFooter footer) @systemditto — defaults to ColorDepth.trueColor.
styledWriteln(i"Running {bold gh auth login} with params:
globals: --repo='$(program.value.repo)', --hostname='$(program.value.hostname)'
params: $(prettyPrint(this))");
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("logout",
shortDescription: "Log out of a GitHub host",
helpSections: ["description"],
))
struct (struct) gh.AuthLogoutAuthLogout
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`h|hostname`, description: "Hostname to forget credentials for"))
(alias) object.string = stringstring (field) string gh.AuthLogout.hostnamehostname = "github.com";
@((struct) sparkles.core_cli.args.uda.OptionOption(`u|user`, description: "User account to log out, when more than one is configured"))
(alias) object.string = stringstring (field) string gh.AuthLogout.useruser;
void void gh.AuthLogout.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 gh auth logout 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!(gh.AuthLogout, void)(in gh.AuthLogout 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: "View authentication status",
helpSections: ["description"],
))
struct (struct) gh.AuthStatusAuthStatus
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`h|hostname`, description: "Restrict the report to a single host"))
(alias) object.string = stringstring (field) string gh.AuthStatus.hostnamehostname;
@((struct) sparkles.core_cli.args.uda.OptionOption(`t|show-token`, description: "Display the auth token in the output"))
bool (field) bool gh.AuthStatus.showTokenshowToken;
void void gh.AuthStatus.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 gh auth status 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!(gh.AuthStatus, void)(in gh.AuthStatus 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("refresh",
shortDescription: "Refresh stored authentication credentials",
helpSections: ["description"],
))
struct (struct) gh.AuthRefreshAuthRefresh
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`h|hostname`, description: "Hostname to refresh credentials for"))
(alias) object.string = stringstring (field) string gh.AuthRefresh.hostnamehostname = "github.com";
@((struct) sparkles.core_cli.args.uda.OptionOption(`s|scopes`, description: "Additional OAuth scopes to request. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] gh.AuthRefresh.scopesscopes;
void void gh.AuthRefresh.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 gh auth refresh 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!(gh.AuthRefresh, void)(in gh.AuthRefresh 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("auth",
shortDescription: "Authenticate gh and git with GitHub",
helpSections: ["description"],
))
struct (struct) gh.AuthAuth
{
@(struct) sparkles.core_cli.args.uda.SubcommandsSubcommands
SumType!((struct) gh.AuthLoginAuthLogin, (struct) gh.AuthLogoutAuthLogout, (struct) gh.AuthStatusAuthStatus, (struct) gh.AuthRefreshAuthRefresh) (field) std.sumtype.SumType!(AuthLogin, AuthLogout, AuthStatus, AuthRefresh) gh.Auth.commandcommand;
}
// ─── repo ────────────────────────────────────────────────────────────────
@((struct) sparkles.core_cli.args.uda.CommandCommand("create",
shortDescription: "Create a new repository",
helpSections: ["description"],
))
struct (struct) gh.RepoCreateRepoCreate
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`d|description`, description: "Description of the repository"))
(alias) object.string = stringstring (field) string gh.RepoCreate.description_description_;
@((struct) sparkles.core_cli.args.uda.OptionOption(`public`, description: "Make the new repository public"))
bool (field) bool gh.RepoCreate.public_public_;
@((struct) sparkles.core_cli.args.uda.OptionOption(`private`, description: "Make the new repository private"))
bool (field) bool gh.RepoCreate.private_private_;
@((struct) sparkles.core_cli.args.uda.OptionOption(`internal`, description: "Make the new repository internal to the organization"))
bool (field) bool gh.RepoCreate.internalinternal;
@((struct) sparkles.core_cli.args.uda.OptionOption(`team`, description: "The team that should have access to this repository"))
(alias) object.string = stringstring (field) string gh.RepoCreate.teamteam;
@((struct) sparkles.core_cli.args.uda.OptionOption(`clone`, description: "Clone the new repository to the local machine"))
bool (field) bool gh.RepoCreate.cloneclone;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("name", optional: true))
(alias) object.string = stringstring (field) string gh.RepoCreate.namename;
void void gh.RepoCreate.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 gh repo create 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!(gh.RepoCreate, void)(in gh.RepoCreate 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("clone",
shortDescription: "Clone a repository locally",
helpSections: ["description"],
))
struct (struct) gh.RepoCloneRepoClone
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`u|upstream-remote-name`, description: "Remote name for the upstream when cloning a fork"))
(alias) object.string = stringstring (field) string gh.RepoClone.upstreamRemoteNameupstreamRemoteName = "upstream";
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("repository"))
(alias) object.string = stringstring (field) string gh.RepoClone.repositoryrepository;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("directory", optional: true))
(alias) object.string = stringstring (field) string gh.RepoClone.directorydirectory;
void void gh.RepoClone.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 gh repo clone 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!(gh.RepoClone, void)(in gh.RepoClone 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("view",
shortDescription: "View a repository",
helpSections: ["description"],
))
struct (struct) gh.RepoViewRepoView
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`w|web`, description: "Open the repository in a web browser"))
bool (field) bool gh.RepoView.webweb;
@((struct) sparkles.core_cli.args.uda.OptionOption(`b|branch`, description: "View the contents on the named branch"))
(alias) object.string = stringstring (field) string gh.RepoView.branchbranch;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("repository", optional: true))
(alias) object.string = stringstring (field) string gh.RepoView.repositoryrepository;
void void gh.RepoView.run!(sparkles.core_cli.args.internal.CommandNode!(Gh))(in sparkles.core_cli.args.internal.CommandNode!(Gh) program) @systemrun(Program)(in (alias) Program = sparkles.core_cli.args.internal.CommandNode!(Gh)Program (parameter) const(sparkles.core_cli.args.internal.CommandNode!(Gh)) programprogram) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold gh repo view} with params:\n globals: --repo='", core.interpolation.InterpolatedExpression!"program.value.repo", string, core.interpolation.InterpolatedLiteral!"', --hostname='", core.interpolation.InterpolatedExpression!"program.value.hostname", string, core.interpolation.InterpolatedLiteral!"'\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold gh repo view} with params:\n globals: --repo='" __param_1, core.interpolation.InterpolatedExpression!"program.value.repo" __param_2, string __param_3, core.interpolation.InterpolatedLiteral!"', --hostname='" __param_4, core.interpolation.InterpolatedExpression!"program.value.hostname" __param_5, string __param_6, core.interpolation.InterpolatedLiteral!"'\n params: " __param_7, core.interpolation.InterpolatedExpression!"prettyPrint(this)" __param_8, string __param_9, core.interpolation.InterpolationFooter footer) @systemditto — defaults to ColorDepth.trueColor.
styledWriteln(i"Running {bold gh repo view} with params:
globals: --repo='$(program.value.repo)', --hostname='$(program.value.hostname)'
params: $(prettyPrint(this))");
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("list",
shortDescription: "List repositories owned by user or organization",
helpSections: ["description"],
))
struct (struct) gh.RepoListRepoList
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`L|limit`, description: "Maximum number of repositories to list"))
int (field) int gh.RepoList.limitlimit = 30;
@((struct) sparkles.core_cli.args.uda.OptionOption(`visibility`, allowedValues: ["public", "private", "internal"]))
(alias) object.string = stringstring (field) string gh.RepoList.visibilityvisibility;
@((struct) sparkles.core_cli.args.uda.OptionOption(`l|language`, description: "Filter by primary language"))
(alias) object.string = stringstring (field) string gh.RepoList.languagelanguage;
@((struct) sparkles.core_cli.args.uda.OptionOption(`source`, description: "Show only non-fork repositories"))
bool (field) bool gh.RepoList.sourcesource;
@((struct) sparkles.core_cli.args.uda.OptionOption(`fork`, description: "Show only forks"))
bool (field) bool gh.RepoList.forkfork;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("owner", optional: true))
(alias) object.string = stringstring (field) string gh.RepoList.ownerowner;
void void gh.RepoList.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 gh repo list 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!(gh.RepoList, void)(in gh.RepoList 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("fork",
shortDescription: "Create a fork of a repository",
helpSections: ["description"],
))
struct (struct) gh.RepoForkRepoFork
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`clone`, description: "Clone the fork after creation"))
bool (field) bool gh.RepoFork.cloneclone;
@((struct) sparkles.core_cli.args.uda.OptionOption(`remote`, description: "Add a git remote for the fork"))
bool (field) bool gh.RepoFork.remoteremote;
@((struct) sparkles.core_cli.args.uda.OptionOption(`org`, description: "The organization to fork into"))
(alias) object.string = stringstring (field) string gh.RepoFork.orgorg;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("repository", optional: true))
(alias) object.string = stringstring (field) string gh.RepoFork.repositoryrepository;
void void gh.RepoFork.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 gh repo fork 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!(gh.RepoFork, void)(in gh.RepoFork 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("repo",
shortDescription: "Work with GitHub repositories",
helpSections: ["description"],
))
struct (struct) gh.RepoRepo
{
@(struct) sparkles.core_cli.args.uda.SubcommandsSubcommands
SumType!((struct) gh.RepoCloneRepoClone, (struct) gh.RepoCreateRepoCreate, (struct) gh.RepoForkRepoFork, (struct) gh.RepoListRepoList, (struct) gh.RepoViewRepoView) (field) std.sumtype.SumType!(RepoClone, RepoCreate, RepoFork, RepoList, RepoView) gh.Repo.commandcommand;
}
// ─── pr ──────────────────────────────────────────────────────────────────
@((struct) sparkles.core_cli.args.uda.CommandCommand("create",
shortDescription: "Create a pull request",
helpSections: ["description"],
))
struct (struct) gh.PrCreatePrCreate
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`t|title`, required: true))
(alias) object.string = stringstring (field) string gh.PrCreate.titletitle;
@((struct) sparkles.core_cli.args.uda.OptionOption(`b|body`, description: "Body of the pull request"))
(alias) object.string = stringstring (field) string gh.PrCreate.body_body_;
@((struct) sparkles.core_cli.args.uda.OptionOption(`B|base`, description: "Branch to merge the pull request into"))
(alias) object.string = stringstring (field) string gh.PrCreate.basebase;
@((struct) sparkles.core_cli.args.uda.OptionOption(`H|head`, description: "Branch the pull request originates from"))
(alias) object.string = stringstring (field) string gh.PrCreate.headhead;
@((struct) sparkles.core_cli.args.uda.OptionOption(`d|draft`, description: "Create the pull request as a draft"))
bool (field) bool gh.PrCreate.draftdraft;
@((struct) sparkles.core_cli.args.uda.OptionOption(`r|reviewer`, description: "Request a review from the given user or team. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] gh.PrCreate.reviewersreviewers;
@((struct) sparkles.core_cli.args.uda.OptionOption(`a|assignee`, description: "Assign the PR to the given user. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] gh.PrCreate.assigneesassignees;
@((struct) sparkles.core_cli.args.uda.OptionOption(`l|label`, description: "Add the given label to the PR. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] gh.PrCreate.labelslabels;
@((struct) sparkles.core_cli.args.uda.OptionOption(`web`, hidden: true))
bool (field) bool gh.PrCreate.webweb;
void void gh.PrCreate.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 gh pr create 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!(gh.PrCreate, void)(in gh.PrCreate 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));
}
}
// ─── shared list filter options ──────────────────────────────────────────
struct (struct) gh.ListFilterOptionsListFilterOptions
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`a|assignee`, description: "Filter by assignee"))
(alias) object.string = stringstring (field) string gh.ListFilterOptions.assigneeassignee;
@((struct) sparkles.core_cli.args.uda.OptionOption(`A|author`, description: "Filter by author"))
(alias) object.string = stringstring (field) string gh.ListFilterOptions.authorauthor;
@((struct) sparkles.core_cli.args.uda.OptionOption(`l|label`, description: "Filter by label. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] gh.ListFilterOptions.labelslabels;
@((struct) sparkles.core_cli.args.uda.OptionOption(`L|limit`, description: "Maximum number of items to fetch"))
int (field) int gh.ListFilterOptions.limitlimit = 30;
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("list",
shortDescription: "List pull requests in a repository",
helpSections: ["description"],
))
struct (struct) gh.PrListPrList
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`s|state`, allowedValues: ["open", "closed", "merged", "all"]))
(alias) object.string = stringstring (field) string gh.PrList.statestate = "open";
@(struct) sparkles.core_cli.args.uda.FlattenUDA to flatten a nested struct of CLI options into the parent command struct.
When a struct field is annotated with @Flatten``, its fields participate in
option parsing, short-option bundling, positional argument assignment, and
validation as if they were declared directly on the enclosing command.
Flatten("Filter Options")
(struct) gh.ListFilterOptionsListFilterOptions (field) gh.ListFilterOptions gh.PrList.filtersfilters;
@((struct) sparkles.core_cli.args.uda.OptionOption(`B|base`, description: "Filter by base branch"))
(alias) object.string = stringstring (field) string gh.PrList.basebase;
void void gh.PrList.run!(sparkles.core_cli.args.internal.CommandNode!(Gh))(in sparkles.core_cli.args.internal.CommandNode!(Gh) program) @systemrun(Program)(in (alias) Program = sparkles.core_cli.args.internal.CommandNode!(Gh)Program (parameter) const(sparkles.core_cli.args.internal.CommandNode!(Gh)) programprogram) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold gh pr list} with params:\n globals: --repo='", core.interpolation.InterpolatedExpression!"program.value.repo", string, core.interpolation.InterpolatedLiteral!"', --hostname='", core.interpolation.InterpolatedExpression!"program.value.hostname", string, core.interpolation.InterpolatedLiteral!"'\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold gh pr list} with params:\n globals: --repo='" __param_1, core.interpolation.InterpolatedExpression!"program.value.repo" __param_2, string __param_3, core.interpolation.InterpolatedLiteral!"', --hostname='" __param_4, core.interpolation.InterpolatedExpression!"program.value.hostname" __param_5, string __param_6, core.interpolation.InterpolatedLiteral!"'\n params: " __param_7, core.interpolation.InterpolatedExpression!"prettyPrint(this)" __param_8, string __param_9, core.interpolation.InterpolationFooter footer) @systemditto — defaults to ColorDepth.trueColor.
styledWriteln(i"Running {bold gh pr list} with params:
globals: --repo='$(program.value.repo)', --hostname='$(program.value.hostname)'
params: $(prettyPrint(this))");
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("view",
shortDescription: "View a pull request",
helpSections: ["description"],
))
struct (struct) gh.PrViewPrView
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`w|web`, description: "Open the pull request in a web browser"))
bool (field) bool gh.PrView.webweb;
@((struct) sparkles.core_cli.args.uda.OptionOption(`c|comments`, description: "View pull request comments"))
bool (field) bool gh.PrView.commentscomments;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("number", optional: true))
(alias) object.string = stringstring (field) string gh.PrView.numbernumber;
void void gh.PrView.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 gh pr view 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!(gh.PrView, void)(in gh.PrView 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("checkout",
aliases: ["co"],
shortDescription: "Check out a pull request in git",
helpSections: ["description"],
))
struct (struct) gh.PrCheckoutPrCheckout
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`b|branch`, description: "Local branch name to use for the checkout"))
(alias) object.string = stringstring (field) string gh.PrCheckout.branchbranch;
@((struct) sparkles.core_cli.args.uda.OptionOption(`detach`, description: "Check out the PR with a detached HEAD"))
bool (field) bool gh.PrCheckout.detachdetach;
@((struct) sparkles.core_cli.args.uda.OptionOption(`f|force`, description: "Reset the existing local branch to the latest PR state"))
bool (field) bool gh.PrCheckout.forceforce;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("number"))
(alias) object.string = stringstring (field) string gh.PrCheckout.numbernumber;
void void gh.PrCheckout.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 gh pr checkout 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!(gh.PrCheckout, void)(in gh.PrCheckout 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("merge",
shortDescription: "Merge a pull request",
helpSections: ["description"],
))
struct (struct) gh.PrMergePrMerge
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`merge-method`, allowedValues: ["merge", "squash", "rebase"]))
(alias) object.string = stringstring (field) string gh.PrMerge.mergeMethodmergeMethod = "merge";
@((struct) sparkles.core_cli.args.uda.OptionOption(`d|delete-branch`, description: "Delete the local and remote branch after the merge"))
bool (field) bool gh.PrMerge.deleteBranchdeleteBranch;
@((struct) sparkles.core_cli.args.uda.OptionOption(`auto`, description: "Enable auto-merge once required checks pass"))
bool (field) bool gh.PrMerge.auto_auto_;
@((struct) sparkles.core_cli.args.uda.OptionOption(`subject`, description: "Subject text for the merge commit"))
(alias) object.string = stringstring (field) string gh.PrMerge.subjectsubject;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("number", optional: true))
(alias) object.string = stringstring (field) string gh.PrMerge.numbernumber;
void void gh.PrMerge.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 gh pr merge 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!(gh.PrMerge, void)(in gh.PrMerge 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("close",
shortDescription: "Close a pull request",
helpSections: ["description"],
))
struct (struct) gh.PrClosePrClose
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`c|comment`, description: "Leave a closing comment on the pull request"))
(alias) object.string = stringstring (field) string gh.PrClose.commentcomment;
@((struct) sparkles.core_cli.args.uda.OptionOption(`d|delete-branch`, description: "Delete the local and remote branch after closing"))
bool (field) bool gh.PrClose.deleteBranchdeleteBranch;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("number"))
(alias) object.string = stringstring (field) string gh.PrClose.numbernumber;
void void gh.PrClose.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 gh pr close 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!(gh.PrClose, void)(in gh.PrClose 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("pr",
shortDescription: "Work with GitHub pull requests",
helpSections: ["description"],
))
struct (struct) gh.PrPr
{
@(struct) sparkles.core_cli.args.uda.SubcommandsSubcommands
SumType!((struct) gh.PrCheckoutPrCheckout, (struct) gh.PrClosePrClose, (struct) gh.PrCreatePrCreate, (struct) gh.PrListPrList, (struct) gh.PrMergePrMerge, (struct) gh.PrViewPrView) (field) std.sumtype.SumType!(PrCheckout, PrClose, PrCreate, PrList, PrMerge, PrView) gh.Pr.commandcommand;
}
// ─── issue ───────────────────────────────────────────────────────────────
@((struct) sparkles.core_cli.args.uda.CommandCommand("create",
shortDescription: "Create a new issue",
helpSections: ["description"],
))
struct (struct) gh.IssueCreateIssueCreate
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`t|title`, required: true))
(alias) object.string = stringstring (field) string gh.IssueCreate.titletitle;
@((struct) sparkles.core_cli.args.uda.OptionOption(`b|body`, description: "Body of the issue"))
(alias) object.string = stringstring (field) string gh.IssueCreate.body_body_;
@((struct) sparkles.core_cli.args.uda.OptionOption(`a|assignee`, description: "Assign the issue to the given user. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] gh.IssueCreate.assigneesassignees;
@((struct) sparkles.core_cli.args.uda.OptionOption(`l|label`, description: "Apply the given label. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] gh.IssueCreate.labelslabels;
@((struct) sparkles.core_cli.args.uda.OptionOption(`m|milestone`, description: "Add the issue to the given milestone"))
(alias) object.string = stringstring (field) string gh.IssueCreate.milestonemilestone;
@((struct) sparkles.core_cli.args.uda.OptionOption(`p|project`, description: "Add the issue to the given project. Can be specified multiple times."))
(alias) object.string = stringstring[] (field) string[] gh.IssueCreate.projectsprojects;
void void gh.IssueCreate.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 gh issue create 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!(gh.IssueCreate, void)(in gh.IssueCreate 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",
shortDescription: "List issues in a repository",
helpSections: ["description"],
))
struct (struct) gh.IssueListIssueList
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`s|state`, allowedValues: ["open", "closed", "all"]))
(alias) object.string = stringstring (field) string gh.IssueList.statestate = "open";
@(struct) sparkles.core_cli.args.uda.FlattenUDA to flatten a nested struct of CLI options into the parent command struct.
When a struct field is annotated with @Flatten``, its fields participate in
option parsing, short-option bundling, positional argument assignment, and
validation as if they were declared directly on the enclosing command.
Flatten("Filter Options")
(struct) gh.ListFilterOptionsListFilterOptions (field) gh.ListFilterOptions gh.IssueList.filtersfilters;
void void gh.IssueList.run!(sparkles.core_cli.args.internal.CommandNode!(Gh))(in sparkles.core_cli.args.internal.CommandNode!(Gh) program) @systemrun(Program)(in (alias) Program = sparkles.core_cli.args.internal.CommandNode!(Gh)Program (parameter) const(sparkles.core_cli.args.internal.CommandNode!(Gh)) programprogram) =>
void sparkles.base.styled_template.styledWriteln!(core.interpolation.InterpolatedLiteral!"Running {bold gh issue list} with params:\n globals: --repo='", core.interpolation.InterpolatedExpression!"program.value.repo", string, core.interpolation.InterpolatedLiteral!"', --hostname='", core.interpolation.InterpolatedExpression!"program.value.hostname", string, core.interpolation.InterpolatedLiteral!"'\n params: ", core.interpolation.InterpolatedExpression!"prettyPrint(this)", string)(core.interpolation.InterpolationHeader header, core.interpolation.InterpolatedLiteral!"Running {bold gh issue list} with params:\n globals: --repo='" __param_1, core.interpolation.InterpolatedExpression!"program.value.repo" __param_2, string __param_3, core.interpolation.InterpolatedLiteral!"', --hostname='" __param_4, core.interpolation.InterpolatedExpression!"program.value.hostname" __param_5, string __param_6, core.interpolation.InterpolatedLiteral!"'\n params: " __param_7, core.interpolation.InterpolatedExpression!"prettyPrint(this)" __param_8, string __param_9, core.interpolation.InterpolationFooter footer) @systemditto — defaults to ColorDepth.trueColor.
styledWriteln(i"Running {bold gh issue list} with params:
globals: --repo='$(program.value.repo)', --hostname='$(program.value.hostname)'
params: $(prettyPrint(this))");
}
@((struct) sparkles.core_cli.args.uda.CommandCommand("view",
shortDescription: "View an issue",
helpSections: ["description"],
))
struct (struct) gh.IssueViewIssueView
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`w|web`, description: "Open the issue in a web browser"))
bool (field) bool gh.IssueView.webweb;
@((struct) sparkles.core_cli.args.uda.OptionOption(`c|comments`, description: "View issue comments"))
bool (field) bool gh.IssueView.commentscomments;
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("number"))
(alias) object.string = stringstring (field) string gh.IssueView.numbernumber;
void void gh.IssueView.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 gh issue view 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!(gh.IssueView, void)(in gh.IssueView 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("close",
shortDescription: "Close an issue",
helpSections: ["description"],
))
struct (struct) gh.IssueCloseIssueClose
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`c|comment`, description: "Leave a closing comment on the issue"))
(alias) object.string = stringstring (field) string gh.IssueClose.commentcomment;
@((struct) sparkles.core_cli.args.uda.OptionOption(`r|reason`, allowedValues: ["completed", "not planned"]))
(alias) object.string = stringstring (field) string gh.IssueClose.reasonreason = "completed";
@((struct) sparkles.core_cli.args.uda.ArgumentArgument("number"))
(alias) object.string = stringstring (field) string gh.IssueClose.numbernumber;
void void gh.IssueClose.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 gh issue close 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!(gh.IssueClose, void)(in gh.IssueClose 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("issue",
shortDescription: "Work with GitHub issues",
helpSections: ["description"],
))
struct (struct) gh.IssueIssue
{
@(struct) sparkles.core_cli.args.uda.SubcommandsSubcommands
SumType!((struct) gh.IssueCloseIssueClose, (struct) gh.IssueCreateIssueCreate, (struct) gh.IssueListIssueList, (struct) gh.IssueViewIssueView) (field) std.sumtype.SumType!(IssueClose, IssueCreate, IssueList, IssueView) gh.Issue.commandcommand;
}
// ─── root ────────────────────────────────────────────────────────────────
@((struct) sparkles.core_cli.args.uda.CommandCommand("gh",
shortDescription: "GitHub's official command line tool",
helpSections: ["description", "examples"],
))
struct (struct) gh.GhGh
{
@((struct) sparkles.core_cli.args.uda.OptionOption(`R|repo`, description: "Select another repository using the [HOST/]OWNER/REPO format"))
(alias) object.string = stringstring (field) string gh.Gh.reporepo;
@((struct) sparkles.core_cli.args.uda.OptionOption(`hostname`, description: "Hostname of the GitHub instance"))
(alias) object.string = stringstring (field) string gh.Gh.hostnamehostname;
@(struct) sparkles.core_cli.args.uda.SubcommandsSubcommands
SumType!((struct) gh.AuthAuth, (struct) gh.IssueIssue, (struct) gh.PrPr, (struct) gh.RepoRepo) (field) std.sumtype.SumType!(Auth, Issue, Pr, Repo) gh.Gh.commandcommand;
}
int int D main(string[] args)main((alias) object.string = stringstring[] (parameter) string[] argsargs)
{
return int sparkles.core_cli.args.internal.runCli!(gh.Gh)(string[] argv) @systemrunCli!(struct) gh.GhGh((parameter) string[] argsargs);
}