mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-30 03:11:30 +03:00
Parse module name into List in CLI options parser helper.
This commit is contained in:
parent
17ed841d4b
commit
57a3ecf13f
@ -30,7 +30,7 @@ import Pages.Script as Script exposing (Script)
|
||||
|
||||
|
||||
type alias CliOptions =
|
||||
{ moduleName : String
|
||||
{ moduleName : List String
|
||||
, rest : List ( String, AddFormHelp.Kind )
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ run =
|
||||
let
|
||||
file : Elm.File
|
||||
file =
|
||||
createFile (cliOptions.moduleName |> String.split ".") cliOptions.rest
|
||||
createFile cliOptions.moduleName cliOptions.rest
|
||||
in
|
||||
Script.writeFile
|
||||
{ path = "app/" ++ file.path
|
||||
|
@ -51,9 +51,14 @@ import Pages.Internal.RoutePattern as RoutePattern
|
||||
|
||||
{-| A positional argument for elm-cli-options-parser that does a Regex validation to check that the module name is a valid Elm Route module name.
|
||||
-}
|
||||
moduleNameCliArg : Option.Option from String builderState -> Option.Option from String builderState
|
||||
moduleNameCliArg : Option.Option from String builderState -> Option.Option from (List String) builderState
|
||||
moduleNameCliArg =
|
||||
Option.validate (Cli.Validate.regex moduleNameRegex)
|
||||
Option.validate
|
||||
(Cli.Validate.regex moduleNameRegex)
|
||||
>> Option.map
|
||||
(\rawModuleName ->
|
||||
rawModuleName |> String.split "."
|
||||
)
|
||||
|
||||
|
||||
moduleNameRegex : String
|
||||
|
Loading…
Reference in New Issue
Block a user