in src/huggingface_hub/commands/repo_files.py [0:0]
def register_subcommand(parser: _SubParsersAction):
repo_files_parser = parser.add_parser("repo-files", help="Manage files in a repo on the Hub")
repo_files_parser.add_argument(
"repo_id", type=str, help="The ID of the repo to manage (e.g. `username/repo-name`)."
)
repo_files_subparsers = repo_files_parser.add_subparsers(
help="Action to execute against the files.",
required=True,
)
delete_subparser = repo_files_subparsers.add_parser(
"delete",
help="Delete files from a repo on the Hub",
)
delete_subparser.set_defaults(func=lambda args: DeleteFilesSubCommand(args))
delete_subparser.add_argument(
"patterns",
nargs="+",
type=str,
help="Glob patterns to match files to delete.",
)
delete_subparser.add_argument(
"--repo-type",
choices=["model", "dataset", "space"],
default="model",
help="Type of the repo to upload to (e.g. `dataset`).",
)
delete_subparser.add_argument(
"--revision",
type=str,
help=(
"An optional Git revision to push to. It can be a branch name "
"or a PR reference. If revision does not"
" exist and `--create-pr` is not set, a branch will be automatically created."
),
)
delete_subparser.add_argument(
"--commit-message", type=str, help="The summary / title / first line of the generated commit."
)
delete_subparser.add_argument(
"--commit-description", type=str, help="The description of the generated commit."
)
delete_subparser.add_argument(
"--create-pr", action="store_true", help="Whether to create a new Pull Request for these changes."
)
repo_files_parser.add_argument(
"--token",
type=str,
help="A User Access Token generated from https://huggingface.co/settings/tokens",
)
repo_files_parser.set_defaults(func=RepoFilesCommand)