import { type $Type } from "https://deno.land/x/dax@0.9.0/mod.ts";
Call Signatures
Methods
Makes a request to the provided URL throwing by default if the response is not successful.
const data = await $.request("https://plugins.dprint.dev/info.json")
.json();
Escapes an argument for the shell when not using the template literal.
This is done by default in the template literal, so you most likely don't need this, but it may be useful when using the command builder.
For example:
const builder = new CommandBuilder()
.command(`echo ${$.escapeArg("some text with spaces")}`);
// equivalent to this:
const builder = new CommandBuilder()
.command(`echo 'some text with spaces'`);
// you may just want to do this though:
const builder = new CommandBuilder()
.command(["echo", "some text with spaces"]);
Gets if the provided path exists asynchronously.
Although there is a potential for a race condition between the time this check is made and the time some code is used, it may not be a big deal to use this in some scenarios and simplify the code a lot.
Logs with potential indentation ($.logIndent
)
and output of commands or request responses.
Note: Everything is logged over stderr.
Similar to $.log
, but logs out the text lighter than usual. This
might be useful for logging out something that's unimportant.
Similar to $.log
, but will bold red the first word if one argument or
first argument if multiple arguments.
Causes all $.log
and like functions to be logged with indentation.
await $.logIndent(async () => {
$.log("This will be indented.");
await $.logIndent(async () => {
$.log("This will indented even more.");
});
});
Sleep for the provided delay.
await $.sleep(1000); // ms
await $.sleep("1.5s");
await $.sleep("100ms");
Does the provided action until it succeeds (does not throw)
or the specified number of retries (count
) is hit.