gh.dhover×440all
#!/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) sparkles
sparkles
.
(package) sparkles.core_cli
core_cli
.
(module) sparkles.core_cli.args
args
;
import
(package) sparkles
sparkles
.
(package) sparkles.base
base
.
(module) sparkles.base.prettyprint
prettyprint
:
(alias template) 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) sparkles
sparkles
.
(package) sparkles.base
base
.
(module) sparkles.base.styled_template

Style template processing for IES (Interpolated Expression Sequences).

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

import sparkles.base.styled_template;

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

Supported syntax:

  • {red text} — Apply single style

  • {bold.red text} — Chain multiple styles

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

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

  • #{ — Escaped literal {

  • #} — Escaped literal }

styled_template
:
(alias template) 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) std
std
.
(module) std.sumtype

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

  • Pattern matching.

  • Support for self-referential types.

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

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

  • No dependency on runtime type information (TypeInfo).

  • Compatibility with BetterC.

List of examples

Source

std/sumtype.d

Examples

Basic usage

import std.math.operations : isClose;

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

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

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

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

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

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

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

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

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

Matching with an overload set

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

For example, with this overload set:

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

Usage would look like this:

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

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

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

Recursive SumTypes

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

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

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

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

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

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

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

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

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

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

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

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

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

assert(eval(*myExpr, myEnv) == 11);
assert(pprint(*myExpr) == "(a + (2 * b))");
@licenseBoost License 1.0@authorsPaul Backus
sumtype
;
// ─── auth ──────────────────────────────────────────────────────────────── @(
(struct) sparkles.core_cli.args.uda.Command
Command
("login",
shortDescription: "Authenticate with a GitHub host", helpSections: ["description"], )) struct
(struct) gh.AuthLogin
AuthLogin
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`h|hostname`, description: "Hostname of the GitHub instance to authenticate with"))
(alias) object.string = string
string
(field) string gh.AuthLogin.hostname
hostname
= "github.com";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`s|scopes`, description: "Additional OAuth scopes to request. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] gh.AuthLogin.scopes
scopes
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`p|git-protocol`, allowedValues: ["https", "ssh"]))
(alias) object.string = string
string
(field) string gh.AuthLogin.gitProtocol
gitProtocol
= "https";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`w|web`, description: "Open a browser to authenticate"))
bool
(field) bool gh.AuthLogin.web
web
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`with-token`, description: "Read token from standard input"))
bool
(field) bool gh.AuthLogin.withToken
withToken
;
void
void gh.AuthLogin.run!(sparkles.core_cli.args.internal.CommandNode!(Gh))(in sparkles.core_cli.args.internal.CommandNode!(Gh) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Gh)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Gh)) program
program
) =>
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) @system

