Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devinus/sh
Run programs as functions in Elixir
https://github.com/devinus/sh
elixir shell
Last synced: 7 days ago
JSON representation
Run programs as functions in Elixir
- Host: GitHub
- URL: https://github.com/devinus/sh
- Owner: devinus
- License: unlicense
- Created: 2014-02-22T20:56:13.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2024-06-27T13:13:01.000Z (6 months ago)
- Last Synced: 2024-12-21T05:37:18.375Z (12 days ago)
- Topics: elixir, shell
- Language: Elixir
- Size: 20.5 KB
- Stars: 146
- Watchers: 5
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sh
[![Build Status](https://api.travis-ci.org/devinus/sh.svg?branch=master)](https://travis-ci.org/devinus/sh)
[![Support via Gratipay](https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.png)](https://gratipay.com/devinus/)
An Elixir module inspired by Python's [sh](http://amoffat.github.io/sh/)
package. `Sh` allows you to call any program as if it were a function.## Adding Sh to Your Project
To use Sh with your projects, simply edit your mix.exs file and add it as a dependency:```elixir
defp deps do
[{:sh, "~> 1.1.2"}]
end
```## Example
```iex
iex> Sh.echo "Hello World!"
"Hello World!\n"
```## Options
`Sh` commands accept as the last argument a list of options.
```elixir
Sh.curl "http://example.com/", o: "page.html", silent: true
""
```The equivalent call without using this feature would be:
```elixir
Sh.curl "-o", "page.html", "--silent", "http://example.com/"
```## Underscores
Underscores in a program name or keyword options are converted to dashes.