Neurotoxin Powered Marketing
Miss any of our Open RFC calls?Watch the recordings here! »

shell-api

1.1.0 • Public • Published

shell-api

Build Status NPM version GitHub version

Overview

A robust set of POSIX-compliant scripts for shell environments.

Shell support

The goal is to provide a simple API that is compatible with Bourne-like shells on *nix systems.

All functions have been tested in bash, dash, fish, ksh, and zsh.

The API


Getting started

Install

  • Install this project via npm.

    npm i shell-api --save
    
  • Symlink the shell directory within a project.

    ln -s ./node_modules/shell-api/shell ./.shell
    

Usage

Method A

#!/usr/bin/env sh

script_path=$(cd "$(dirname "${0}")"; pwd)
shell_api_path="${script_path}/../.shell"

# Load the whole framework at once
. "${shell_api_path}"/shell-api

export-file ./.env
require <SCRIPT>

...

Method B

#!/usr/bin/env sh

script_path=$(cd "$(dirname "${0}")"; pwd)
shell_api_path="${script_path}/../.shell"

# Selectively load parts of the framework
. "${shell_api_path}"/strict-mode
. "${shell_api_path}"/export-file
. "${shell_api_path}"/require

export-file ./.env
require <SCRIPT>

...

Install

npm i shell-api

DownloadsWeekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

351 kB

Total Files

43

Last publish

Collaborators

  • avatar