Process.opOpAssign

Append multiple arguments in place (mutating). Equivalent to addArgs.

  1. void opOpAssign(string arg)
  2. void opOpAssign(string[] args)
    struct Process
    void
    opOpAssign
    (
    string op
    )
    (
    in string[] args
    )
    if (
    op == "~"
    )

Examples

Ensure that ~ and ~= work correctly

import unit_threaded.assertions;

auto p = Process("git").withArgs("--git-dir", "/my/path");

// ~ with single string returns new Process, original unchanged
auto p2 = p ~ "clone";
p2._args.should == ["--git-dir", "/my/path", "clone"];
p._args.should == ["--git-dir", "/my/path"];

// ~ with string[] returns new Process, original unchanged
auto p3 = p ~ ["clone", "https://example.com"];
p3._args.should == ["--git-dir", "/my/path", "clone", "https://example.com"];
p._args.should == ["--git-dir", "/my/path"];

// ~ chains correctly
auto p4 = p ~ "clone" ~ "https://example.com";
p4._args.should == ["--git-dir", "/my/path", "clone", "https://example.com"];
p._args.should == ["--git-dir", "/my/path"];

// ~= with single string mutates in place
auto p5 = p.copy();
p5 ~= "status";
p5._args.should == ["--git-dir", "/my/path", "status"];

// ~= with string[] mutates in place
auto p6 = p.copy();
p6 ~= ["log", "--oneline"];
p6._args.should == ["--git-dir", "/my/path", "log", "--oneline"];

Meta