Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Commit

Permalink
REadme and release
Browse files Browse the repository at this point in the history
  • Loading branch information
jazcarate committed Aug 22, 2020
1 parent b92b3e0 commit 17b5bd0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Revision history for marble-os
## 0.1.2.0 -- 2020-08-16

* Added daemon support

## 0.1.1.0 -- 2020-08-16

* Added multiline support (via `--lane`)
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ _A play on words with the phonetics of "marble os" and "marvelous"_

# Usage
1. Have a config file with the desired behavior
1. Run `marble` with the config file, piped to the program you want to run: `$ marble ./sample/calculator.mbl | ./sample/calculator.sh`
1. Run `marble` with the config file, piped to the program you want to run: `$ marble run ./sample/calculator.mbl | ./sample/calculator.sh`
1. ???
1. Profit

[![asciicast](https://asciinema.org/a/ffFLLTRD5ozZj0zqgDzS7rA7D.svg)](https://asciinema.org/a/ffFLLTRD5ozZj0zqgDzS7rA7D)

## Options
## Run Options
| Option | Description | Example | Default value |
|-----------|----------------------------------------------------|---------------|---------------|
| repeat | Whether to repeat the sequence one it finishes | --repeat | false |
Expand All @@ -29,6 +29,17 @@ E.g.:
* `$ marble --tick=3m10s` - 3 minutes and 10 seconds _(this follows ISO 8601 duration spec. You can not jump units, and no spaces allowed)_
* `$ marble --tick=1500` - 1500 seconds = 25 minutes

## Distributed Run Options
`marble` can also be daemonized to run in-sync from multiple places.
To do so, start `marble` with `sync` rather than `run`. This will wait until the corresponding `marble` is launched (via `marble daemon start`).

In addition to the [run options](#Run-Options), these are the additional distributed options
| Option | Description | Example | Default value |
|--------|-------------------------|--------------------|---------------|
| port | Port to run the daemon. | --port=1337 | 3000 |
| host | Host to run the daemon. | --host=192.168.3.3 | localhost |


## mbl syntax
The `mbl` interpreter will parse the delimiter configured 👆 into "wait" and everything else into the output.
If you need to output the characters in the delimiter, you can user another delimiter that does not crash, or escape the output string with `\`.
Expand Down
2 changes: 1 addition & 1 deletion marble-os.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.0

name: marble-os
version: 0.1.1.2
version: 0.1.2.0
description: Run things at your own pace
license: MIT
license-file: LICENSE
Expand Down
6 changes: 3 additions & 3 deletions src/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ main = do
options
(handleCommands state)
else pure ()
res <- D.runClient (T.unpack $ C.unHost host) port (command)
res <- D.runClient (C.unHost host) port (command)
print (res :: Maybe Response)
where
command :: Command
Expand All @@ -111,7 +111,7 @@ main = do
C.Start -> TriggerStart
C.Sync (C.SyncConfiguration config' remote) -> do
let port = C.port remote
let host = (T.unpack $ C.unHost $ C.host remote)
let host = (C.unHost $ C.host remote)
let options = def { D.daemonPort = port, D.printOnDaemonStarted = False } -- TODO duplicated!
if host == def
then do
Expand All @@ -125,5 +125,5 @@ main = do
res <- D.runClient host port (Hello mbl)
case res of
Just (Start newMbl) -> interpret config' newMbl
_ -> fail "TODO"
_ -> fail $ show res

9 changes: 5 additions & 4 deletions src/Args.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import Options.Applicative ( Parser
, auto
, subparser
, command
, str
)

import qualified Duration as D
import qualified Data.String as S
import qualified Configuration as C
Expand All @@ -42,15 +42,16 @@ remote =
<> showDefault
<> value 3000
)
<*> option
auto
<*> (C.Host <$> option
str
( long "host"
<> short 'h'
<> help "Host to run the daemon."
<> metavar "HOST"
<> showDefault
<> value def
<> (value $ C.unHost def)
)
)

daemon :: Parser C.DaemonConfiguration
daemon = C.DaemonConfiguration <$> daemonSubCmd <*> remote
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ data Remote = Remote { port :: Port , host :: Host }

data Configuration = Run RunConfiguration | Sync SyncConfiguration | Daemon DaemonConfiguration

newtype Host = Host { unHost :: T.Text } deriving (Show, Eq, Read)
newtype Host = Host { unHost :: String } deriving (Show, Eq, Read)

type Port = Int

Expand Down

0 comments on commit 17b5bd0

Please sign in to comment.