ditto — 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.Command
Command
("logout",
shortDescription: "Log out of a GitHub host", helpSections: ["description"], )) struct
(struct) gh.AuthLogout
AuthLogout
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`h|hostname`, description: "Hostname to forget credentials for"))
(alias) object.string = string
string
(field) string gh.AuthLogout.hostname
hostname
= "github.com";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`u|user`, description: "User account to log out, when more than one is configured"))
(alias) object.string = string
string
(field) string gh.AuthLogout.user
user
;
void
void gh.AuthLogout.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("status",
shortDescription: "View authentication status", helpSections: ["description"], )) struct
(struct) gh.AuthStatus
AuthStatus
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`h|hostname`, description: "Restrict the report to a single host"))
(alias) object.string = string
string
(field) string gh.AuthStatus.hostname
hostname
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`t|show-token`, description: "Display the auth token in the output"))
bool
(field) bool gh.AuthStatus.showToken
showToken
;
void
void gh.AuthStatus.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("refresh",
shortDescription: "Refresh stored authentication credentials", helpSections: ["description"], )) struct
(struct) gh.AuthRefresh
AuthRefresh
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`h|hostname`, description: "Hostname to refresh credentials for"))
(alias) object.string = string
string
(field) string gh.AuthRefresh.hostname
hostname
= "github.com";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`s|scopes`, description: "Additional OAuth scopes to request. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] gh.AuthRefresh.scopes
scopes
;
void
void gh.AuthRefresh.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("auth",
shortDescription: "Authenticate gh and git with GitHub", helpSections: ["description"], )) struct
(struct) gh.Auth
Auth
{ @
(struct) sparkles.core_cli.args.uda.Subcommands
Subcommands
SumType!(
(struct) gh.AuthLogin
AuthLogin
,
(struct) gh.AuthLogout
AuthLogout
,
(struct) gh.AuthStatus
AuthStatus
,
(struct) gh.AuthRefresh
AuthRefresh
)
(field) std.sumtype.SumType!(AuthLogin, AuthLogout, AuthStatus, AuthRefresh) gh.Auth.command
command
;
} // ─── repo ──────────────────────────────────────────────────────────────── @(
(struct) sparkles.core_cli.args.uda.Command
Command
("create",
shortDescription: "Create a new repository", helpSections: ["description"], )) struct
(struct) gh.RepoCreate
RepoCreate
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`d|description`, description: "Description of the repository"))
(alias) object.string = string
string
(field) string gh.RepoCreate.description_
description_
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`public`, description: "Make the new repository public"))
bool
(field) bool gh.RepoCreate.public_
public_
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`private`, description: "Make the new repository private"))
bool
(field) bool gh.RepoCreate.private_
private_
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`internal`, description: "Make the new repository internal to the organization"))
bool
(field) bool gh.RepoCreate.internal
internal
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`team`, description: "The team that should have access to this repository"))
(alias) object.string = string
string
(field) string gh.RepoCreate.team
team
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`clone`, description: "Clone the new repository to the local machine"))
bool
(field) bool gh.RepoCreate.clone
clone
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("name", optional: true))
(alias) object.string = string
string
(field) string gh.RepoCreate.name
name
;
void
void gh.RepoCreate.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("clone",
shortDescription: "Clone a repository locally", helpSections: ["description"], )) struct
(struct) gh.RepoClone
RepoClone
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`u|upstream-remote-name`, description: "Remote name for the upstream when cloning a fork"))
(alias) object.string = string
string
(field) string gh.RepoClone.upstreamRemoteName
upstreamRemoteName
= "upstream";
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("repository"))
(alias) object.string = string
string
(field) string gh.RepoClone.repository
repository
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("directory", optional: true))
(alias) object.string = string
string
(field) string gh.RepoClone.directory
directory
;
void
void gh.RepoClone.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("view",
shortDescription: "View a repository", helpSections: ["description"], )) struct
(struct) gh.RepoView
RepoView
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`w|web`, description: "Open the repository in a web browser"))
bool
(field) bool gh.RepoView.web
web
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`b|branch`, description: "View the contents on the named branch"))
(alias) object.string = string
string
(field) string gh.RepoView.branch
branch
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("repository", optional: true))
(alias) object.string = string
string
(field) string gh.RepoView.repository
repository
;
void
void gh.RepoView.run!(sparkles.core_cli.args.internal.CommandNode!(Gh))(in sparkles.core_cli.args.internal.CommandNode!(Gh) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Gh)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Gh)) program
program
) =>
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) @system

