-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #196 from ambiata/topic/csv
Sample-extraction skeleton
- Loading branch information
Showing
9 changed files
with
123 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
import BuildInfo_ambiata_warden | ||
import DependencyInfo_ambiata_warden | ||
|
||
import Options.Applicative (Parser) | ||
import Options.Applicative (subparser) | ||
import Options.Applicative (long, short, help) | ||
import Options.Applicative (metavar, strArgument, strOption) | ||
|
||
import P | ||
|
||
import System.IO (IO, BufferMode(..), FilePath) | ||
import System.IO (stdout, stderr, hSetBuffering) | ||
import System.IO (hPutStrLn) | ||
import System.Exit (exitFailure) | ||
|
||
import X.Options.Applicative (cli, command') | ||
|
||
data Command = | ||
Extract !FilePath ![FilePath] | ||
deriving (Eq, Show) | ||
|
||
main :: IO () | ||
main = do | ||
hSetBuffering stdout LineBuffering | ||
hSetBuffering stderr LineBuffering | ||
cli "warden-sample" buildInfoVersion dependencyInfo commandP $ \cmd -> | ||
case cmd of | ||
Extract _op _fs -> do | ||
hPutStrLn stderr $ "implement me!" | ||
exitFailure | ||
|
||
commandP :: Parser Command | ||
commandP = subparser $ | ||
command' | ||
"extract" | ||
"Extract the numeric samples from a set of marker files into a CSV format more suited to interactive data analysis." | ||
(Extract <$> csvOutputFileP <*> some markerFileP) | ||
|
||
csvOutputFileP :: Parser FilePath | ||
csvOutputFileP = strOption $ | ||
metavar "CSV-OUTPUT-FILE" | ||
<> long "csv-output-file" | ||
<> short 'o' | ||
<> help "Path to write CSV output." | ||
|
||
-- FIXME: dedupe (also in main warden cli) | ||
markerFileP :: Parser FilePath | ||
markerFileP = strArgument $ | ||
metavar "MARKER-FILE" | ||
<> help "Path to view marker file(s) from `warden check`." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh -eu | ||
|
||
. $(dirname $0)/../core/setup.sh | ||
|
||
banner Display Version | ||
#--------------------- | ||
|
||
$WARDEN_SAMPLE -v | grep -q warden-sample | ||
|
||
$WARDEN_SAMPLE --version | ||
|
||
banner Display Help | ||
#------------------ | ||
|
||
$WARDEN_SAMPLE -h | ||
|
||
$WARDEN_SAMPLE --help | ||
|
||
WARDEN_SAMPLE="$WARDEN_SAMPLE --dry-run" | ||
|
||
$WARDEN_SAMPLE extract -o foo.csv bar.json baz.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters