Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,56 @@
# Catscript
# Catscript 😸
### _Making scripts in Scala much easier!_
![Continuous Integration](https://github.com/typelevel/catscript/workflows/Continuous%20Integration/badge.svg)

## Overview
Catscript is a library for working with files (and soon processes) using pure [`IO`](https://typelevel.org/cats-effect/docs/getting-started), designed to make things much easier.

**Before**
```scala 3
Files[IO]
.readUtf8(path)
.evalMap(IO.println(_))
.compile
.drain
```

**After**
``` scala 3
path.read >>= IO.println
```

It does this by drastically reducing the complexity of the `Files' API and getting rid of difficult concepts that are not so necessary for scripting.

## Getting Started

You can use Catscript in a new or existing Scala 2.13.x or 3.x project by adding it to your `build.sbt` file:

```scala
libraryDependencies ++= List(
"org.typelevel" %% "catscript" % latest
)
```

## Example
Catscript is a library to perform common script operations such as working with processes and files while maintaining referential transparency!

```scala 3 mdoc:reset
import cats.effect.{IO, IOApp, ExitCode}

import catscript.*
import catscript.syntax.path.*

object Main extends IOApp:

def run(args: List[String]): IO[ExitCode] =
for
home <- userHome
config = home / ".catscript" / "config.conf"
_ <- config.createFile
_ <- config.write("scripting.made.easy = true")
newconfig <- config.read
_ <- IO.println(s"Loading config: $newconfig")
yield ExitCode.Success

end Main
```
6 changes: 5 additions & 1 deletion docs/directory.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
laika.navigationOrder = [
index.md
]
introduction
files
wiki
tutorial
]
5 changes: 5 additions & 0 deletions docs/examples/directory.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
laika.title = Examples
laika.navigationOrder = [
index.md
solutions.md
]
Loading