https://github.com/roosoft/cli
Elixir CLI protype app accepting parameters and then quitting after doing some work
https://github.com/roosoft/cli
Last synced: 3 months ago
JSON representation
Elixir CLI protype app accepting parameters and then quitting after doing some work
- Host: GitHub
- URL: https://github.com/roosoft/cli
- Owner: RooSoft
- Created: 2021-11-10T13:46:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-11T13:39:47.000Z (over 4 years ago)
- Last Synced: 2025-01-17T06:27:25.105Z (over 1 year ago)
- Language: Elixir
- Size: 1.02 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cli prototype app
CLI protype app accepting parameters and then quitting after doing some work
Inspired by [blackode's post](https://medium.com/blackode/writing-the-command-line-application-in-elixir-78a8d1b1850)
## How to compile
```bash
mix escript.build
```
## How to run
```bash
./cli cat --file contents.txt
```
```
Unnamed arguments: ["cat"]
Named arguments: [file: "contents.txt"]
```
## The making of
#### Create the project
```bash
mix new cli
```
#### In the `mix.exs`, add this to the project keyword list
```elixir
escript: [main_module: Cli.Main],
```
#### Build it
```bash
mix escript.build
```
#### Run it
```bash
./cli cat --file contents.txt
```