Skip to content

Commit c7068c5

Browse files
committed
Make internal templates private.
1 parent 4b99420 commit c7068c5

File tree

1 file changed

+56
-40
lines changed

1 file changed

+56
-40
lines changed

spork/pm.janet

Lines changed: 56 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,10 @@
398398
substitutions as an argument. Keys should be keywords with the same name (sans :)
399399
as the substitution keys.
400400
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.
402402
```
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))))
405405

406406
(defn opt-ask
407407
```
@@ -415,6 +415,7 @@
415415
dflt))
416416

417417
(deftemplate project-template
418+
:private
418419
````
419420
(declare-project
420421
:name "$name"
@@ -428,6 +429,7 @@
428429
````)
429430

430431
(deftemplate native-project-template
432+
:private
431433
````
432434
(declare-project
433435
:name "$name"
@@ -445,6 +447,7 @@
445447
````)
446448

447449
(deftemplate module-c-template
450+
:private
448451
```
449452
#include <janet.h>
450453
@@ -474,6 +477,7 @@
474477
```)
475478

476479
(deftemplate exe-project-template
480+
:private
477481
````
478482
(declare-project
479483
:name "$name"
@@ -488,13 +492,15 @@
488492
````)
489493

490494
(deftemplate readme-template
495+
:private
491496
```
492497
# ${name}
493498
494499
Add project description here.
495500
```)
496501

497502
(deftemplate changelog-template
503+
:private
498504
```
499505
# Changelog
500506
All notable changes to this project will be documented in this file.
@@ -505,6 +511,7 @@
505511
```)
506512

507513
(deftemplate license-template
514+
:private
508515
```
509516
Copyright (c) $year $author and contributors
510517
@@ -528,6 +535,7 @@
528535
```)
529536

530537
(deftemplate init-template
538+
:private
531539
```
532540
(defn hello
533541
`Evaluates to "Hello!"`
@@ -540,20 +548,23 @@
540548
```)
541549

542550
(deftemplate test-template
551+
:private
543552
```
544553
(use ../$name/init)
545554
546555
(assert (= (hello) "Hello!"))
547556
```)
548557

549558
(deftemplate native-test-template
559+
:private
550560
```
551561
(use ${name}-native)
552562
553563
(assert (= (hello-native) "Hello!"))
554564
```)
555565

556566
(deftemplate bundle-init-template
567+
:private
557568
````
558569
(defn install
559570
[manifest &]
@@ -590,6 +601,7 @@
590601
````)
591602

592603
(deftemplate bundle-info-template
604+
:private
593605
````
594606
{:name "$name"
595607
:description ```$description ```
@@ -644,6 +656,7 @@
644656
(spit (string name "/project.janet") (project-template template-opts)))))
645657

646658
(deftemplate enter-shell-template
659+
:private
647660
````
648661
# . bin/activate
649662
_OLD_JANET_PATH="$$JANET_PATH";
@@ -678,47 +691,50 @@
678691
````)
679692

680693
(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+
````)
700714

701715
(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+
````)
711726

712727
(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+
````)
722738

723739
(defn scaffold-pm-shell
724740
"Generate a pm shell with configuration already setup."

0 commit comments

Comments
 (0)