mirror of
https://github.com/nmattia/niv.git
synced 2024-11-07 11:28:45 +03:00
Add basic CLI for git dependencies
This commit is contained in:
parent
2663cc56e0
commit
c3ec48dbb0
@ -208,9 +208,10 @@ cmdInit = do
|
|||||||
parseCmdAdd :: Opts.ParserInfo (IO ())
|
parseCmdAdd :: Opts.ParserInfo (IO ())
|
||||||
parseCmdAdd =
|
parseCmdAdd =
|
||||||
Opts.info
|
Opts.info
|
||||||
((uncurry (cmdAdd githubUpdate') <$> parseArgs) <**> Opts.helper) $
|
((sp <|> (uncurry (cmdAdd githubUpdate') <$> parseArgs)) <**> Opts.helper) $
|
||||||
mconcat desc
|
mconcat desc
|
||||||
where
|
where
|
||||||
|
sp = Opts.subparser (Opts.hidden <> Opts.commandGroup "Experimental commands:" <> Opts.command "git" parseCmdAddGit)
|
||||||
parseArgs :: Opts.Parser (PackageName, Attrs)
|
parseArgs :: Opts.Parser (PackageName, Attrs)
|
||||||
parseArgs = collapse <$> parseNameAndGHShortcut <*> parsePackageSpec
|
parseArgs = collapse <$> parseNameAndGHShortcut <*> parsePackageSpec
|
||||||
parseNameAndGHShortcut = (,) <$> optName <*> parseGitHubShortcut
|
parseNameAndGHShortcut = (,) <$> optName <*> parseGitHubShortcut
|
||||||
@ -249,6 +250,15 @@ parseCmdAdd =
|
|||||||
" niv add my-package -v alpha-0.1 -t http://example.com/archive/<version>.zip"
|
" niv add my-package -v alpha-0.1 -t http://example.com/archive/<version>.zip"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
parseCmdAddGit :: Opts.ParserInfo (IO ())
|
||||||
|
parseCmdAddGit =
|
||||||
|
Opts.info
|
||||||
|
(putStrLn <$> parseArgs <**> Opts.helper) $
|
||||||
|
mconcat desc
|
||||||
|
where
|
||||||
|
parseArgs = Opts.strOption (Opts.long "message")
|
||||||
|
desc = [ Opts.progDesc "This echoes \"message\" back." ]
|
||||||
|
|
||||||
cmdAdd :: Update () a -> PackageName -> Attrs -> IO ()
|
cmdAdd :: Update () a -> PackageName -> Attrs -> IO ()
|
||||||
cmdAdd updateFunc packageName attrs = do
|
cmdAdd updateFunc packageName attrs = do
|
||||||
job ("Adding package " <> T.unpack (unPackageName packageName)) $ do
|
job ("Adding package " <> T.unpack (unPackageName packageName)) $ do
|
||||||
|
Loading…
Reference in New Issue
Block a user