Skip to content

Commit

Permalink
Add CLI helper, increase httpx version range
Browse files Browse the repository at this point in the history
  • Loading branch information
tiptenbrink committed Oct 17, 2023
1 parent 9a44fb2 commit 56c1404
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 134 deletions.
140 changes: 64 additions & 76 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "dirgh"
version = "0.2.1"
version = "0.3.0"
description = "With dirgh you can easily download a directory from GitHub programmatically from Python or using the CLI."
authors = ["tiptenbrink <[email protected]>"]
readme = "README.md"
license = "Apache-2.0"

[tool.poetry.dependencies]
python = "^3.9"
httpx = ">=0.23.0, < 0.25.0"
httpx = ">=0.23.0, < 0.26.0"
trio = ">= 0.20.0, < 0.23.0"

[tool.poetry.dev-dependencies]
Expand Down
2 changes: 0 additions & 2 deletions src/dirgh/ci/Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions src/dirgh/ci/deployment/.env

This file was deleted.

15 changes: 0 additions & 15 deletions src/dirgh/ci/deployment/deploy.sh

This file was deleted.

16 changes: 0 additions & 16 deletions src/dirgh/ci/deployment/docker-compose.yml

This file was deleted.

8 changes: 0 additions & 8 deletions src/dirgh/ci/test.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/dirgh/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def run():

ref_nm = 'ref'
ref_default = 'HEAD'
ref_help = f"commit reference, can be in any branch. (default: {ref_default})"
ref_help = f"any valid ref, can be in any branch. (default: {ref_default})"
parser.add_argument(f'--{ref_nm}', help=ref_help, default=ref_default, required=False)

recursive_nm = 'recursive'
Expand Down
16 changes: 16 additions & 0 deletions src/dirgh/cli_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import getpass
import os


def find_token(env_prefix: str = "", ask_token: bool = False):
# <env_prefix>DIRGH_GH_TOKEN
pass_key = f"{env_prefix}dirgh_gh_token".replace('-', '_')
pass_key_env = pass_key.upper()
if ask_token:
key_pass = getpass.getpass("Input your token:\n")
else:
key_pass = os.environ.get(pass_key_env)
if key_pass is None:
raise ValueError(f"Please supply token or set the {pass_key_env} environment variable!")

return key_pass

0 comments on commit 56c1404

Please sign in to comment.