ditto — 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.Command
Command
("list",
shortDescription: "List repositories owned by user or organization", helpSections: ["description"], )) struct
(struct) gh.RepoList
RepoList
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`L|limit`, description: "Maximum number of repositories to list"))
int
(field) int gh.RepoList.limit
limit
= 30;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`visibility`, allowedValues: ["public", "private", "internal"]))
(alias) object.string = string
string
(field) string gh.RepoList.visibility
visibility
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`l|language`, description: "Filter by primary language"))
(alias) object.string = string
string
(field) string gh.RepoList.language
language
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`source`, description: "Show only non-fork repositories"))
bool
(field) bool gh.RepoList.source
source
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`fork`, description: "Show only forks"))
bool
(field) bool gh.RepoList.fork
fork
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("owner", optional: true))
(alias) object.string = string
string
(field) string gh.RepoList.owner
owner
;
void
void gh.RepoList.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("fork",
shortDescription: "Create a fork of a repository", helpSections: ["description"], )) struct
(struct) gh.RepoFork
RepoFork
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`clone`, description: "Clone the fork after creation"))
bool
(field) bool gh.RepoFork.clone
clone
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`remote`, description: "Add a git remote for the fork"))
bool
(field) bool gh.RepoFork.remote
remote
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`org`, description: "The organization to fork into"))
(alias) object.string = string
string
(field) string gh.RepoFork.org
org
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("repository", optional: true))
(alias) object.string = string
string
(field) string gh.RepoFork.repository
repository
;
void
void gh.RepoFork.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("repo",
shortDescription: "Work with GitHub repositories", helpSections: ["description"], )) struct
(struct) gh.Repo
Repo
{ @
(struct) sparkles.core_cli.args.uda.Subcommands
Subcommands
SumType!(
(struct) gh.RepoClone
RepoClone
,
(struct) gh.RepoCreate
RepoCreate
,
(struct) gh.RepoFork
RepoFork
,
(struct) gh.RepoList
RepoList
,
(struct) gh.RepoView
RepoView
)
(field) std.sumtype.SumType!(RepoClone, RepoCreate, RepoFork, RepoList, RepoView) gh.Repo.command
command
;
} // ─── pr ────────────────────────────────────────────────────────────────── @(
(struct) sparkles.core_cli.args.uda.Command
Command
("create",
shortDescription: "Create a pull request", helpSections: ["description"], )) struct
(struct) gh.PrCreate
PrCreate
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`t|title`, required: true))
(alias) object.string = string
string
(field) string gh.PrCreate.title
title
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`b|body`, description: "Body of the pull request"))
(alias) object.string = string
string
(field) string gh.PrCreate.body_
body_
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`B|base`, description: "Branch to merge the pull request into"))
(alias) object.string = string
string
(field) string gh.PrCreate.base
base
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`H|head`, description: "Branch the pull request originates from"))
(alias) object.string = string
string
(field) string gh.PrCreate.head
head
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`d|draft`, description: "Create the pull request as a draft"))
bool
(field) bool gh.PrCreate.draft
draft
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`r|reviewer`, description: "Request a review from the given user or team. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] gh.PrCreate.reviewers
reviewers
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`a|assignee`, description: "Assign the PR to the given user. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] gh.PrCreate.assignees
assignees
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`l|label`, description: "Add the given label to the PR. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] gh.PrCreate.labels
labels
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`web`, hidden: true))
bool
(field) bool gh.PrCreate.web
web
;
void
void gh.PrCreate.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } // ─── shared list filter options ────────────────────────────────────────── struct
(struct) gh.ListFilterOptions
ListFilterOptions
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`a|assignee`, description: "Filter by assignee"))
(alias) object.string = string
string
(field) string gh.ListFilterOptions.assignee
assignee
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`A|author`, description: "Filter by author"))
(alias) object.string = string
string
(field) string gh.ListFilterOptions.author
author
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`l|label`, description: "Filter by label. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] gh.ListFilterOptions.labels
labels
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`L|limit`, description: "Maximum number of items to fetch"))
int
(field) int gh.ListFilterOptions.limit
limit
= 30;
} @(
(struct) sparkles.core_cli.args.uda.Command
Command
("list",
shortDescription: "List pull requests in a repository", helpSections: ["description"], )) struct
(struct) gh.PrList
PrList
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`s|state`, allowedValues: ["open", "closed", "merged", "all"]))
(alias) object.string = string
string
(field) string gh.PrList.state
state
= "open";
@
(struct) sparkles.core_cli.args.uda.Flatten

UDA 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.

@paramgroupHeading Optional heading used to group the flattened options in --help output. If null, options appear under the main OPTIONS section.@paramprefix Optional prefix prepended to long option names (e.g., "diff-" maps layout to --diff-layout).
Flatten
("Filter Options")
(struct) gh.ListFilterOptions
ListFilterOptions
(field) gh.ListFilterOptions gh.PrList.filters
filters
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`B|base`, description: "Filter by base branch"))
(alias) object.string = string
string
(field) string gh.PrList.base
base
;
void
void gh.PrList.run!(sparkles.core_cli.args.internal.CommandNode!(Gh))(in sparkles.core_cli.args.internal.CommandNode!(Gh) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Gh)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Gh)) program
program
) =>
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) @system

