|
398 | 398 | substitutions as an argument. Keys should be keywords with the same name (sans :)
|
399 | 399 | as the substitution keys.
|
400 | 400 |
|
401 |
| - Template is parsed from the `body` which should be string and can contain substitutions. |
| 401 | + Template is parsed from the last element of `body` which should be string and can contain substitutions. |
402 | 402 | ```
|
403 |
| - [template-name body] |
404 |
| - ~(def ,template-name ,(make-template body))) |
| 403 | + [template-name & body] |
| 404 | + ~(def ,template-name ,;(drop 1 body) ,(make-template (last body)))) |
405 | 405 |
|
406 | 406 | (defn opt-ask
|
407 | 407 | ```
|
|
415 | 415 | dflt))
|
416 | 416 |
|
417 | 417 | (deftemplate project-template
|
| 418 | + :private |
418 | 419 | ````
|
419 | 420 | (declare-project
|
420 | 421 | :name "$name"
|
|
428 | 429 | ````)
|
429 | 430 |
|
430 | 431 | (deftemplate native-project-template
|
| 432 | + :private |
431 | 433 | ````
|
432 | 434 | (declare-project
|
433 | 435 | :name "$name"
|
|
445 | 447 | ````)
|
446 | 448 |
|
447 | 449 | (deftemplate module-c-template
|
| 450 | + :private |
448 | 451 | ```
|
449 | 452 | #include <janet.h>
|
450 | 453 |
|
|
474 | 477 | ```)
|
475 | 478 |
|
476 | 479 | (deftemplate exe-project-template
|
| 480 | + :private |
477 | 481 | ````
|
478 | 482 | (declare-project
|
479 | 483 | :name "$name"
|
|
488 | 492 | ````)
|
489 | 493 |
|
490 | 494 | (deftemplate readme-template
|
| 495 | + :private |
491 | 496 | ```
|
492 | 497 | # ${name}
|
493 | 498 |
|
494 | 499 | Add project description here.
|
495 | 500 | ```)
|
496 | 501 |
|
497 | 502 | (deftemplate changelog-template
|
| 503 | + :private |
498 | 504 | ```
|
499 | 505 | # Changelog
|
500 | 506 | All notable changes to this project will be documented in this file.
|
|
505 | 511 | ```)
|
506 | 512 |
|
507 | 513 | (deftemplate license-template
|
| 514 | + :private |
508 | 515 | ```
|
509 | 516 | Copyright (c) $year $author and contributors
|
510 | 517 |
|
|
528 | 535 | ```)
|
529 | 536 |
|
530 | 537 | (deftemplate init-template
|
| 538 | + :private |
531 | 539 | ```
|
532 | 540 | (defn hello
|
533 | 541 | `Evaluates to "Hello!"`
|
|
540 | 548 | ```)
|
541 | 549 |
|
542 | 550 | (deftemplate test-template
|
| 551 | + :private |
543 | 552 | ```
|
544 | 553 | (use ../$name/init)
|
545 | 554 |
|
546 | 555 | (assert (= (hello) "Hello!"))
|
547 | 556 | ```)
|
548 | 557 |
|
549 | 558 | (deftemplate native-test-template
|
| 559 | + :private |
550 | 560 | ```
|
551 | 561 | (use ${name}-native)
|
552 | 562 |
|
553 | 563 | (assert (= (hello-native) "Hello!"))
|
554 | 564 | ```)
|
555 | 565 |
|
556 | 566 | (deftemplate bundle-init-template
|
| 567 | + :private |
557 | 568 | ````
|
558 | 569 | (defn install
|
559 | 570 | [manifest &]
|
|
590 | 601 | ````)
|
591 | 602 |
|
592 | 603 | (deftemplate bundle-info-template
|
| 604 | + :private |
593 | 605 | ````
|
594 | 606 | {:name "$name"
|
595 | 607 | :description ```$description ```
|
|
644 | 656 | (spit (string name "/project.janet") (project-template template-opts)))))
|
645 | 657 |
|
646 | 658 | (deftemplate enter-shell-template
|
| 659 | + :private |
647 | 660 | ````
|
648 | 661 | # . bin/activate
|
649 | 662 | _OLD_JANET_PATH="$$JANET_PATH";
|
|
678 | 691 | ````)
|
679 | 692 |
|
680 | 693 | (deftemplate enter-ps-template
|
681 |
| - ```` |
682 |
| - # . bin/activate.ps1 |
683 |
| - $$global:_OLD_JANET_PATH=$$env:JANET_PATH |
684 |
| - $$global:_OLD_PATH=$$env:PATH |
685 |
| - $$env:JANET_PATH="$abspath" |
686 |
| - $$env:PATH=$$JANET_PATH + "/bin:" + $$env:PATH |
687 |
| - $$function:old_prompt = $$function:prompt |
688 |
| - function global:prompt { |
689 |
| - Write-Host "($name) " -NoNewline |
690 |
| - & $$function:old_prompt |
691 |
| - } |
692 |
| - function deactivate { |
693 |
| - $$env:PATH=$$global:_OLD_PATH |
694 |
| - $$env:JANET_PATH=$$global:_OLD_JANET_PATH |
695 |
| - Remove-Item function:\deactivate |
696 |
| - $$function:prompt = $$function:old_prompt |
697 |
| - Remove-Item function:\old_prompt |
698 |
| - } |
699 |
| - ````) |
| 694 | + :private |
| 695 | + ```` |
| 696 | + # . bin/activate.ps1 |
| 697 | + $$global:_OLD_JANET_PATH=$$env:JANET_PATH |
| 698 | + $$global:_OLD_PATH=$$env:PATH |
| 699 | + $$env:JANET_PATH="$abspath" |
| 700 | + $$env:PATH=$$JANET_PATH + "/bin:" + $$env:PATH |
| 701 | + $$function:old_prompt = $$function:prompt |
| 702 | + function global:prompt { |
| 703 | + Write-Host "($name) " -NoNewline |
| 704 | + & $$function:old_prompt |
| 705 | + } |
| 706 | + function deactivate { |
| 707 | + $$env:PATH=$$global:_OLD_PATH |
| 708 | + $$env:JANET_PATH=$$global:_OLD_JANET_PATH |
| 709 | + Remove-Item function:\deactivate |
| 710 | + $$function:prompt = $$function:old_prompt |
| 711 | + Remove-Item function:\old_prompt |
| 712 | + } |
| 713 | + ````) |
700 | 714 |
|
701 | 715 | (deftemplate enter-cmd-template
|
702 |
| - ```` |
703 |
| - @rem bin\activate.bat |
704 |
| - @set _OLD_JANET_PATH=%JANET_PATH% |
705 |
| - @set _OLD_PATH=%PATH% |
706 |
| - @set _OLD_PROMPT=%PROMPT% |
707 |
| - @set JANET_PATH=$abspath |
708 |
| - @set PATH=%JANET_PATH%\bin;%PATH% |
709 |
| - @set PROMPT=($path) %PROMPT% |
710 |
| - ````) |
| 716 | + :private |
| 717 | + ```` |
| 718 | + @rem bin\activate.bat |
| 719 | + @set _OLD_JANET_PATH=%JANET_PATH% |
| 720 | + @set _OLD_PATH=%PATH% |
| 721 | + @set _OLD_PROMPT=%PROMPT% |
| 722 | + @set JANET_PATH=$abspath |
| 723 | + @set PATH=%JANET_PATH%\bin;%PATH% |
| 724 | + @set PROMPT=($path) %PROMPT% |
| 725 | + ````) |
711 | 726 |
|
712 | 727 | (deftemplate exit-cmd-template
|
713 |
| - ```` |
714 |
| - @rem bin\deactivate.bat |
715 |
| - @set JANET_PATH=%_OLD_JANET_PATH% |
716 |
| - @set PATH=%_OLD_PATH% |
717 |
| - @set PROMPT=%_OLD_PROMPT% |
718 |
| - @set _OLD_JANET_PATH=%PATH% |
719 |
| - @set _OLD_PATH=%PATH% |
720 |
| - @set _OLD_PROMPT=%PROMPT% |
721 |
| - ````) |
| 728 | + :private |
| 729 | + ```` |
| 730 | + @rem bin\deactivate.bat |
| 731 | + @set JANET_PATH=%_OLD_JANET_PATH% |
| 732 | + @set PATH=%_OLD_PATH% |
| 733 | + @set PROMPT=%_OLD_PROMPT% |
| 734 | + @set _OLD_JANET_PATH=%PATH% |
| 735 | + @set _OLD_PATH=%PATH% |
| 736 | + @set _OLD_PROMPT=%PROMPT% |
| 737 | + ````) |
722 | 738 |
|
723 | 739 | (defn scaffold-pm-shell
|
724 | 740 | "Generate a pm shell with configuration already setup."
|
|
0 commit comments