Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abbotto/shell-api
A POSIX-compatible shell utility library.
https://github.com/abbotto/shell-api
api ash bash dash ksh mksh posix script shell zsh
Last synced: 27 days ago
JSON representation
A POSIX-compatible shell utility library.
- Host: GitHub
- URL: https://github.com/abbotto/shell-api
- Owner: abbotto
- License: mit
- Created: 2018-07-17T18:47:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-22T18:41:28.000Z (about 3 years ago)
- Last Synced: 2024-09-28T08:21:06.481Z (about 1 month ago)
- Topics: api, ash, bash, dash, ksh, mksh, posix, script, shell, zsh
- Language: Shell
- Homepage:
- Size: 382 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# shell-api
[![Build Status](https://travis-ci.org/abbotto/shell-api.svg?branch=master)](https://travis-ci.org/abbotto/shell-api)
[![NPM version](https://badge.fury.io/js/shell-api.svg)](http://badge.fury.io/js/shell-api)
[![GitHub version](https://badge.fury.io/gh/abbotto%2Fshell-api.svg)](https://badge.fury.io/gh/abbotto%2Fshell-api)## Overview
A robust set of [POSIX-compliant](http://pubs.opengroup.org/onlinepubs/9699919799/) 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
- [confirm](doc/api.md#confirm)
- [export-file](doc/api.md#export-file)
- [join-file](doc/api.md#join-file)
- [log-level](doc/api.md#log-level)
- [pipe-file](doc/api.md#pipe-file)
- [print-text](doc/api.md#print-text)
- [read-file](doc/api.md#read-file)
- [require](doc/api.md#require)
- [substring](doc/api.md#substring)
- [start-daemon](doc/api.md#start-daemon)
- [stop-daemon](doc/api.md#stop-daemon)
- [strict-mode](doc/api.md#strict-mode)
- [terminate](doc/api.md#terminate)
- [watch-daemon](doc/api.md#watch-daemon)
- [write-file](doc/api.md#write-file)---
## Getting started
### Install
- Install this project via `npm`.
npm i shell-api --save
### Usage
**Method A**
#!/usr/bin/env sh
SHELL_API_PATH="/path/to/shell-api/shell"
export SHELL_API_PATH
# Load all the scripts at once
. "${SHELL_API_PATH}"/shell-apiexport-file ./.env
require...
**Method B**
#!/usr/bin/env sh
SHELL_API_PATH="/path/to/shell-api/shell"
export SHELL_API_PATH
# Selectively load scripts
. "${SHELL_API_PATH}"/strict-mode
. "${SHELL_API_PATH}"/export-file
. "${SHELL_API_PATH}"/requireexport-file ./.env
require <SCRIPT>...