-
-
Save dillonkearns/4f050018784b25246729a82fc9907543 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
{ | |
"type": "application", | |
"source-directories": [ | |
"." | |
], | |
"elm-version": "0.19.1", | |
"dependencies": { | |
"direct": { | |
"dillonkearns/elm-cli-options-parser": "3.2.0", | |
"dillonkearns/elm-pages": "10.0.3", | |
"elm/core": "1.0.5", | |
"elm/json": "1.1.3" | |
}, | |
"indirect": { | |
"Chadtech/elm-bool-extra": "2.4.2", | |
"avh4/elm-color": "1.0.0", | |
"danfishgold/base64-bytes": "1.1.0", | |
"danyx23/elm-mimetype": "4.0.1", | |
"dillonkearns/elm-bcp47-language-tag": "2.0.0", | |
"dillonkearns/elm-date-or-date-time": "2.0.0", | |
"dillonkearns/elm-form": "3.0.0", | |
"elm/browser": "1.0.2", | |
"elm/bytes": "1.0.8", | |
"elm/file": "1.0.5", | |
"elm/html": "1.0.0", | |
"elm/http": "2.0.0", | |
"elm/parser": "1.1.0", | |
"elm/random": "1.0.0", | |
"elm/regex": "1.0.0", | |
"elm/time": "1.0.0", | |
"elm/url": "1.0.0", | |
"elm/virtual-dom": "1.0.3", | |
"elm-community/basics-extra": "4.1.0", | |
"elm-community/list-extra": "8.7.0", | |
"elm-community/maybe-extra": "5.3.0", | |
"fredcy/elm-parseint": "2.0.1", | |
"jluckyiv/elm-utc-date-strings": "1.0.0", | |
"justinmimbs/date": "4.0.1", | |
"mdgriffith/elm-codegen": "4.1.1", | |
"miniBill/elm-codec": "2.1.0", | |
"miniBill/elm-unicode": "1.1.0", | |
"noahzgordon/elm-color-extra": "1.0.2", | |
"robinheghan/fnv1a": "1.0.0", | |
"robinheghan/murmur3": "1.0.0", | |
"rtfeldman/elm-css": "18.0.0", | |
"rtfeldman/elm-hex": "1.0.0", | |
"rtfeldman/elm-iso8601-date-strings": "1.1.4", | |
"stil4m/elm-syntax": "7.3.2", | |
"stil4m/structured-writer": "1.0.3", | |
"the-sett/elm-pretty-printer": "3.1.0", | |
"the-sett/elm-syntax-dsl": "6.0.2", | |
"vito/elm-ansi": "10.0.1" | |
} | |
}, | |
"test-dependencies": { | |
"direct": {}, | |
"indirect": {} | |
} | |
} |
This file contains hidden or 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
module Main exposing (run) | |
import BackendTask exposing (BackendTask) | |
import BackendTask.Http | |
import Cli.Option as Option | |
import Cli.OptionsParser as OptionsParser | |
import Cli.Program as Program | |
import Json.Decode as Decode | |
import Pages.Script as Script exposing (Script) | |
run : Script | |
run = | |
Script.withCliOptions program | |
(\{ username, repo } -> | |
BackendTask.Http.getJson | |
("https://api.github.com/repos/dillonkearns/" ++ repo) | |
(Decode.field "stargazers_count" Decode.int) | |
|> BackendTask.andThen | |
(\stars -> | |
Script.log (String.fromInt stars) | |
) | |
|> BackendTask.allowFatal | |
) | |
type alias CliOptions = | |
{ username : String | |
, repo : String | |
} | |
program : Program.Config CliOptions | |
program = | |
Program.config | |
|> Program.add | |
(OptionsParser.build CliOptions | |
|> OptionsParser.with | |
(Option.optionalKeywordArg "username" |> Option.withDefault "dillonkearns") | |
|> OptionsParser.with | |
(Option.optionalKeywordArg "repo" |> Option.withDefault "elm-pages") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment