Skip to content

Commit

Permalink
Rename project to "Airput"
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-si committed Jan 8, 2024
1 parent dae06a7 commit 1215805
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 40 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 8 additions & 11 deletions repos-uploader.cabal → airput.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
copyright: Adrian Sieber
Expand All @@ -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:
Expand All @@ -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:
Expand Down
43 changes: 23 additions & 20 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,43 +85,46 @@ 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."
, ""
, "Good search options are:"
, "- language:haskell"
, "- stars:>=10"
, "- stars:10..50"
, "- sort:updated-desc"
, "- sort:stars-asc"
, "- created:2023-10"
, "- archived:true"
]
)
Expand Down Expand Up @@ -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")
]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
12 changes: 5 additions & 7 deletions package.yaml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
Expand Down Expand Up @@ -50,7 +48,7 @@ library:
source-dirs: source

executables:
repos-uploader:
airput:
language: GHC2021
source-dirs: app
main: Main.hs

0 comments on commit 1215805

Please sign in to comment.