mirror of
https://github.com/nmattia/niv.git
synced 2024-09-18 19:07:19 +03:00
Warn if GitHub repository cannot be read
This commit is contained in:
parent
29e351ce67
commit
cd9206daf0
26
app/Niv.hs
26
app/Niv.hs
@ -209,7 +209,8 @@ completePackageSpec = execStateT $ do
|
|||||||
(Just (Aeson.String owner), Just (Aeson.String repo)) -> do
|
(Just (Aeson.String owner), Just (Aeson.String repo)) -> do
|
||||||
liftIO (GH.executeRequest' $ GH.repositoryR (GH.N owner) (GH.N repo))
|
liftIO (GH.executeRequest' $ GH.repositoryR (GH.N owner) (GH.N repo))
|
||||||
>>= \case
|
>>= \case
|
||||||
Left _ -> pure ()
|
Left {} ->
|
||||||
|
liftIO $ warnCouldNotFetchGitHubRepo (T.unpack owner, T.unpack repo)
|
||||||
Right ghRepo -> do
|
Right ghRepo -> do
|
||||||
|
|
||||||
-- Description
|
-- Description
|
||||||
@ -664,6 +665,29 @@ pathNixSourcesJson = "nix" </> "sources.json"
|
|||||||
initNixSourcesJsonContent :: B.ByteString
|
initNixSourcesJsonContent :: B.ByteString
|
||||||
initNixSourcesJsonContent = "{}"
|
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
|
-- Abort
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user