mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
atlas: search improvements (#21929)
* Get description and license from github json response * Allow running `atlas search` outside of a workspace * Check `len` instead of `dirExists` * make `list` identical to `search`
This commit is contained in:
@@ -756,10 +756,10 @@ proc main =
|
||||
c.workspace = detectWorkspace()
|
||||
if c.workspace.len > 0:
|
||||
readConfig c
|
||||
else:
|
||||
echo "Using workspace ", c.workspace
|
||||
elif action notin ["search", "list"]:
|
||||
error "No workspace found. Run `atlas init` if you want this current directory to be your workspace."
|
||||
return
|
||||
echo "Using workspace ", c.workspace
|
||||
|
||||
when MockupRun:
|
||||
c.depsDir = c.workspace
|
||||
@@ -807,8 +807,10 @@ proc main =
|
||||
noArgs()
|
||||
updatePackages(c)
|
||||
of "search", "list":
|
||||
updatePackages(c)
|
||||
search getPackages(c.workspace), args
|
||||
if c.workspace.len != 0:
|
||||
updatePackages(c)
|
||||
search getPackages(c.workspace), args
|
||||
else: search @[], args
|
||||
of "updateprojects":
|
||||
updateDir(c, c.workspace, if args.len == 0: "" else: args[0])
|
||||
of "updatedeps":
|
||||
|
||||
@@ -92,7 +92,8 @@ proc githubSearch(seen: var HashSet[string]; terms: seq[string]) =
|
||||
url: j.getOrDefault("html_url").getStr,
|
||||
downloadMethod: "git",
|
||||
tags: toTags(j.getOrDefault("topics")),
|
||||
description: "<none>, not listed in packages.json",
|
||||
description: j.getOrDefault("description").getStr,
|
||||
license: j.getOrDefault("license").getOrDefault("spdx_id").getStr,
|
||||
web: j.getOrDefault("html_url").getStr
|
||||
)
|
||||
if not seen.containsOrIncl(p.url):
|
||||
|
||||
Reference in New Issue
Block a user