github.com/rpdict/ponzu@v0.10.1-0.20190226054626-477f29d6bf5e/docs/build/CLI/General-Usage/index.html (about) 1 2 <!DOCTYPE html> 3 <html lang="en" class="no-js"> 4 <head> 5 6 <meta charset="utf-8"> 7 <meta name="viewport" content="width=device-width,initial-scale=1"> 8 9 10 11 12 <link rel="shortcut icon" href="../../assets/images/favicon.png"> 13 14 <meta name="generator" content="mkdocs-0.16.3, mkdocs-material-1.6.1"> 15 16 17 18 <title>Using the Ponzu Command Line Interface (CLI)</title> 19 20 21 22 <script src="../../assets/javascripts/modernizr-56ade86843.js"></script> 23 24 25 <link rel="stylesheet" href="../../assets/stylesheets/application-4d0d3f2fbf.css"> 26 27 <link rel="stylesheet" href="../../assets/stylesheets/application-f78e5cb881.palette.css"> 28 29 30 31 32 33 34 35 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono"> 36 <style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style> 37 38 <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> 39 40 41 42 </head> 43 44 45 46 47 <body data-md-color-primary="grey" data-md-color-accent="light-blue"> 48 49 <svg class="md-svg"> 50 <defs> 51 52 53 <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg> 54 55 </defs> 56 </svg> 57 <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer"> 58 <input class="md-toggle" data-md-toggle="search" type="checkbox" id="search"> 59 <label class="md-overlay" data-md-component="overlay" for="drawer"></label> 60 61 <header class="md-header" data-md-component="header"> 62 <nav class="md-header-nav md-grid"> 63 <div class="md-flex"> 64 <div class="md-flex__cell md-flex__cell--shrink"> 65 66 <a href="../.." title="Ponzu" class="md-logo md-header-nav__button"> 67 <img src="../../images/logo.png" width="24" height="24"> 68 </a> 69 70 </div> 71 <div class="md-flex__cell md-flex__cell--shrink"> 72 <label class="md-icon md-icon--menu md-header-nav__button" for="drawer"></label> 73 </div> 74 <div class="md-flex__cell md-flex__cell--stretch"> 75 <span class="md-flex__ellipsis md-header-nav__title"> 76 77 78 79 <span class="md-header-nav__parent"> 80 CLI 81 </span> 82 83 84 General Usage 85 86 </span> 87 </div> 88 <div class="md-flex__cell md-flex__cell--shrink"> 89 90 <label class="md-icon md-icon--search md-header-nav__button" for="search"></label> 91 92 <div class="md-search" data-md-component="search"> 93 <label class="md-search__overlay" for="search"></label> 94 <div class="md-search__inner"> 95 <form class="md-search__form" name="search"> 96 <input type="text" class="md-search__input" name="query" required placeholder="Search" accesskey="s" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query"> 97 <label class="md-icon md-search__icon" for="search"></label> 98 <button type="reset" class="md-icon md-search__icon" data-md-component="reset">close</button> 99 </form> 100 <div class="md-search__output"> 101 <div class="md-search__scrollwrap" data-md-scrollfix> 102 <div class="md-search-result" data-md-component="result"> 103 <div class="md-search-result__meta" data-md-lang-result-none="No matching documents" data-md-lang-result-one="1 matching document" data-md-lang-result-other="# matching documents"> 104 Type to start searching 105 </div> 106 <ol class="md-search-result__list"></ol> 107 </div> 108 </div> 109 </div> 110 </div> 111 </div> 112 113 </div> 114 <div class="md-flex__cell md-flex__cell--shrink"> 115 <div class="md-header-nav__source"> 116 117 118 119 120 121 122 123 <a href="https://github.com/rpdict/ponzu" title="Go to repository" class="md-source" data-md-source="github"> 124 125 <div class="md-source__icon"> 126 <svg viewBox="0 0 24 24" width="24" height="24"> 127 <use xlink:href="#github" width="24" height="24"></use> 128 </svg> 129 </div> 130 131 <div class="md-source__repository"> 132 ponzu-cms/ponzu 133 </div> 134 </a> 135 136 137 </div> 138 </div> 139 </div> 140 </nav> 141 </header> 142 143 <div class="md-container"> 144 145 146 <main class="md-main"> 147 <div class="md-main__inner md-grid" data-md-component="container"> 148 149 150 <div class="md-sidebar md-sidebar--primary" data-md-component="navigation"> 151 <div class="md-sidebar__scrollwrap"> 152 <div class="md-sidebar__inner"> 153 <nav class="md-nav md-nav--primary" data-md-level="0"> 154 <label class="md-nav__title md-nav__title--site" for="drawer"> 155 156 <i class="md-logo md-nav__button"> 157 <img src="../../images/logo.png"> 158 </i> 159 160 Ponzu 161 </label> 162 163 <div class="md-nav__source"> 164 165 166 167 168 169 170 <a href="https://github.com/rpdict/ponzu" title="Go to repository" class="md-source" data-md-source="github"> 171 172 <div class="md-source__icon"> 173 <svg viewBox="0 0 24 24" width="24" height="24"> 174 <use xlink:href="#github" width="24" height="24"></use> 175 </svg> 176 </div> 177 178 <div class="md-source__repository"> 179 ponzu-cms/ponzu 180 </div> 181 </a> 182 183 </div> 184 185 <ul class="md-nav__list" data-md-scrollfix> 186 187 188 189 190 191 192 <li class="md-nav__item"> 193 <a href="../.." title="Home" class="md-nav__link"> 194 Home 195 </a> 196 </li> 197 198 199 200 201 202 203 204 205 206 <li class="md-nav__item md-nav__item--active md-nav__item--nested"> 207 208 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-2" type="checkbox" id="nav-2" checked> 209 210 <label class="md-nav__link" for="nav-2"> 211 CLI 212 </label> 213 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 214 <label class="md-nav__title" for="nav-2"> 215 CLI 216 </label> 217 <ul class="md-nav__list" data-md-scrollfix> 218 219 220 221 222 223 224 225 226 227 <li class="md-nav__item md-nav__item--active"> 228 229 <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc"> 230 231 232 <label class="md-nav__link md-nav__link--active" for="toc"> 233 General Usage 234 </label> 235 236 <a href="./" title="General Usage" class="md-nav__link md-nav__link--active"> 237 General Usage 238 </a> 239 240 241 <nav class="md-nav md-nav--secondary"> 242 243 244 245 <label class="md-nav__title" for="toc">Table of contents</label> 246 <ul class="md-nav__list" data-md-scrollfix> 247 248 <li class="md-nav__item"> 249 <a href="#commands" title="Commands" class="md-nav__link"> 250 Commands 251 </a> 252 253 <nav class="md-nav"> 254 <ul class="md-nav__list"> 255 256 <li class="md-nav__item"> 257 <a href="#new" title="new" class="md-nav__link"> 258 new 259 </a> 260 261 </li> 262 263 <li class="md-nav__item"> 264 <a href="#generate-gen-g" title="generate, gen, g" class="md-nav__link"> 265 generate, gen, g 266 </a> 267 268 </li> 269 270 <li class="md-nav__item"> 271 <a href="#build" title="build" class="md-nav__link"> 272 build 273 </a> 274 275 </li> 276 277 <li class="md-nav__item"> 278 <a href="#run" title="run" class="md-nav__link"> 279 run 280 </a> 281 282 </li> 283 284 <li class="md-nav__item"> 285 <a href="#upgrade" title="upgrade" class="md-nav__link"> 286 upgrade 287 </a> 288 289 </li> 290 291 <li class="md-nav__item"> 292 <a href="#add-a" title="add, a" class="md-nav__link"> 293 add, a 294 </a> 295 296 </li> 297 298 <li class="md-nav__item"> 299 <a href="#version-v" title="version, v" class="md-nav__link"> 300 version, v 301 </a> 302 303 </li> 304 305 </ul> 306 </nav> 307 308 </li> 309 310 <li class="md-nav__item"> 311 <a href="#contributing" title="Contributing" class="md-nav__link"> 312 Contributing 313 </a> 314 315 </li> 316 317 318 319 </ul> 320 321 </nav> 322 323 </li> 324 325 326 327 328 329 330 331 <li class="md-nav__item"> 332 <a href="../Generating-References/" title="Generating References" class="md-nav__link"> 333 Generating References 334 </a> 335 </li> 336 337 338 </ul> 339 </nav> 340 </li> 341 342 343 344 345 346 347 348 <li class="md-nav__item md-nav__item--nested"> 349 350 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3"> 351 352 <label class="md-nav__link" for="nav-3"> 353 Content 354 </label> 355 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 356 <label class="md-nav__title" for="nav-3"> 357 Content 358 </label> 359 <ul class="md-nav__list" data-md-scrollfix> 360 361 362 363 364 365 366 367 <li class="md-nav__item"> 368 <a href="../../Content/An-Overview/" title="An Overview" class="md-nav__link"> 369 An Overview 370 </a> 371 </li> 372 373 374 375 376 377 378 379 <li class="md-nav__item"> 380 <a href="../../Content/Extending-Content/" title="Extending Content" class="md-nav__link"> 381 Extending Content 382 </a> 383 </li> 384 385 386 </ul> 387 </nav> 388 </li> 389 390 391 392 393 394 395 396 <li class="md-nav__item md-nav__item--nested"> 397 398 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4"> 399 400 <label class="md-nav__link" for="nav-4"> 401 Form Fields 402 </label> 403 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 404 <label class="md-nav__title" for="nav-4"> 405 Form Fields 406 </label> 407 <ul class="md-nav__list" data-md-scrollfix> 408 409 410 411 412 413 414 415 <li class="md-nav__item"> 416 <a href="../../Form-Fields/HTML-Inputs/" title="HTML Inputs" class="md-nav__link"> 417 HTML Inputs 418 </a> 419 </li> 420 421 422 </ul> 423 </nav> 424 </li> 425 426 427 428 429 430 431 432 <li class="md-nav__item md-nav__item--nested"> 433 434 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5"> 435 436 <label class="md-nav__link" for="nav-5"> 437 HTTP APIs 438 </label> 439 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 440 <label class="md-nav__title" for="nav-5"> 441 HTTP APIs 442 </label> 443 <ul class="md-nav__list" data-md-scrollfix> 444 445 446 447 448 449 450 451 <li class="md-nav__item"> 452 <a href="../../HTTP-APIs/Content/" title="Content" class="md-nav__link"> 453 Content 454 </a> 455 </li> 456 457 458 459 460 461 462 463 <li class="md-nav__item"> 464 <a href="../../HTTP-APIs/File-Metadata/" title="File Metadata" class="md-nav__link"> 465 File Metadata 466 </a> 467 </li> 468 469 470 471 472 473 474 475 <li class="md-nav__item"> 476 <a href="../../HTTP-APIs/Search/" title="Search" class="md-nav__link"> 477 Search 478 </a> 479 </li> 480 481 482 </ul> 483 </nav> 484 </li> 485 486 487 488 489 490 491 492 <li class="md-nav__item md-nav__item--nested"> 493 494 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-6" type="checkbox" id="nav-6"> 495 496 <label class="md-nav__link" for="nav-6"> 497 Interfaces 498 </label> 499 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 500 <label class="md-nav__title" for="nav-6"> 501 Interfaces 502 </label> 503 <ul class="md-nav__list" data-md-scrollfix> 504 505 506 507 508 509 510 511 <li class="md-nav__item"> 512 <a href="../../Interfaces/API/" title="API" class="md-nav__link"> 513 API 514 </a> 515 </li> 516 517 518 519 520 521 522 523 <li class="md-nav__item"> 524 <a href="../../Interfaces/Editor/" title="Editor" class="md-nav__link"> 525 Editor 526 </a> 527 </li> 528 529 530 531 532 533 534 535 <li class="md-nav__item"> 536 <a href="../../Interfaces/Format/" title="Format" class="md-nav__link"> 537 Format 538 </a> 539 </li> 540 541 542 543 544 545 546 547 <li class="md-nav__item"> 548 <a href="../../Interfaces/Item/" title="Item" class="md-nav__link"> 549 Item 550 </a> 551 </li> 552 553 554 555 556 557 558 559 <li class="md-nav__item"> 560 <a href="../../Interfaces/Search/" title="Search" class="md-nav__link"> 561 Search 562 </a> 563 </li> 564 565 566 </ul> 567 </nav> 568 </li> 569 570 571 572 573 574 575 576 <li class="md-nav__item md-nav__item--nested"> 577 578 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-7" type="checkbox" id="nav-7"> 579 580 <label class="md-nav__link" for="nav-7"> 581 Ponzu Addons 582 </label> 583 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 584 <label class="md-nav__title" for="nav-7"> 585 Ponzu Addons 586 </label> 587 <ul class="md-nav__list" data-md-scrollfix> 588 589 590 591 592 593 594 595 <li class="md-nav__item"> 596 <a href="../../Ponzu-Addons/Creating-Addons/" title="Creating Addons" class="md-nav__link"> 597 Creating Addons 598 </a> 599 </li> 600 601 602 603 604 605 606 607 <li class="md-nav__item"> 608 <a href="../../Ponzu-Addons/Using-Addons/" title="Using Addons" class="md-nav__link"> 609 Using Addons 610 </a> 611 </li> 612 613 614 </ul> 615 </nav> 616 </li> 617 618 619 620 621 622 623 624 <li class="md-nav__item md-nav__item--nested"> 625 626 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-8" type="checkbox" id="nav-8"> 627 628 <label class="md-nav__link" for="nav-8"> 629 Quickstart 630 </label> 631 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 632 <label class="md-nav__title" for="nav-8"> 633 Quickstart 634 </label> 635 <ul class="md-nav__list" data-md-scrollfix> 636 637 638 639 640 641 642 643 <li class="md-nav__item"> 644 <a href="../../Quickstart/Overview/" title="Overview" class="md-nav__link"> 645 Overview 646 </a> 647 </li> 648 649 650 </ul> 651 </nav> 652 </li> 653 654 655 656 657 658 659 660 <li class="md-nav__item md-nav__item--nested"> 661 662 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-9" type="checkbox" id="nav-9"> 663 664 <label class="md-nav__link" for="nav-9"> 665 References 666 </label> 667 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 668 <label class="md-nav__title" for="nav-9"> 669 References 670 </label> 671 <ul class="md-nav__list" data-md-scrollfix> 672 673 674 675 676 677 678 679 <li class="md-nav__item"> 680 <a href="../../References/Overview/" title="Overview" class="md-nav__link"> 681 Overview 682 </a> 683 </li> 684 685 686 </ul> 687 </nav> 688 </li> 689 690 691 692 693 694 695 696 <li class="md-nav__item md-nav__item--nested"> 697 698 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-10" type="checkbox" id="nav-10"> 699 700 <label class="md-nav__link" for="nav-10"> 701 Running Backups 702 </label> 703 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 704 <label class="md-nav__title" for="nav-10"> 705 Running Backups 706 </label> 707 <ul class="md-nav__list" data-md-scrollfix> 708 709 710 711 712 713 714 715 <li class="md-nav__item"> 716 <a href="../../Running-Backups/Backups/" title="Backups" class="md-nav__link"> 717 Backups 718 </a> 719 </li> 720 721 722 </ul> 723 </nav> 724 </li> 725 726 727 728 729 730 731 732 <li class="md-nav__item md-nav__item--nested"> 733 734 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-11" type="checkbox" id="nav-11"> 735 736 <label class="md-nav__link" for="nav-11"> 737 System Configuration 738 </label> 739 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 740 <label class="md-nav__title" for="nav-11"> 741 System Configuration 742 </label> 743 <ul class="md-nav__list" data-md-scrollfix> 744 745 746 747 748 749 750 751 <li class="md-nav__item"> 752 <a href="../../System-Configuration/Settings/" title="Settings" class="md-nav__link"> 753 Settings 754 </a> 755 </li> 756 757 758 </ul> 759 </nav> 760 </li> 761 762 763 764 765 766 767 768 <li class="md-nav__item md-nav__item--nested"> 769 770 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-12" type="checkbox" id="nav-12"> 771 772 <label class="md-nav__link" for="nav-12"> 773 System Deployment 774 </label> 775 <nav class="md-nav" data-md-component="collapsible" data-md-level="1"> 776 <label class="md-nav__title" for="nav-12"> 777 System Deployment 778 </label> 779 <ul class="md-nav__list" data-md-scrollfix> 780 781 782 783 784 785 786 787 <li class="md-nav__item"> 788 <a href="../../System-Deployment/Docker/" title="Docker" class="md-nav__link"> 789 Docker 790 </a> 791 </li> 792 793 794 795 796 797 798 799 <li class="md-nav__item"> 800 <a href="../../System-Deployment/SysV-Style/" title="SysV Style" class="md-nav__link"> 801 SysV Style 802 </a> 803 </li> 804 805 806 </ul> 807 </nav> 808 </li> 809 810 811 </ul> 812 </nav> 813 </div> 814 </div> 815 </div> 816 817 818 <div class="md-sidebar md-sidebar--secondary" data-md-component="toc"> 819 <div class="md-sidebar__scrollwrap"> 820 <div class="md-sidebar__inner"> 821 822 <nav class="md-nav md-nav--secondary"> 823 824 825 826 <label class="md-nav__title" for="toc">Table of contents</label> 827 <ul class="md-nav__list" data-md-scrollfix> 828 829 <li class="md-nav__item"> 830 <a href="#commands" title="Commands" class="md-nav__link"> 831 Commands 832 </a> 833 834 <nav class="md-nav"> 835 <ul class="md-nav__list"> 836 837 <li class="md-nav__item"> 838 <a href="#new" title="new" class="md-nav__link"> 839 new 840 </a> 841 842 </li> 843 844 <li class="md-nav__item"> 845 <a href="#generate-gen-g" title="generate, gen, g" class="md-nav__link"> 846 generate, gen, g 847 </a> 848 849 </li> 850 851 <li class="md-nav__item"> 852 <a href="#build" title="build" class="md-nav__link"> 853 build 854 </a> 855 856 </li> 857 858 <li class="md-nav__item"> 859 <a href="#run" title="run" class="md-nav__link"> 860 run 861 </a> 862 863 </li> 864 865 <li class="md-nav__item"> 866 <a href="#upgrade" title="upgrade" class="md-nav__link"> 867 upgrade 868 </a> 869 870 </li> 871 872 <li class="md-nav__item"> 873 <a href="#add-a" title="add, a" class="md-nav__link"> 874 add, a 875 </a> 876 877 </li> 878 879 <li class="md-nav__item"> 880 <a href="#version-v" title="version, v" class="md-nav__link"> 881 version, v 882 </a> 883 884 </li> 885 886 </ul> 887 </nav> 888 889 </li> 890 891 <li class="md-nav__item"> 892 <a href="#contributing" title="Contributing" class="md-nav__link"> 893 Contributing 894 </a> 895 896 </li> 897 898 899 900 </ul> 901 902 </nav> 903 </div> 904 </div> 905 </div> 906 907 908 <div class="md-content"> 909 <article class="md-content__inner md-typeset"> 910 911 912 913 <h1>General Usage</h1> 914 915 <div class="codehilite"><pre><span></span>$ ponzu <span class="o">[</span>flags<span class="o">]</span> <span class="nb">command</span> <params> 916 </pre></div> 917 918 919 <h2 id="commands">Commands<a class="headerlink" href="#commands" title="Permanent link">¶</a></h2> 920 <h3 id="new">new<a class="headerlink" href="#new" title="Permanent link">¶</a></h3> 921 <p>Creates a project directory of the name supplied as a parameter immediately 922 following the 'new' option in the $GOPATH/src directory. Note: 'new' depends on 923 the program 'git' and possibly a network connection. If there is no local 924 repository to clone from at the local machine's $GOPATH, 'new' will attempt to 925 clone the 'github.com/rpdict/ponzu' package from over the network.</p> 926 <p>Example:</p> 927 <div class="codehilite"><pre><span></span>$ ponzu new github.com/nilslice/proj 928 > New ponzu project created at <span class="nv">$GOPATH</span>/src/github.com/nilslice/proj 929 </pre></div> 930 931 932 <hr /> 933 <h3 id="generate-gen-g">generate, gen, g<a class="headerlink" href="#generate-gen-g" title="Permanent link">¶</a></h3> 934 <p>Generate boilerplate code for various Ponzu components, such as <code>content</code>.</p> 935 <p>Example:</p> 936 <div class="codehilite"><pre><span></span> generator struct fields and built-in types... 937 <span class="p">|</span> <span class="p">|</span> 938 v v 939 $ ponzu gen content review title:<span class="s2">"string"</span> body:<span class="s2">"string"</span>:richtext rating:<span class="s2">"int"</span> 940 ^ ^ 941 <span class="p">|</span> <span class="p">|</span> 942 struct <span class="nb">type</span> <span class="o">(</span>optional<span class="o">)</span> input view specifier 943 </pre></div> 944 945 946 <p>The command above will generate the file <code>content/review.go</code> with boilerplate 947 methods, as well as struct definition, and corresponding field tags like:</p> 948 <div class="codehilite"><pre><span></span><span class="kd">type</span> <span class="nx">Review</span> <span class="kd">struct</span> <span class="p">{</span> 949 <span class="nx">item</span><span class="p">.</span><span class="nx">Item</span> 950 951 <span class="nx">Title</span> <span class="kt">string</span> <span class="s">`json:"title"`</span> 952 <span class="nx">Body</span> <span class="kt">string</span> <span class="s">`json:"body"`</span> 953 <span class="nx">Rating</span> <span class="kt">int</span> <span class="s">`json:"rating"`</span> 954 <span class="nx">Tags</span> <span class="p">[]</span><span class="kt">string</span> <span class="s">`json:"tags"`</span> 955 <span class="p">}</span> 956 </pre></div> 957 958 959 <p>The generate command will intelligently parse more sophisticated field names 960 such as 'field_name' and convert it to 'FieldName' and vice versa, only where 961 appropriate as per common Go idioms. Errors will be reported, but successful 962 generate commands return nothing.</p> 963 <p><strong>Input View Specifiers</strong> <em>(optional)</em></p> 964 <p>The CLI can optionally parse a third parameter on the fields provided to generate 965 the type of HTML view an editor field is presented within. If no third parameter 966 is added, a plain text HTML input will be generated. In the example above, the 967 argument shown as <code>body:string:richtext</code> would show the Richtext input instead 968 of a plain text HTML input (as shown in the screenshot). The following input 969 view specifiers are implemented:</p> 970 <table> 971 <thead> 972 <tr> 973 <th>CLI parameter</th> 974 <th>Generates</th> 975 </tr> 976 </thead> 977 <tbody> 978 <tr> 979 <td>checkbox</td> 980 <td><a href="../../Form-Fields/HTML-Inputs/#editorcheckbox"><code>editor.Checkbox()</code></a></td> 981 </tr> 982 <tr> 983 <td>custom</td> 984 <td>generates a pre-styled empty div to fill with HTML</td> 985 </tr> 986 <tr> 987 <td>file</td> 988 <td><a href="../../Form-Fields/HTML-Inputs/#editorfile"><code>editor.File()</code></a></td> 989 </tr> 990 <tr> 991 <td>hidden</td> 992 <td><a href="../../Form-Fields/HTML-Inputs/#editorinput"><code>editor.Input()</code></a> + uses type=hidden</td> 993 </tr> 994 <tr> 995 <td>input, text</td> 996 <td><a href="../../Form-Fields/HTML-Inputs/#editorinput"><code>editor.Input()</code></a></td> 997 </tr> 998 <tr> 999 <td>richtext</td> 1000 <td><a href="../../Form-Fields/HTML-Inputs/#editorrichtext"><code>editor.Richtext()</code></a></td> 1001 </tr> 1002 <tr> 1003 <td>select</td> 1004 <td><a href="../../Form-Fields/HTML-Inputs/#editorselect"><code>editor.Select()</code></a></td> 1005 </tr> 1006 <tr> 1007 <td>textarea</td> 1008 <td><a href="../../Form-Fields/HTML-Inputs/#editortextarea"><code>editor.Textarea()</code></a></td> 1009 </tr> 1010 <tr> 1011 <td>tags</td> 1012 <td><a href="../../Form-Fields/HTML-Inputs/#editortags"><code>editor.Tags()</code></a></td> 1013 </tr> 1014 </tbody> 1015 </table> 1016 <p><strong>Generate Content References</strong></p> 1017 <p>It's also possible to generate all of the code needed to create references between 1018 your content types. The syntax to do so is below, but refer to the <a href="../../CLI/Generating-References">documentation</a> 1019 for more details:</p> 1020 <div class="codehilite"><pre><span></span>$ ponzu gen c author name:string genre:string:select 1021 $ ponzu gen c book title:string author:@author,name,genre 1022 </pre></div> 1023 1024 1025 <p>The commands above will generate a <code>Book</code> Content type with a reference to an 1026 <code>Author</code> item, by also generating a <a href="../../Form-Fields/HTML-Inputs/#referenceselect"><code>reference.Select</code></a> 1027 as the view for the <code>author</code> field.</p> 1028 <hr /> 1029 <h3 id="build">build<a class="headerlink" href="#build" title="Permanent link">¶</a></h3> 1030 <p>From within your Ponzu project directory, running build will copy and move 1031 the necessary files from your workspace into the vendored directory, and 1032 will build/compile the project to then be run. </p> 1033 <p>Optional flags: 1034 - <code>--gocmd</code> sets the binary used when executing <code>go build</code> within <code>ponzu</code> build step</p> 1035 <p>Example:</p> 1036 <div class="codehilite"><pre><span></span>$ ponzu build 1037 <span class="o">(</span>or<span class="o">)</span> 1038 $ ponzu build --gocmd<span class="o">=</span>go1.8rc1 <span class="c1"># useful for testing</span> 1039 </pre></div> 1040 1041 1042 <p>Errors will be reported, but successful build commands return nothing.</p> 1043 <hr /> 1044 <h3 id="run">run<a class="headerlink" href="#run" title="Permanent link">¶</a></h3> 1045 <p>Starts the HTTP server for the JSON API, Admin System, or both. 1046 The segments, separated by a comma, describe which services to start, either 1047 'admin' (Admin System / CMS backend) or 'api' (JSON API), and, optionally, 1048 if the server should utilize TLS encryption - served over HTTPS, which is 1049 automatically managed using Let's Encrypt (https://letsencrypt.org) </p> 1050 <p>Optional flags:</p> 1051 <ul> 1052 <li><code>--bind</code> sets the address for ponzu to bind the HTTP(S) server</li> 1053 <li><code>--port</code> sets the port on which the server listens for HTTP requests [defaults to 8080]</li> 1054 <li><code>--https-port</code> sets the port on which the server listens for HTTPS requests [defaults to 443]</li> 1055 <li><code>--https</code> enables auto HTTPS management via Let's Encrypt (port is always 443)</li> 1056 <li><code>--dev-https</code> generates self-signed SSL certificates for development-only (port is 10443)</li> 1057 <li><code>--docs</code> runs a local documentation server in case of no network connection</li> 1058 <li><code>--docs-port</code> sets the port on which the docs server listens for HTTP requests [defaults to 1234]</li> 1059 </ul> 1060 <p>Example: </p> 1061 <div class="codehilite"><pre><span></span>$ ponzu run 1062 <span class="o">(</span>or<span class="o">)</span> 1063 $ ponzu run --bind<span class="o">=</span><span class="m">0</span>.0.0.0 1064 <span class="o">(</span>or<span class="o">)</span> 1065 $ ponzu run --port<span class="o">=</span><span class="m">8080</span> --https admin,api 1066 <span class="o">(</span>or<span class="o">)</span> 1067 $ ponzu run admin 1068 <span class="o">(</span>or<span class="o">)</span> 1069 $ ponzu run --port<span class="o">=</span><span class="m">8888</span> api 1070 <span class="o">(</span>or<span class="o">)</span> 1071 $ ponzu run --dev-https 1072 </pre></div> 1073 1074 1075 <p>Defaults to <code>$ ponzu run --port=8080 admin,api</code> (running Admin & API on port 8080, without TLS)</p> 1076 <p><em>Note:</em> 1077 Admin and API cannot run on separate processes unless you use a copy of the 1078 database, since the first process to open it receives a lock. If you intend 1079 to run the Admin and API on separate processes, you must call them with the 1080 'ponzu' command independently.</p> 1081 <hr /> 1082 <h3 id="upgrade">upgrade<a class="headerlink" href="#upgrade" title="Permanent link">¶</a></h3> 1083 <p>Will backup your own custom project code (like content, addons, uploads, etc) so 1084 we can safely re-clone Ponzu from the latest version you have or from the network 1085 if necessary. Before running <code>$ ponzu upgrade</code>, you should update the <code>ponzu</code> 1086 package by running <code>$ go get -u github.com/rpdict/ponzu/...</code> </p> 1087 <p>Example:</p> 1088 <div class="codehilite"><pre><span></span>$ ponzu upgrade 1089 </pre></div> 1090 1091 1092 <hr /> 1093 <h3 id="add-a">add, a<a class="headerlink" href="#add-a" title="Permanent link">¶</a></h3> 1094 <p>Downloads an addon to GOPATH/src and copies it to the current Ponzu project's 1095 <code>/addons</code> directory.</p> 1096 <p>Example:</p> 1097 <div class="codehilite"><pre><span></span>$ ponzu add github.com/bosssauce/fbscheduler 1098 </pre></div> 1099 1100 1101 <p>Errors will be reported, but successful add commands return nothing.</p> 1102 <hr /> 1103 <h3 id="version-v">version, v<a class="headerlink" href="#version-v" title="Permanent link">¶</a></h3> 1104 <p>Prints the version of Ponzu your project is using. Must be called from within a 1105 Ponzu project directory. By passing the <code>--cli</code> flag, the <code>version</code> command will 1106 print the version of the Ponzu CLI you have installed.</p> 1107 <p>Example:</p> 1108 <div class="codehilite"><pre><span></span>$ ponzu version 1109 Ponzu v0.8.2 1110 <span class="c1"># (or)</span> 1111 $ ponzu version --cli 1112 Ponzu v0.9.2 1113 </pre></div> 1114 1115 1116 <hr /> 1117 <h2 id="contributing">Contributing<a class="headerlink" href="#contributing" title="Permanent link">¶</a></h2> 1118 <ol> 1119 <li>Checkout branch ponzu-dev</li> 1120 <li>Make code changes</li> 1121 <li>Test changes to ponzu-dev branch<ul> 1122 <li>make a commit to ponzu-dev</li> 1123 <li>to manually test, you will need to use a new copy (ponzu new path/to/code), 1124 but pass the <code>--dev</code> flag so that ponzu generates a new copy from the <code>ponzu-dev</code> 1125 branch, not master by default (i.e. <code>$ponzu new --dev /path/to/code</code>)</li> 1126 <li>build and run with <code>$ ponzu build</code> and <code>$ ponzu run</code></li> 1127 </ul> 1128 </li> 1129 <li>To add back to master: <ul> 1130 <li>first push to origin ponzu-dev</li> 1131 <li>create a pull request </li> 1132 <li>will then be merged into master</li> 1133 </ul> 1134 </li> 1135 </ol> 1136 <p><em>A typical contribution workflow might look like:</em></p> 1137 <div class="codehilite"><pre><span></span><span class="c1"># clone the repository and checkout ponzu-dev</span> 1138 $ git clone https://github.com/rpdict/ponzu path/to/local/ponzu <span class="c1"># (or your fork)</span> 1139 $ git checkout ponzu-dev 1140 1141 <span class="c1"># install ponzu with go get or from your own local path</span> 1142 $ go get github.com/rpdict/ponzu/... 1143 <span class="c1"># or</span> 1144 $ <span class="nb">cd</span> /path/to/local/ponzu 1145 $ go install ./... 1146 1147 <span class="c1"># edit files, add features, etc</span> 1148 $ git add -A 1149 $ git commit -m <span class="s1">'edited files, added features, etc'</span> 1150 1151 <span class="c1"># now you need to test the feature.. make a new ponzu project, but pass --dev flag</span> 1152 $ ponzu --dev new /path/to/new/project <span class="c1"># will create $GOPATH/src/path/to/new/project</span> 1153 1154 <span class="c1"># build & run ponzu from the new project directory</span> 1155 $ <span class="nb">cd</span> /path/to/new/project 1156 $ ponzu build <span class="o">&&</span> ponzu run 1157 1158 <span class="c1"># push to your origin:ponzu-dev branch and create a PR at ponzu-cms/ponzu</span> 1159 $ git push origin ponzu-dev 1160 <span class="c1"># ... go to https://github.com/rpdict/ponzu and create a PR</span> 1161 </pre></div> 1162 1163 1164 <p><strong>Note:</strong> if you intend to work on your own fork and contribute from it, you will 1165 need to also pass <code>--fork=path/to/your/fork</code> (using OS-standard filepath structure), 1166 where <code>path/to/your/fork</code> <em>must</em> be within <code>$GOPATH/src</code>, and you are working from a branch 1167 called <code>ponzu-dev</code>. </p> 1168 <p>For example: </p> 1169 <div class="codehilite"><pre><span></span><span class="c1"># ($GOPATH/src is implied in the fork path, do not add it yourself)</span> 1170 $ ponzu new --dev --fork<span class="o">=</span>github.com/nilslice/ponzu /path/to/new/project 1171 </pre></div> 1172 1173 1174 1175 1176 1177 1178 1179 </article> 1180 </div> 1181 </div> 1182 </main> 1183 1184 1185 <footer class="md-footer"> 1186 1187 <div class="md-footer-nav"> 1188 <nav class="md-footer-nav__inner md-grid"> 1189 1190 <a href="../.." title="Home" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev"> 1191 <div class="md-flex__cell md-flex__cell--shrink"> 1192 <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i> 1193 </div> 1194 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> 1195 <span class="md-flex__ellipsis"> 1196 <span class="md-footer-nav__direction"> 1197 Previous 1198 </span> 1199 Home 1200 </span> 1201 </div> 1202 </a> 1203 1204 1205 <a href="../Generating-References/" title="Generating References" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next"> 1206 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> 1207 <span class="md-flex__ellipsis"> 1208 <span class="md-footer-nav__direction"> 1209 Next 1210 </span> 1211 Generating References 1212 </span> 1213 </div> 1214 <div class="md-flex__cell md-flex__cell--shrink"> 1215 <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i> 1216 </div> 1217 </a> 1218 1219 </nav> 1220 </div> 1221 1222 <div class="md-footer-meta md-typeset"> 1223 <div class="md-footer-meta__inner md-grid"> 1224 <div class="md-footer-copyright"> 1225 1226 powered by 1227 <a href="http://www.mkdocs.org" title="MkDocs">MkDocs</a> 1228 and 1229 <a href="http://squidfunk.github.io/mkdocs-material/" title="Material for MkDocs"> 1230 Material for MkDocs</a> 1231 </div> 1232 1233 1234 <div class="md-footer-social"> 1235 1236 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> 1237 1238 <a href="https://github.com/rpdict" class="md-footer-social__link fa fa-github"></a> 1239 1240 <a href="https://twitter.com/ponzu_cms" class="md-footer-social__link fa fa-twitter"></a> 1241 1242 </div> 1243 1244 1245 </div> 1246 </div> 1247 </footer> 1248 1249 </div> 1250 1251 <script src="../../assets/javascripts/application-6b599127bc.js"></script> 1252 <script>app.initialize({url:{base:"../.."}})</script> 1253 1254 1255 1256 1257 <script>!function(e,t,a,n,o,c,i){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,c=t.createElement(a),i=t.getElementsByTagName(a)[0],c.async=1,c.src=n,i.parentNode.insertBefore(c,i)}(window,document,"script","https://www.google-analytics.com/analytics.js","ga"),ga("create","UA-98609560-1","auto"),ga("set","anonymizeIp",!0),ga("send","pageview");var links=document.getElementsByTagName("a");Array.prototype.map.call(links,function(e){e.host!=document.location.host&&e.addEventListener("click",function(){var t=e.getAttribute("data-md-action")||"follow";ga("send","event","outbound",t,e.href)})});var query=document.forms.search.query;query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}})</script> 1258 1259 1260 </body> 1261 </html>