ditto — 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.Command
Command
("view",
shortDescription: "View a pull request", helpSections: ["description"], )) struct
(struct) gh.PrView
PrView
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`w|web`, description: "Open the pull request in a web browser"))
bool
(field) bool gh.PrView.web
web
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`c|comments`, description: "View pull request comments"))
bool
(field) bool gh.PrView.comments
comments
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("number", optional: true))
(alias) object.string = string
string
(field) string gh.PrView.number
number
;
void
void gh.PrView.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("checkout",
aliases: ["co"], shortDescription: "Check out a pull request in git", helpSections: ["description"], )) struct
(struct) gh.PrCheckout
PrCheckout
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`b|branch`, description: "Local branch name to use for the checkout"))
(alias) object.string = string
string
(field) string gh.PrCheckout.branch
branch
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`detach`, description: "Check out the PR with a detached HEAD"))
bool
(field) bool gh.PrCheckout.detach
detach
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`f|force`, description: "Reset the existing local branch to the latest PR state"))
bool
(field) bool gh.PrCheckout.force
force
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("number"))
(alias) object.string = string
string
(field) string gh.PrCheckout.number
number
;
void
void gh.PrCheckout.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("merge",
shortDescription: "Merge a pull request", helpSections: ["description"], )) struct
(struct) gh.PrMerge
PrMerge
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`merge-method`, allowedValues: ["merge", "squash", "rebase"]))
(alias) object.string = string
string
(field) string gh.PrMerge.mergeMethod
mergeMethod
= "merge";
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`d|delete-branch`, description: "Delete the local and remote branch after the merge"))
bool
(field) bool gh.PrMerge.deleteBranch
deleteBranch
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`auto`, description: "Enable auto-merge once required checks pass"))
bool
(field) bool gh.PrMerge.auto_
auto_
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`subject`, description: "Subject text for the merge commit"))
(alias) object.string = string
string
(field) string gh.PrMerge.subject
subject
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("number", optional: true))
(alias) object.string = string
string
(field) string gh.PrMerge.number
number
;
void
void gh.PrMerge.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("close",
shortDescription: "Close a pull request", helpSections: ["description"], )) struct
(struct) gh.PrClose
PrClose
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`c|comment`, description: "Leave a closing comment on the pull request"))
(alias) object.string = string
string
(field) string gh.PrClose.comment
comment
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`d|delete-branch`, description: "Delete the local and remote branch after closing"))
bool
(field) bool gh.PrClose.deleteBranch
deleteBranch
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("number"))
(alias) object.string = string
string
(field) string gh.PrClose.number
number
;
void
void gh.PrClose.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("pr",
shortDescription: "Work with GitHub pull requests", helpSections: ["description"], )) struct
(struct) gh.Pr
Pr
{ @
(struct) sparkles.core_cli.args.uda.Subcommands
Subcommands
SumType!(
(struct) gh.PrCheckout
PrCheckout
,
(struct) gh.PrClose
PrClose
,
(struct) gh.PrCreate
PrCreate
,
(struct) gh.PrList
PrList
,
(struct) gh.PrMerge
PrMerge
,
(struct) gh.PrView
PrView
)
(field) std.sumtype.SumType!(PrCheckout, PrClose, PrCreate, PrList, PrMerge, PrView) gh.Pr.command
command
;
} // ─── issue ─────────────────────────────────────────────────────────────── @(
(struct) sparkles.core_cli.args.uda.Command
Command
("create",
shortDescription: "Create a new issue", helpSections: ["description"], )) struct
(struct) gh.IssueCreate
IssueCreate
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`t|title`, required: true))
(alias) object.string = string
string
(field) string gh.IssueCreate.title
title
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`b|body`, description: "Body of the issue"))
(alias) object.string = string
string
(field) string gh.IssueCreate.body_
body_
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`a|assignee`, description: "Assign the issue to the given user. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] gh.IssueCreate.assignees
assignees
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`l|label`, description: "Apply the given label. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] gh.IssueCreate.labels
labels
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`m|milestone`, description: "Add the issue to the given milestone"))
(alias) object.string = string
string
(field) string gh.IssueCreate.milestone
milestone
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`p|project`, description: "Add the issue to the given project. Can be specified multiple times."))
(alias) object.string = string
string
[]
(field) string[] gh.IssueCreate.projects
projects
;
void
void gh.IssueCreate.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("list",
shortDescription: "List issues in a repository", helpSections: ["description"], )) struct
(struct) gh.IssueList
IssueList
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`s|state`, allowedValues: ["open", "closed", "all"]))
(alias) object.string = string
string
(field) string gh.IssueList.state
state
= "open";
@
(struct) sparkles.core_cli.args.uda.Flatten

UDA 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.

