Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autodetect obvious URLs (niv add https://github.com/user/repo.git) #317

Open
deliciouslytyped opened this issue Apr 15, 2021 · 4 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@deliciouslytyped
Copy link

It would be convenient if niv add could take automatically recognize some defined url so I could just paste the repo path instead of writing github -u user -r repo -n repo.

Maybe there could be a config file that contains regexes with captures or something, though personally I'm fine with just predefined things for gitlab and github, which would probably cover 99% of cases.

@refnil refnil added enhancement New feature or request good first issue Good for newcomers labels Aug 14, 2021
@refnil
Copy link
Collaborator

refnil commented Aug 14, 2021

Hello @deliciouslytyped,

For github, you can already do niv add nmattia/niv and niv add github nmattia/niv which is as short as can be. I can see that using urls could be convenient since that's what we already use with git.

Ex:

niv add https://github.com/nmattia/niv
niv add https://github.com/nmattia/niv.git
niv add [email protected]:nmattia/niv.git

@deliciouslytyped
Copy link
Author

It's not about length, it's about copy-pasting ;)

@nmattia
Copy link
Owner

nmattia commented Aug 19, 2021

I agree this would be nice! right now we differentiate between "github" and "git" dependencies, I guess some cases would be a bit ambiguous (but this would be based on heuristics anyways...)

@pickfire
Copy link

pickfire commented Mar 12, 2022

I did the same thing and I had to search in github issue to figure out the cryptic error as like any other nix projects (then I also found it by manually checking the help). I wish niv would just accept the input.

> niv add https://github.com/nix-community/impermanence
Adding package /github.com/nix-community/impermanence
WARNING: Could not read from GitHub repo: https://github.com/nix-community/impermanence
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.

(Error was: (Request {
  host                 = "api.github.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("user-agent","niv"),("accept","application/vnd.github.v3+json")]
  path                 = "/repos/https://github.com/nix-community/impermanence"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
,Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("Server","GitHub.com"),("Date","Sat, 12 Mar 2022 10:24:46 GMT"),("Content-Type","application/json; charset=utf-8"),("X-GitHub-Media-Type","github.v3; format=json"),("Access-Control-Expose-Headers","ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset"),("Access-Control-Allow-Origin","*"),("Strict-Transport-Security","max-age=31536000; includeSubdomains; preload"),("X-Frame-Options","deny"),("X-Content-Type-Options","nosniff"),("X-XSS-Protection","0"),("Referrer-Policy","origin-when-cross-origin, strict-origin-when-cross-origin"),("Content-Security-Policy","default-src 'none'"),("Vary","Accept-Encoding, Accept, X-Requested-With"),("Content-Encoding","gzip"),("X-RateLimit-Limit","60"),("X-RateLimit-Remaining","50"),("X-RateLimit-Reset","1647082307"),("X-RateLimit-Resource","core"),("X-RateLimit-Used","10"),("Content-Length","91"),("X-GitHub-Request-Id","AE28:0263:E83A23:F6A95A:622C74ED")], responseBody = "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest\"}", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}) )

  FATAL: One or more packages failed to update:
  /github.com/nix-community/impermanence: ExitFailure 1
ERROR: ExitFailure 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants