Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ jobs:
with:
python-version: '3.11'

- uses: astral-sh/ruff-action@v3

- name: Ruff lint
uses: chartboost/ruff-action@v1
run: ruff check .

- name: Ruff fmt
run: ruff format .

build:
name: Build
Expand Down
7 changes: 5 additions & 2 deletions src/github_rest_cli/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,19 @@ def get_repository(name: str, org: str = None):
return None


def create_repository(name: str, visibility: str, org: str = None):
def create_repository(name: str, visibility: str, org: str = None, empty: bool = False):
data = {
"name": name,
"auto_init": "true",
"visibility": visibility,
"auto_init": True,
}

if visibility == "private":
data["private"] = True

if empty:
data["auto_init"] = False

owner = fetch_user()
headers = get_headers()
url = build_url("orgs", org, "repos") if org else build_url("user", "repos")
Expand Down
10 changes: 9 additions & 1 deletion src/github_rest_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ def cli():
dest="org",
help="The organization name",
)
create_repo_parser.add_argument(
"-e",
"--empty",
required=False,
action="store_true",
dest="empty",
help="Create an empty repository",
)
create_repo_parser.set_defaults(func=create_repository)

# Subparser for "delete-repository" function
Expand Down Expand Up @@ -197,7 +205,7 @@ def cli():
elif command == "list-repo":
args.func(args.page, args.sort, args.role)
elif command == "create-repo":
args.func(args.name, args.visibility, args.org)
args.func(args.name, args.visibility, args.org, args.empty)
elif command == "delete-repo":
args.func(args.name, args.org)
elif command == "dependabot":
Expand Down
Loading