From 121580590b24a228d9e194bd54c9b89582db2df2 Mon Sep 17 00:00:00 2001 From: Adrian Sieber Date: Mon, 8 Jan 2024 12:48:27 +0000 Subject: [PATCH] Rename project to "Airput" --- README.md | 5 ++-- repos-uploader.cabal => airput.cabal | 19 ++++++------ app/Main.hs | 43 +++++++++++++++------------- package.yaml | 12 ++++---- 4 files changed, 39 insertions(+), 40 deletions(-) rename repos-uploader.cabal => airput.cabal (81%) diff --git a/README.md b/README.md index de4a48a..98c0649 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# Repos Uploader +# Airput -Load metadata for a list of GitHub repos and store it in Airsequel. +CLI tool for populating Airsequel with data. +Includes a crawler for metadata of GitHub repos. # TODOs diff --git a/repos-uploader.cabal b/airput.cabal similarity index 81% rename from repos-uploader.cabal rename to airput.cabal index d7785ac..a51723d 100644 --- a/repos-uploader.cabal +++ b/airput.cabal @@ -3,16 +3,13 @@ cabal-version: 2.2 -- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack --- --- hash: 0862c588be00e327ee1b6cc1fac5f380af9fcf1ab0294c48aa90748353d89655 -name: repos-uploader +name: airput version: 0.0.0.0 -synopsis: Download metadata for a list of GitHub repos and save it to Airsequel - +synopsis: CLI tool for populating Airsequel with data. description: For more information check out the readme. category: Web -homepage: https://github.com/Airsequel/repos-uploader#readme +homepage: https://github.com/Airsequel/Airput#readme author: Adrian Sieber maintainer: adrian@feram.io copyright: Adrian Sieber @@ -25,9 +22,9 @@ library exposed-modules: Lib other-modules: - Paths_repos_uploader + Paths_airput autogen-modules: - Paths_repos_uploader + Paths_airput hs-source-dirs: source default-extensions: @@ -54,15 +51,15 @@ library , time default-language: GHC2021 -executable repos-uploader +executable airput main-is: Main.hs other-modules: Airsequel Types Utils - Paths_repos_uploader + Paths_airput autogen-modules: - Paths_repos_uploader + Paths_airput hs-source-dirs: app default-extensions: diff --git a/app/Main.hs b/app/Main.hs index e555ec7..daec025 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -85,34 +85,38 @@ import Utils (loadGitHubToken) data CliCmd - = -- | Upload a single repo - Upload Text - | -- | Search for repos and upload them - Search Text + = -- | Upload metadata for a single GitHub repo + GithubUpload Text + | -- | Search for GitHub repos and upload their metadata + GithubSearch Text commands :: Parser CliCmd commands = do let - upload :: Parser CliCmd - upload = Upload <$> argument str (metavar "REPO_SLUG") + githubUpload :: Parser CliCmd + githubUpload = GithubUpload <$> argument str (metavar "REPO_SLUG") - search :: Parser CliCmd - search = Search <$> argument str (metavar "SEARCH_QUERY") + githubSearch :: Parser CliCmd + githubSearch = GithubSearch <$> argument str (metavar "SEARCH_QUERY") hsubparser ( mempty <> command - "upload" - (info upload (progDesc "Upload a single repo")) + "github-upload" + ( info + githubUpload + (progDesc "Upload metadata for a single GitHub repo") + ) <> command - "search" + "github-search" ( info - search + githubSearch ( progDescDoc $ Just $ vsep - [ "Search for and upload several repos." + [ "Search for GitHub repos and upload their metadata." + , "" , "WARNING: If the search returns more than 1000 repos," , " the results will be truncated." , "" @@ -120,8 +124,7 @@ commands = do , "- language:haskell" , "- stars:>=10" , "- stars:10..50" - , "- sort:updated-desc" - , "- sort:stars-asc" + , "- created:2023-10" , "- archived:true" ] ) @@ -217,7 +220,7 @@ loadAndSaveRepo ghTokenMb _TODO_saveStrategy owner name = do getGhHeaders :: (P.IsString a) => Maybe Text -> [(a, P.ByteString)] getGhHeaders tokenMb = - [ ("User-Agent", "repos-uploader") + [ ("User-Agent", "airput") , ("Accept", "application/vnd.github+json") , ("X-GitHub-Api-Version", "2022-11-28") ] @@ -387,7 +390,7 @@ run cliCmd = do ghTokenMb <- loadGitHubToken case cliCmd of - Upload repoSlug -> do + GithubUpload repoSlug -> do let fragments = repoSlug & T.splitOn "/" ownerMb = fragments & headMay @@ -406,7 +409,7 @@ run cliCmd = do owner name pure () - Search searchQuery -> do + GithubSearch searchQuery -> do let searchQueryNorm = searchQuery & T.replace "\n" " " & T.strip repos <- loadAndSaveReposViaSearch ghTokenMb searchQueryNorm 20 Nothing @@ -424,9 +427,9 @@ main = do info (commands <**> helper) ( fullDesc - <> headerDoc (Just "⬆️ Repos Uploader") + <> headerDoc (Just "⬆️ Airput ⬆️") <> progDesc - "Crawl repos from GitHub and upload their metadata to Airsequel" + "CLI tool for populating Airsequel with data." ) execParser opts >>= run diff --git a/package.yaml b/package.yaml index d25b866..4aafdbe 100644 --- a/package.yaml +++ b/package.yaml @@ -1,10 +1,8 @@ -name: repos-uploader +name: airput version: 0.0.0.0 -synopsis: | - Download metadata for a list of GitHub repos and save it to Airsequel -description: | - For more information check out the readme. -homepage: https://github.com/Airsequel/repos-uploader#readme +synopsis: CLI tool for populating Airsequel with data. +description: For more information check out the readme. +homepage: https://github.com/Airsequel/Airput#readme license: AGPL-3.0-or-later author: Adrian Sieber maintainer: adrian@feram.io @@ -50,7 +48,7 @@ library: source-dirs: source executables: - repos-uploader: + airput: language: GHC2021 source-dirs: app main: Main.hs