mirror of
https://github.com/nmattia/niv.git
synced 2024-11-07 22:36:53 +03:00
Merge pull request #47 from nmattia/nm-missing-repo
Warn if GitHub repository cannot be read
This commit is contained in:
commit
7aa070d8b3
26
app/Niv.hs
26
app/Niv.hs
@ -209,7 +209,8 @@ completePackageSpec = execStateT $ do
|
||||
(Just (Aeson.String owner), Just (Aeson.String repo)) -> do
|
||||
liftIO (GH.executeRequest' $ GH.repositoryR (GH.N owner) (GH.N repo))
|
||||
>>= \case
|
||||
Left _ -> pure ()
|
||||
Left {} ->
|
||||
liftIO $ warnCouldNotFetchGitHubRepo (T.unpack owner, T.unpack repo)
|
||||
Right ghRepo -> do
|
||||
|
||||
-- Description
|
||||
@ -664,6 +665,29 @@ pathNixSourcesJson = "nix" </> "sources.json"
|
||||
initNixSourcesJsonContent :: B.ByteString
|
||||
initNixSourcesJsonContent = "{}"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Warn
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
warnCouldNotFetchGitHubRepo :: (String, String) -> IO ()
|
||||
warnCouldNotFetchGitHubRepo (owner, repo) = putStrLn $ unlines [ line1, line2 ]
|
||||
where
|
||||
line1 = "WARNING: Could not read from GitHub repo: " <> owner <> "/" <> repo
|
||||
line2 = [s|
|
||||
I assumed that your package was a GitHub repository. An error occurred while
|
||||
gathering information from the repository. Check whether your package was added
|
||||
correctly:
|
||||
|
||||
niv show
|
||||
|
||||
If not, try re-adding it:
|
||||
|
||||
niv drop <package>
|
||||
niv add <package-without-typo>
|
||||
|
||||
Make sure the repository exists.
|
||||
|]
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Abort
|
||||
-------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user