mirror of
https://github.com/janet-lang/janet
synced 2024-12-26 00:10:27 +00:00
Add --auto-shebang option to jpm.
This commit is contained in:
parent
78f6b6a507
commit
c8a13ce475
3
jpm
3
jpm
@ -1087,6 +1087,7 @@ int main(int argc, const char **argv) {
|
||||
``
|
||||
[&keys {:main main :hardcode-syspath hardcode :auto-shebang auto-shebang}]
|
||||
(def binpath (dyn :binpath JANET_BINPATH))
|
||||
(def auto-shebang (or auto-shebang (dyn :auto-shebang)))
|
||||
(if (or auto-shebang hardcode)
|
||||
(let [syspath (dyn :modpath JANET_MODPATH)]
|
||||
(def parts (peg/match path-splitter main))
|
||||
@ -1100,7 +1101,7 @@ int main(int argc, const char **argv) {
|
||||
(def second-line (string/format "(put root-env :syspath %v)\n" syspath))
|
||||
(def rest (:read f :all))
|
||||
(string (if auto-shebang
|
||||
(string "#!" JANET_BINPATH "/janet\n"))
|
||||
(string "#!" (dyn :binpath JANET_BINPATH) "/janet\n"))
|
||||
first-line (if hardcode second-line) rest)))
|
||||
(create-dirs path)
|
||||
(spit path contents)
|
||||
|
4
jpm.1
4
jpm.1
@ -42,6 +42,10 @@ Prevents jpm from going to network to get dependencies - all dependencies should
|
||||
Use this flag with the deps and update-pkgs subcommands. This is not a surefire way to prevent a build script from accessing
|
||||
the network, for example, a build script that invokes curl will still have network access.
|
||||
|
||||
.TP
|
||||
.BR \-\-auto\-shebang
|
||||
Prepends installed scripts with a generated shebang line, such that they will use a janet binary located in JANET_BINPATH.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.TP
|
||||
|
Loading…
Reference in New Issue
Block a user