Commit 49d75195 authored by Valentin Reis's avatar Valentin Reis

Merge branch 'arbitrary-command' into 'master'

Added the "arbitrary command" action and documented the available

See merge request argo/argotest!7
parents 14188de1 9941d842
Pipeline #4647 passed with stage
in 6 seconds
......@@ -6,16 +6,16 @@ all: generate-completions README.md
generate-completions: completions/zsh/_argotk.hs completions/bash/argotk.sh
completions/zsh/_argotk.hs: argotk.hs default.nix
nix-shell -A dev-test --run "bash -c './argotk.hs --zsh-completion-script ./argotk.hs > completions/zsh/_argotk.hs'"
bash -c './argotk.hs --zsh-completion-script ./argotk.hs > completions/zsh/_argotk.hs'
completions/bash/argotk.sh: argotk.hs default.nix
nix-shell -A dev-test --run "bash -c './argotk.hs --bash-completion-script ./argotk.hs > completions/bash/argotk.sh'"
bash -c './argotk.hs --bash-completion-script ./argotk.hs > completions/bash/argotk.sh'
README.md: .README.md argotk.hs default.nix
nix-shell -A dev-test --run "pandoc --filter `which panpipe` .README.md -o README.md"
pandoc --filter `which panpipe` .README.md -o README.md
README.html: README.md
nix-shell -A dev-test --run "pandoc README.md -o README.html"
pandoc README.md -o README.html
.PHONY:clean
clean:
......
......@@ -47,11 +47,15 @@ Output:
Usage: argotk.hs COMMAND
Available options:
COMMAND Target for the greeting
COMMAND Type of action to run
-h,--help Show this help text
Available commands:
clean
daemon
helloworld
clean Clean sockets, logfiles.
daemon Set up and launch the daemon in synchronous mode,
with properly cleaned sockets, logfiles.
application Setup stack and run an arbitrary command in a
container.
helloworld Setup stack and check that hello world app sends
message back to cmd.
```
......@@ -17,13 +17,25 @@ import Control.Monad
opts :: Parser (IO ())
opts = subparser
( command "clean" (info (pure $ runClean def) idm)<> help "Target for the greeting"
<> command "daemon" (info (pure $ runDaemon def) idm)
<> command "helloworld" (info (pure $ runHelloWorld def ) idm) )
( command "clean" (info (pure $ runClean def)
(progDesc "Clean sockets, logfiles."))
<> command "daemon" (info (pure $ runDaemon def)
(progDesc "Set up and launch the daemon in synchronous mode, \
\with properly cleaned sockets, logfiles."))
<> command "application" (info (runApp <$> argument str idm)
(progDesc "Setup stack and run an arbitrary command in a container."))
<> command "helloworld" (info (pure $ runHelloWorld def )
(progDesc "Setup stack and check that hello world app sends \
\message back to cmd."))
<> help "Type of action to run"
)
main :: IO ()
main = join $ execParser (info (opts <**>helper) idm)
runApp :: Text -> IO ()
runApp app = runSimpleStack $ def {app = app}
runHelloWorld :: StackArgs -> IO ()
runHelloWorld a@StackArgs{..} = do
let passStr = "HelloWorldFromApp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment