🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

hackfile

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hackfile

Parser for the hackfile format

latest
Source
npmnpm
Version
4.0.0
Version published
Weekly downloads
4
-20%
Maintainers
2
Weekly downloads
 
Created
Source

hackfile

Parser for the hackfile format

npm install hackfile

build status

Format

The hackfile format is similar to a Makefile. There are two accepted formats:

{name}
    {arg1}
    {arg2}
...
{name} {arg1}
    {arg2}
    {arg3}
...

hackfiles can also be nested:

{name} {arg}
(indent){name} {arg}
(indent)(indent){arg}
(indent){arg}
...

Usage

Assuming you have a hackfile that looks like this

foo bar

bar echo c
  echo d

bat
  echo e
  echo f
  echo g

baz echo a b c d

The following example

var hackfile = require('hackfile')
var fs = require('fs')

var parsed = hackfile(fs.readFileSync('hackfile', 'utf-8'))
console.log(parsed)

Prints out

[ [ 'foo', [ 'bar' ] ], 
  [ 'bar', [ [ 'echo', [ 'c' ] ], [ 'echo', [ 'd' ] ] ] ],
  [ 'bat', [ [ 'echo', [ 'e' ] ], [ 'echo', [ 'f' ] ], [ 'echo', [ 'g' ] ] ] ],
  [ 'baz', [ [ 'echo', [ 'a b c d' ] ] ] ] ]

Nested Example

hackfile input:

pipeline foo
  pipe
    echo hello
    transform
    cat
  run echo
    hello

parser output:

[[
  "pipeline", [
    "foo", [
      "pipe", [[
        "echo", [
          "hello"
        ]
      ],
      "transform",
      "cat"
    ]], [
    "run", [
      "echo",
      "hello"
    ]]
  ]
]]

License

MIT

FAQs

Package last updated on 23 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts