mirror of https://github.com/voidlizard/hbs2
runnable bf6 scripts with shebangs
This commit is contained in:
parent
d9ae9febdd
commit
62aae7ccc3
1
Makefile
1
Makefile
|
@ -21,7 +21,6 @@ BINS := \
|
|||
hbs2-keyman \
|
||||
hbs2-git-subscribe \
|
||||
git-remote-hbs2 \
|
||||
git-hbs2 \
|
||||
hbs2-cli \
|
||||
hbs2-sync \
|
||||
fixme-new \
|
||||
|
|
|
@ -1522,6 +1522,21 @@ internalEntries = do
|
|||
|
||||
_ -> throwIO (BadFormException @c nil)
|
||||
|
||||
let dropShebang = id
|
||||
|
||||
-- skips shebang
|
||||
entry $ bindMatch "top:file:run" $ nil_ $ \case
|
||||
(StringLike fn : args) -> do
|
||||
liftIO (TIO.readFile fn)
|
||||
<&> either (error.show) (fmap (fixContext @C @c) . dropShebang ) . parseTop
|
||||
<&> \case
|
||||
(ListVal (SymbolVal "#!" : _) : rest) -> rest
|
||||
rest -> rest
|
||||
>>= evalTop
|
||||
|
||||
_ -> throwIO (BadFormException @c nil)
|
||||
|
||||
|
||||
brief "parses string as toplevel and produces a form"
|
||||
$ desc "parse:top:string SYMBOL STRING-LIKE"
|
||||
$ entry $ bindMatch "parse:top:string" $ \case
|
||||
|
|
Loading…
Reference in New Issue