top:file:run args passing

This commit is contained in:
voidlizard 2025-02-19 11:45:29 +03:00
parent 62aae7ccc3
commit 71679e5b65
1 changed files with 6 additions and 1 deletions

View File

@ -1526,7 +1526,12 @@ internalEntries = do
-- skips shebang
entry $ bindMatch "top:file:run" $ nil_ $ \case
(StringLike fn : args) -> do
a@(StringLike fn : args) -> do
bind "$*" (mkList a)
bind "*args" (mkList a)
forM_ (zip [0..] a) $ \(i,e) -> do
bind (fromString ("$"<>show i)) e
liftIO (TIO.readFile fn)
<&> either (error.show) (fmap (fixContext @C @c) . dropShebang ) . parseTop
<&> \case