Fossil SCM
Add better usage and help to the "artifact" command.
Commit
57347e6ee87ab62dc579b5b3102aade9e7ba928e
Parent
b84b954fe0fe069…
1 file changed
+6
-2
+6
-2
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -283,22 +283,26 @@ | ||
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /* |
| 286 | 286 | ** COMMAND: artifact |
| 287 | 287 | ** |
| 288 | -** Usage: %fossil artifact ARTIFACT-ID ?OUTPUT-FILENAME? | |
| 288 | +** Usage: %fossil artifact ARTIFACT-ID ?OUTPUT-FILENAME? ?OPTIONS? | |
| 289 | 289 | ** |
| 290 | 290 | ** Extract an artifact by its SHA1 hash and write the results on |
| 291 | 291 | ** standard output, or if the optional 4th argument is given, in |
| 292 | 292 | ** the named output file. |
| 293 | +** | |
| 294 | +** Options: | |
| 295 | +** | |
| 296 | +** -R|--repository FILE Extract artifacts from repository FILE | |
| 293 | 297 | */ |
| 294 | 298 | void artifact_cmd(void){ |
| 295 | 299 | int rid; |
| 296 | 300 | Blob content; |
| 297 | 301 | const char *zFile; |
| 298 | 302 | db_find_and_open_repository(1); |
| 299 | - if( g.argc!=4 && g.argc!=3 ) usage("RECORDID ?FILENAME?"); | |
| 303 | + if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); | |
| 300 | 304 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 301 | 305 | rid = name_to_rid(g.argv[2]); |
| 302 | 306 | content_get(rid, &content); |
| 303 | 307 | blob_write_to_file(&content, zFile); |
| 304 | 308 | } |
| 305 | 309 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -283,22 +283,26 @@ | |
| 283 | } |
| 284 | |
| 285 | /* |
| 286 | ** COMMAND: artifact |
| 287 | ** |
| 288 | ** Usage: %fossil artifact ARTIFACT-ID ?OUTPUT-FILENAME? |
| 289 | ** |
| 290 | ** Extract an artifact by its SHA1 hash and write the results on |
| 291 | ** standard output, or if the optional 4th argument is given, in |
| 292 | ** the named output file. |
| 293 | */ |
| 294 | void artifact_cmd(void){ |
| 295 | int rid; |
| 296 | Blob content; |
| 297 | const char *zFile; |
| 298 | db_find_and_open_repository(1); |
| 299 | if( g.argc!=4 && g.argc!=3 ) usage("RECORDID ?FILENAME?"); |
| 300 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 301 | rid = name_to_rid(g.argv[2]); |
| 302 | content_get(rid, &content); |
| 303 | blob_write_to_file(&content, zFile); |
| 304 | } |
| 305 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -283,22 +283,26 @@ | |
| 283 | } |
| 284 | |
| 285 | /* |
| 286 | ** COMMAND: artifact |
| 287 | ** |
| 288 | ** Usage: %fossil artifact ARTIFACT-ID ?OUTPUT-FILENAME? ?OPTIONS? |
| 289 | ** |
| 290 | ** Extract an artifact by its SHA1 hash and write the results on |
| 291 | ** standard output, or if the optional 4th argument is given, in |
| 292 | ** the named output file. |
| 293 | ** |
| 294 | ** Options: |
| 295 | ** |
| 296 | ** -R|--repository FILE Extract artifacts from repository FILE |
| 297 | */ |
| 298 | void artifact_cmd(void){ |
| 299 | int rid; |
| 300 | Blob content; |
| 301 | const char *zFile; |
| 302 | db_find_and_open_repository(1); |
| 303 | if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); |
| 304 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 305 | rid = name_to_rid(g.argv[2]); |
| 306 | content_get(rid, &content); |
| 307 | blob_write_to_file(&content, zFile); |
| 308 | } |
| 309 |