diff --git a/app/Niv.hs b/app/Niv.hs index 22a7b6d..413fde4 100644 --- a/app/Niv.hs +++ b/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 + niv add + +Make sure the repository exists. +|] + ------------------------------------------------------------------------------- -- Abort -------------------------------------------------------------------------------