Skip to content

Commit 28f1050

Browse files
committed
document cli & name it to 'hfx'
1 parent c3cc59b commit 28f1050

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

packages/hub/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,32 @@ for await (const fileInfo of hub.listFiles({repo})) {
9393
await hub.deleteRepo({ repo, accessToken: "hf_..." });
9494
```
9595

96+
## CLI usage
97+
98+
You can use `@huggingface/hub` in CLI mode to upload files and folders to your repo.
99+
100+
```console
101+
npx @huggingface/hub upload coyotte508/test-model .
102+
npx @huggingface/hub upload datasets/coyotte508/test-dataset .
103+
# Same thing
104+
npx @huggingface/hub upload --repo-type dataset coyotte508/test-dataset .
105+
# Upload new data with 0 history in a separate branch
106+
npx @huggingface/hub upload coyotte508/test-model . --revision release --empty
107+
108+
npx @huggingface/hub --help
109+
npx @huggingface/hub upload --help
110+
```
111+
112+
You can also instal globally with `npm install -g @huggingface/hub`. Then you can do:
113+
114+
```console
115+
hfx upload coyotte508/test-model .
116+
hfx upload --repo-type dataset coyotte508/test-dataset . --revision release --empty
117+
118+
hfx --help
119+
hfx upload --help
120+
```
121+
96122
## OAuth Login
97123

98124
It's possible to login using OAuth (["Sign in with HF"](https://huggingface.co/docs/hub/oauth)).

packages/hub/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"face"
5959
],
6060
"bin": {
61-
"@huggingface/hub": "./dist/cli.js"
61+
"hfx": "./dist/cli.js"
6262
},
6363
"author": "Hugging Face",
6464
"license": "MIT",

packages/hub/src/lib/create-branch.ts

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export async function createBranch(params: {
2323
empty?: boolean;
2424
/**
2525
* Use this to overwrite the branch if it already exists.
26+
*
27+
* If you only specify `overwrite` and no `revision`/`empty`, and the branch already exists, it will be a no-op.
2628
*/
2729
overwrite?: boolean;
2830
}): Promise<void> {

0 commit comments

Comments
 (0)