ember-shared

Overview

Code shared between various Ember software.

Documentation

Usage

ember-shared provides the following command-line scripts, mainly useful for writing other scripts.

date-uuid
Returns a timestamp combined with a random (V4) UUID. Synopsis: date-uuid
disk-size-in-bytes
Returns an estimate sum of the disk usage of the specified files, in bytes. Synopsis: disk-size-in-bytes <file>...
error-notify
Notify the user of a shell script of an error condition. Synopsis: error-notify [exit-status] [message-to-user]... (if the first argument is an integer, it is used as the exit status; otherwise error-notify exits with status 1)
warn
Notify the user of a shell script of a warning. Synopsis: warn <message-to-user>
warn-timeout
Notify the user of a shell script of a warning, and wait a bit in the hope that they see the warning. Synopsis: warn <message-to-user> [time-to-wait-in-seconds] (time-to-wait defaults to 10 seconds)

In addition, ember-shared also provides the following scripts that it uses internally that are not supported for independent use.

ember_bash_setup
Set up the bash environment shared by various Ember projects. Synopsis: source ember_bash_setup
die
Tells the user that their bash environment is misconfigured (this script should never run if everything is working). Synopsis: die [exit-status] [message-to-user]... (if the first argument is an integer, it is used as the exit status; otherwise die exits with status 1)

ember_bash_setup provides these bash functions.

die
Notify the user of a shell script of an error condition, and exit. Synopsis: die [exit-status] [message-to-user]... (if the first argument is an integer, it is used as the exit status; otherwise the script exits with status 1)
embasename
Replacement for basename in bash. Synopsis: embasename <path>
emreadlink
Cross-platform replacement for readlink. Synopsis: emreadlink <path>
ia
Wrapper around the ia tool for communicating with the Internet Archive, which can be used as a drop-in replacement for the standard ia command. Synopsis: ia [argument]...
setVariableToCommandOutput
Alternative to bash command substitution ("$(command)") that preserves trailing newlines. variable-name must not be "emSetVariableToCommandOutputVar". Synopsis: setVariableToCommandOutput <variable-name> <command> [argument]...
ereplace
Replace one string with another in the specified file. Synopsis: ereplace <string-to-replace> <replacement-string> <file>
print
Prints a string. Synopsis: print <string>
readconf
Read a value from a configuration file, and return it as readconfValue (this is an array, and will contain multiple results if the key is present multiple times in the file). If <key> is not provided, it will return the non-comment lines of the file instead. Synopsis: readconf [<key>] <file>
preadconf
Read a value from a configuration file, and print it (if the key is present multiple times in the file, the first value will be printed). Synopsis: preadconf <key> <file>
urlencode
URL encode the specified string. Synopsis: urlencode <string>
urldecode
URL decode the specified string. Synopsis: urldecode <string>

Installation

For Wreathe 7.3, an ebuild (app-misc/ember-shared) is available in the Wreathe overlay (this may also work for similar operating systems such as Ututo XS GNU/Linux).

For other operating systems, use the following installation instructions.

Instructions for installation without ebuild

Requirements
Optional requirements

For the ia command, the following additional requirements apply.

Download

To download ember-shared, run:

git clone https://github.com/ethus3h/ember-shared.git
Copy scripts

To install the downloaded scripts, copy them to your preferred location.

Development

To learn about contributing to this project, visit the development page.