| | @@ -685,15 +685,24 @@ |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /* |
| 688 | 688 | ** COMMAND: attachment* |
| 689 | 689 | ** |
| 690 | | -** Usage: %fossil attachment add ?PAGENAME? FILENAME [-t|--technote DATETIME ] |
| 690 | +** Usage: %fossil attachment add ?PAGENAME? FILENAME ?OPTIONS? |
| 691 | +** |
| 692 | +** Add an attachment to an existing wiki page or tech note. |
| 691 | 693 | ** |
| 692 | | -** Add an attachment to an existing wiki page or tech note. One of |
| 693 | | -** PAGENAME or DATETIME must be specified. |
| 694 | +** Options: |
| 695 | +** -t|--technote DATETIME Specifies the timestamp of |
| 696 | +** the technote to which the attachment |
| 697 | +** is to be made. The attachment will be |
| 698 | +** to the most recently modified tech note |
| 699 | +** with the specified timestamp. |
| 700 | +** -t|--technote TECHNOTE-ID Specifies the technote to be |
| 701 | +** updated by its technote id. |
| 694 | 702 | ** |
| 703 | +** One of PAGENAME, DATETIME or TECHNOTE-ID must be specified. |
| 695 | 704 | */ |
| 696 | 705 | void attachment_cmd(void){ |
| 697 | 706 | int n; |
| 698 | 707 | db_find_and_open_repository(0, 0); |
| 699 | 708 | if( g.argc<3 ){ |
| | @@ -732,17 +741,16 @@ |
| 732 | 741 | } |
| 733 | 742 | zTarget = zPageName; |
| 734 | 743 | zFile = g.argv[4]; |
| 735 | 744 | }else{ |
| 736 | 745 | if( g.argc!=4 ){ |
| 737 | | - usage("add FILENAME --technote DATETIME"); |
| 746 | + usage("add FILENAME --technote DATETIME|TECHNOTE-ID"); |
| 738 | 747 | } |
| 739 | | - rid = db_int(0, "SELECT objid FROM event" |
| 740 | | - " WHERE datetime(mtime)=datetime('%q') AND type='e'" |
| 741 | | - " ORDER BY mtime DESC LIMIT 1", |
| 742 | | - zETime |
| 743 | | - ); |
| 748 | + rid = wiki_technote_to_rid(zETime); |
| 749 | + if( rid<0 ){ |
| 750 | + fossil_fatal("ambiguous tech note id: %s", zETime); |
| 751 | + } |
| 744 | 752 | if( (pWiki = manifest_get(rid, CFTYPE_EVENT, 0))!=0 ){ |
| 745 | 753 | zBody = pWiki->zWiki; |
| 746 | 754 | } |
| 747 | 755 | if( zBody==0 ){ |
| 748 | 756 | fossil_fatal("technote [%s] not found",zETime); |
| 749 | 757 | |