GitLab maintenance scheduled for Tomorrow, 2020-01-30, from 17:00 to 18:00 CT - Services will be unavailable during this time.

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 ...@@ -6,16 +6,16 @@ all: generate-completions
generate-completions: completions/zsh/_argotk.hs completions/bash/ generate-completions: completions/zsh/_argotk.hs completions/bash/
completions/zsh/_argotk.hs: argotk.hs default.nix 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.hs default.nix completions/bash/ argotk.hs default.nix
nix-shell -A dev-test --run "bash -c './argotk.hs --bash-completion-script ./argotk.hs > completions/bash/'" bash -c './argotk.hs --bash-completion-script ./argotk.hs > completions/bash/' argotk.hs default.nix argotk.hs default.nix
nix-shell -A dev-test --run "pandoc --filter `which panpipe` -o" pandoc --filter `which panpipe` -o
README.html: README.html:
nix-shell -A dev-test --run "pandoc -o README.html" pandoc -o README.html
.PHONY:clean .PHONY:clean
clean: clean:
...@@ -47,11 +47,15 @@ Output: ...@@ -47,11 +47,15 @@ Output:
Usage: argotk.hs COMMAND Usage: argotk.hs COMMAND
Available options: Available options:
COMMAND Target for the greeting COMMAND Type of action to run
-h,--help Show this help text -h,--help Show this help text
Available commands: Available commands:
clean clean Clean sockets, logfiles.
daemon daemon Set up and launch the daemon in synchronous mode,
helloworld with properly cleaned sockets, logfiles.
application Setup stack and run an arbitrary command in a
helloworld Setup stack and check that hello world app sends
message back to cmd.
``` ```
...@@ -17,13 +17,25 @@ import Control.Monad ...@@ -17,13 +17,25 @@ import Control.Monad
opts :: Parser (IO ()) opts :: Parser (IO ())
opts = subparser opts = subparser
( command "clean" (info (pure $ runClean def) idm)<> help "Target for the greeting" ( command "clean" (info (pure $ runClean def)
<> command "daemon" (info (pure $ runDaemon def) idm) (progDesc "Clean sockets, logfiles."))
<> command "helloworld" (info (pure $ runHelloWorld def ) idm) ) <> 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 :: IO ()
main = join $ execParser (info (opts <**>helper) idm) main = join $ execParser (info (opts <**>helper) idm)
runApp :: Text -> IO ()
runApp app = runSimpleStack $ def {app = app}
runHelloWorld :: StackArgs -> IO () runHelloWorld :: StackArgs -> IO ()
runHelloWorld a@StackArgs{..} = do runHelloWorld a@StackArgs{..} = do
let passStr = "HelloWorldFromApp" 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