Repository
Current version released
2 years ago
Versions
- 0.6.72Latest
- 0.6.71
- 0.6.70
- 0.6.69
- 0.6.68
- 0.6.67
- 0.6.66
- 0.6.65
- 0.6.64
- 0.6.63
- 0.6.62
- 0.6.61
- 0.6.60
- 0.6.59
- 0.6.58
- 0.6.57
- 0.6.56
- 0.6.55
- 0.6.54
- 0.6.53
- 0.6.52
- 0.6.51
- 0.6.50
- 0.6.49
- 0.6.48
- 0.6.47
- 0.6.46
- 0.6.44
- 0.6.43
- 0.6.42
- 0.6.41
- 0.6.40
- 0.6.39
- 0.6.38
- 0.6.37
- 0.6.36
- 0.6.35
- 0.6.34
- 0.6.33
- 0.6.32
- 0.6.31
- 0.6.30
- 0.6.29
- 0.6.28
- 0.6.27
- 0.6.26
- 0.6.25
- 0.6.24
- 0.6.23
- 0.6.22
- 0.6.21
- 0.6.20
- 0.6.19
- 0.6.18
- 0.6.17
- 0.6.16
- 0.6.15
- 0.6.14
- 0.6.13
- 0.6.12
- 0.6.11.dev
- 0.6.10.dev
- 0.6.9.dev
- 0.6.9
- 0.6.8
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.48
- 0.3.47
- 0.3.46
- 0.3.45
- 0.3.44
- 0.3.43
- 0.3.42
- 0.3.41
- 0.3.40
- 0.3.39
- 0.3.38
- 0.3.37
- 0.3.36
- 0.3.35
- 0.3.34
- 0.3.33
- 0.3.32
- 0.3.31
- 0.3.30
- 0.3.29
- 0.3.28
- 0.3.27
- 0.3.26
- 0.3.25
- 0.3.24
- 0.3.23
- 0.3.22
- 0.3.21
- 0.3.20
- 0.3.19
- 0.3.18
- 0.3.17
- 0.3.16
- 0.3.15
- 0.3.14
- 0.3.13
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.2.3
- 0.2.2
- 0.2.1
- 0.1.2
- 0.1.1
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
Quickr: Get Stuff Done
Simple APIโs, and a flat dependency structure. Currently in Beta.
- FileSystem (folder iteration, setting permissions, etc)
- Run (subprocesses)
- Console (colors, cli inputs, etc)
Examples
import { FileSystem, glob } from "https://deno.land/x/quickr@0.6.31/main/file_system.js"
import { run, throwIfFails, zipInto, mergeInto, returnAsString, Timeout, Env, Cwd, Stdin, Stdout, Stderr, Out, Overwrite, AppendTo } from "https://deno.land/x/quickr@0.6.31/main/run.js"
import { Console, clearAnsiStylesFrom, black, white, red, green, blue, yellow, cyan, magenta, lightBlack, lightWhite, lightRed, lightGreen, lightBlue, lightYellow, lightMagenta, lightCyan, blackBackground, whiteBackground, redBackground, greenBackground, blueBackground, yellowBackground, magentaBackground, cyanBackground, lightBlackBackground, lightRedBackground, lightGreenBackground, lightYellowBackground, lightBlueBackground, lightMagentaBackground, lightCyanBackground, lightWhiteBackground, bold, reset, dim, italic, underline, inverse, strikethrough, gray, grey, lightGray, lightGrey, grayBackground, greyBackground, lightGrayBackground, lightGreyBackground, } from "https://deno.land/x/quickr@0.6.31/main/console.js"
Run.js
import { run, hasCommand, throwIfFails, zipInto, mergeInto, returnAsString, Timeout, Env, Cwd, Stdin, Stdout, Stderr, Out, Overwrite, AppendTo } from "https://deno.land/x/quickr@0.6.31/main/run.js"
// runs async
run("echo", "hello")
// wait for a command
await run("echo", "hello")
// get outcome
var { success, exitCode } = await run("echo", "hello").outcome
// send stdin (a string, a file, or a stream)
await run("cat", Stdin("Bang\n")).outcome
// send stdin, but later
var {stdin} = run("cat", Stdin())
// send a string
stdin.send("Bang Bang\n")
// or send raw bytes (normally from reading a file or stream directly)
stdin.send(new TextEncoder().encode("Bang Bang\n"))
// (cant send file objects and streams yet, but maybe in the future)
// CLOSE IT! otherwise the process will never end!
await stdin.close()
// get output string as return value
const pathToGrep = await run("which", "grep", Out(returnAsString))
console.debug(`pathToGrep is:`,pathToGrep)
// get output string as return value
const miscOutput = await run("deno", "eval", "console.log('hi1')\nsetTimeout(()=>console.log('bye'),1000)", Out(returnAsString))
console.debug(`miscOutput is:`,miscOutput)
// append to a file (give a path or a Deno file object)
var success = await run("which", "grep",
Stdout(Overwrite("tests/run.grep_path.txt")),
Stderr(AppendTo("tests/run.errors.log")),
).success
// report status
var process = run("sleep", "5")
let int = setInterval(() => {
console.log(`process.isDone? is:`,process.isDone)
if (process.isDone) {
clearInterval(int)
}
}, 1000);
await process
// create timeouts
var { success, exitCode } = await run("yes", Stdout(null), Timeout({ gentlyBy: 100, waitBeforeUsingForce: 500}))
// do a manual timeout
var process = run("yes", Stdout(null))
setTimeout(() => {
process.kill() // uses force
}, 100)
await process
// do an even more manual timeout
var process = run("yes", Stdout(null))
setTimeout(() => {
// ask to please stop
process.sendSignal("SIGINT")
setTimeout(() => {
if (!process.isDone) {
// murder it
process.sendSignal("SIGKILL")
}
}, 200)
}, 100)