@paramgroupHeading Optional heading used to group the flattened options in --help output. If null, options appear under the main OPTIONS section.@paramprefix Optional prefix prepended to long option names (e.g., "diff-" maps layout to --diff-layout).
Flatten
("Filter Options")
(struct) gh.ListFilterOptions
ListFilterOptions
(field) gh.ListFilterOptions gh.IssueList.filters
filters
;
void
void gh.IssueList.run!(sparkles.core_cli.args.internal.CommandNode!(Gh))(in sparkles.core_cli.args.internal.CommandNode!(Gh) program) @system
run
(Program)(in
(alias) Program = sparkles.core_cli.args.internal.CommandNode!(Gh)
Program
(parameter) const(sparkles.core_cli.args.internal.CommandNode!(Gh)) program
program
) =>
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) @system

ditto — 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.Command
Command
("view",
shortDescription: "View an issue", helpSections: ["description"], )) struct
(struct) gh.IssueView
IssueView
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`w|web`, description: "Open the issue in a web browser"))
bool
(field) bool gh.IssueView.web
web
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`c|comments`, description: "View issue comments"))
bool
(field) bool gh.IssueView.comments
comments
;
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("number"))
(alias) object.string = string
string
(field) string gh.IssueView.number
number
;
void
void gh.IssueView.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("close",
shortDescription: "Close an issue", helpSections: ["description"], )) struct
(struct) gh.IssueClose
IssueClose
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`c|comment`, description: "Leave a closing comment on the issue"))
(alias) object.string = string
string
(field) string gh.IssueClose.comment
comment
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`r|reason`, allowedValues: ["completed", "not planned"]))
(alias) object.string = string
string
(field) string gh.IssueClose.reason
reason
= "completed";
@(
(struct) sparkles.core_cli.args.uda.Argument
Argument
("number"))
(alias) object.string = string
string
(field) string gh.IssueClose.number
number
;
void
void gh.IssueClose.run()
run
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

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

There are three layers of I/O:

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

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

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

Source

std/stdio.d

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

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

Params: args = the items to write to stdout

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

import std.stdio;

void main() { string line;

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

} ---

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

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

Example

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

import std.stdio;

void main()
{
    string line;

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

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

Example

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

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
string sparkles.base.prettyprint.prettyPrint!(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 @safe

Convenience overload that returns a string.

prettyPrint
(this));
} } @(
(struct) sparkles.core_cli.args.uda.Command
Command
("issue",
shortDescription: "Work with GitHub issues", helpSections: ["description"], )) struct
(struct) gh.Issue
Issue
{ @
(struct) sparkles.core_cli.args.uda.Subcommands
Subcommands
SumType!(
(struct) gh.IssueClose
IssueClose
,
(struct) gh.IssueCreate
IssueCreate
,
(struct) gh.IssueList
IssueList
,
(struct) gh.IssueView
IssueView
)
(field) std.sumtype.SumType!(IssueClose, IssueCreate, IssueList, IssueView) gh.Issue.command
command
;
} // ─── root ──────────────────────────────────────────────────────────────── @(
(struct) sparkles.core_cli.args.uda.Command
Command
("gh",
shortDescription: "GitHub's official command line tool", helpSections: ["description", "examples"], )) struct
(struct) gh.Gh
Gh
{ @(
(struct) sparkles.core_cli.args.uda.Option
Option
(`R|repo`, description: "Select another repository using the [HOST/]OWNER/REPO format"))
(alias) object.string = string
string
(field) string gh.Gh.repo
repo
;
@(
(struct) sparkles.core_cli.args.uda.Option
Option
(`hostname`, description: "Hostname of the GitHub instance"))
(alias) object.string = string
string
(field) string gh.Gh.hostname
hostname
;
@
(struct) sparkles.core_cli.args.uda.Subcommands
Subcommands
SumType!(
(struct) gh.Auth
Auth
,
(struct) gh.Issue
Issue
,
(struct) gh.Pr
Pr
,
(struct) gh.Repo
Repo
)
(field) std.sumtype.SumType!(Auth, Issue, Pr, Repo) gh.Gh.command
command
;
} int
int D main(string[] args)
main
(
(alias) object.string = string
string
[]
(parameter) string[] args
args
)
{ return
int sparkles.core_cli.args.internal.runCli!(gh.Gh)(string[] argv) @system
runCli
!
(struct) gh.Gh
Gh
(
(parameter) string[] args
args
);
}