This commit is contained in:
voidlizard 2025-01-24 18:41:16 +03:00
parent 5b3d299d5e
commit b8db094714
2 changed files with 25 additions and 0 deletions

View File

@ -8,6 +8,8 @@ module HBS2.CLI.Run.Internal
import HBS2.CLI.Prelude
import HBS2.System.Dir
import HBS2.OrDie
import HBS2.Base58
import HBS2.Data.Types.Refs
@ -168,6 +170,19 @@ internalEntries = do
-- TODO: re-implement-all-on-top-of-opaque
-- TODO: move-somewhere
entry $ bindMatch "rm" $ nil_ \case
[ StringLike p ] -> rm p
_ -> throwIO (BadFormException @c nil)
entry $ bindMatch "touch" $ nil_ \case
[ StringLike p ] -> touch p
_ -> throwIO (BadFormException @c nil)
entry $ bindMatch "mkdir" $ nil_ \case
[ StringLike p ] -> mkdir p
_ -> throwIO (BadFormException @c nil)
entry $ bindMatch "blob:base58" $ \case
[LitStrVal t] -> do
bs <- pure (Text.unpack t & BS8.pack & fromBase58)

View File

@ -1006,6 +1006,16 @@ internalEntries = do
--TODO: integral sum
entry $ bindMatch "upper" $ \case
[ LitStrVal x ] -> pure $ mkStr $ Text.toUpper x
[ SymbolVal (Id x) ] -> pure $ mkSym $ Text.toUpper x
_ -> pure nil
entry $ bindMatch "lower" $ \case
[ LitStrVal x ] -> pure $ mkStr $ Text.toLower x
[ SymbolVal (Id x) ] -> pure $ mkSym $ Text.toLower x
_ -> pure nil
entry $ bindMatch "words" $ \case
[ TextLike x ] -> pure $ mkList [ mkSym y | y <- Text.words x ]
_ -> pure nil