sinew
## command-line-interface-tools
Last updated a year ago by brekk .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install sinew 
SYNC missed versions from official npm registry.
  ██████  ██▓ ███▄    █ ▓█████  █     █░
▒██    ▒ ▓██▒ ██ ▀█   █ ▓█   ▀ ▓█░ █ ░█░
░ ▓██▄   ▒██▒▓██  ▀█ ██▒▒███   ▒█░ █ ░█ 
  ▒   ██▒░██░▓██▒  ▐▌██▒▒▓█  ▄ ░█░ █ ░█ 
▒██████▒▒░██░▒██░   ▓██░░▒████▒░░██▒██▓ 
▒ ▒▓▒ ▒ ░░▓  ░ ▒░   ▒ ▒ ░░ ▒░ ░░ ▓░▒ ▒  
░ ░▒  ░ ░ ▒ ░░ ░░   ░ ▒░ ░ ░  ░  ▒ ░ ░  
░  ░  ░   ▒ ░   ░   ░ ░    ░     ░   ░  
      ░   ░           ░    ░  ░    ░    

sinew

command-line-interface-tools

API

Table of Contents

helpWithOptions

Convert a yargs-parser object and a config into a help string

Parameters
  • conf object a configuration object
  • argv object a yargs-parser parsed argv

Returns string formatted string

readRaw

fs.readFile but curried

Parameters
  • path string path-to-a-file
  • format string file format
  • callback function standard nodeback style callback
Examples
import { readRaw } from "sinew"
import { pipe, map, __ as skip } from "ramda"
import { node } from "fluture"

export readFileAndDoStuff = pipe(
  pipe(
    readRaw(skip, 'utf8'),
    node
  ),
  map(x => "preamble:\n" + x)
)

Returns any null

readUTF8

fs.readFile but curried and with utf8 format chosen

Parameters
  • path string path-to-a-file
  • callback function a node-style nodeback function
Examples
import { readUTF8 } from "sinew"
import { pipe, map, __ as skip } from "ramda"
import { node } from "fluture"

export readFileAndDoStuff = pipe(
  pipe(
    readUTF8(skip),
    node
  ),
  map(x => "preamble:\n" + x)
)

Returns string a future value of a string

readFile

fs.readFile but utf8 and returning a Future

Parameters
Examples
import { readFile } from "sinew"
import { pipe, map } from "ramda"

export readFileAndDoStuff = pipe(
  readFile,
  map(x => "preamble:\n" + x)
)

Returns Future<string> a future value of a string

writeRaw

fs.readFile but curried; arity 4

Parameters
  • path string path-to-a-file
  • data any data to write to a path
  • format (string | object) format or opts
  • callback function a nodeback-style callback function
Examples
import {writeRaw} from "sinew"
writeRaw("my-file.md", "cool", "utf8", (e) => {
  if(e) console.warn(e)
  // done
})

writeRaw

fs.readFile but curried; format utf8

Parameters
  • path string path-to-a-file
  • data any data to write to a path
  • callback function a nodeback-style callback function
Examples
import { writeUTF8 } from "sinew"

writeUTF8('my-file.md', 'cool', (e) => {
  if(e) console.warn(e)
  // done
})

writeFile

Write a utf8 file and wrap the action in a future

Parameters
Examples
import { writeFile, readFile } from "sinew"
import { curry, pipe, map, chain } from "ramda"

const prepend = curry((pre, file, data) => pipe(
  readFile(file),
  map(raw => pre = raw),
  chain(writeFile)
))

Returns Future<string> a future-wrapped value(?)

is

expect(actual).toEqual(expected) but curried

Parameters
  • expected any an expected value
  • actual any the actual value

Returns boolean

matches

expect(actual).toMatchSnapshot alias as a unary function

Parameters
  • x any a value

Returns boolean a boolean value

testCLI

A simplified way of testing asynchronous command-line calls using execa.shell Designed for jest testing

Parameters
  • cli Array<string> commands and flags to pass to execa
  • testName string the name of your test
  • assertion function an assertion function. receives actual value as only param

testCLI

A simplified way of testing asynchronous command-line calls Designed for jest testing

Parameters
  • cli Array<string> commands and flags to pass to execa
  • testName string the name of your test
  • assertion function an assertion function. receives actual value as only param

Current Tags

  • 1.0.1                                ...           latest (a year ago)

4 Versions

  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (8)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |