From 09f36f51989dd8045129781285902f4eaa07779b Mon Sep 17 00:00:00 2001 From: Gruruya Date: Sat, 27 May 2023 00:54:21 -0400 Subject: 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` --- tools/atlas/atlas.nim | 10 ++++++---- tools/atlas/packagesjson.nim | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/atlas/atlas.nim b/tools/atlas/atlas.nim index d46378796..97e6afbb9 100644 --- a/tools/atlas/atlas.nim +++ b/tools/atlas/atlas.nim @@ -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": diff --git a/tools/atlas/packagesjson.nim b/tools/atlas/packagesjson.nim index 5ceef706f..4c4d42595 100644 --- a/tools/atlas/packagesjson.nim +++ b/tools/atlas/packagesjson.nim @@ -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: ", 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): -- cgit 1.4.1-2-gfad0